Skip to content

Commit

Permalink
finish-args: Add check to catch incorrect secret service talk-name
Browse files Browse the repository at this point in the history
  • Loading branch information
bbhtt committed Sep 25, 2024
1 parent c0be918 commit aef6df9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions flatpak_builder_lint/checks/finish_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ def _validate(self, appid: str | None, finish_args: dict[str, set[str]]) -> None
):
self.errors.add("finish-args-flatpak-talk-name")

if talk_name == "org.freedesktop.Secrets":
self.errors.add("finish-args-incorrect-secret-service-talk-name")
self.info.add(
"finish-args-incorrect-secret-service-talk-name: The name is in lower case"
+ " org.freedesktop.secrets"
)

for sys_own_name in finish_args["system-own-name"]:
if sys_own_name == "org.freedesktop.*":
self.errors.add("finish-args-wildcard-freedesktop-system-own-name")
Expand Down
6 changes: 6 additions & 0 deletions tests/manifests/finish_args-incorrect_secrets-talk-name.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"app-id": "org.flathub.finish_args",
"finish-args": [
"--talk-name=org.freedesktop.Secrets"
]
}
6 changes: 6 additions & 0 deletions tests/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,12 @@ def test_manifest_finish_args_issue_wayland_x11() -> None:
assert "finish-args-contains-both-x11-and-wayland" in found_errors


def test_manifest_finish_args_incorrect_secret_talk_name() -> None:
ret = run_checks("tests/manifests/finish_args-incorrect_secrets-talk-name.json")
found_errors = set(ret["errors"])
assert "finish-args-incorrect-secret-service-talk-name" in found_errors


def test_manifest_finish_args_issue_33() -> None:
ret = run_checks("tests/manifests/own_name_substring.json")
found_errors = set(ret["errors"])
Expand Down

0 comments on commit aef6df9

Please sign in to comment.