Skip to content

fix(linglong): reuse the cached polkit authorization across package manager calls - #2148

Open
Metastarx wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
Metastarx:patch/ll-package-manager-auth-admin-keep
Open

Metastarx wants to merge 1 commit into
OpenAtom-Linyaps:masterfrom
Metastarx:patch/ll-package-manager-auth-admin-keep

Conversation

@Metastarx

Copy link
Copy Markdown

Summary

Each ll-cli install, ll-cli update or ll-cli uninstall starts a brand new process, and the daemon authorized it with a polkit system-bus-name subject, which polkit resolves to that very process. The install/update/uninstall policies use auth_admin_keep, but the retained authorization is keyed on the subject, so the freshly started process never matched it and the authentication dialog appeared for every single command. The daemon now asks the bus daemon for the caller's uid and resolves its login session, remembers a successful check for that user and session for the same five minutes polkit would have kept it, and skips the polkit round trip inside that window.

#1904

Changes

docs/pages/en/guide/tips-and-faq/faq.md            |   4 +
 docs/pages/guide/tips-and-faq/faq.md               |   4 +
 libs/linglong/CMakeLists.txt                       |   2 +
 .../linglong/package_manager/polkit_authority.cpp  | 113 ++++++++++++++++++++-
 .../linglong/package_manager/polkit_authority.h    |  19 ++++
 libs/linglong/tests/ll-tests/CMakeLists.txt        |  11 ++
 6 files changed, 151 insertions(+), 2 deletions(-)
libs/linglong/src/linglong/package_manager/polkit_authorization_cache.cpp | 127 +++++++++
libs/linglong/src/linglong/package_manager/polkit_authorization_cache.h | 106 +++++++++
libs/linglong/tests/ll-tests/src/linglong/package_manager/polkit_authorization_cache_test.cpp | 264 +++++++++

Verification

ctest --test-dir build-release --output-on-failure — passed (100% tests passed, 0 tests failed out of 744)

Checklist

  • I ran the verification described above
  • The change is minimal and includes no unrelated files
  • The repository contribution guidelines were followed

Copilot AI balanced review requested due to automatic review settings October 8, 2026 08:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@deepin-ci-robot

Copy link
Copy Markdown
Collaborator

Hi @Metastarx. Thanks for your PR.

I'm waiting for a OpenAtom-Linyaps member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

…anager calls

The install, update and uninstall policies are auth_admin_keep, but the grant
obtained by one ll-package-manager process was never visible to the next one
started by a fresh ll-cli invocation, so every command asked for the password
again.

Keep the authorization in a cache keyed by the user and the login session, and
consult it before asking polkit again. The credentials the cache is keyed on
are read back from the bus daemon, which is the only party that knows which
connection made the call.

OpenAtom-Linyaps#1904

Signed-off-by: zhang hongyuan <100520587+Metastarx@users.noreply.github.com>
@Metastarx
Metastarx force-pushed the patch/ll-package-manager-auth-admin-keep branch from 009d61c to 078cbad Compare October 12, 2026 08:52
@Metastarx Metastarx changed the title ll-package-manager 每次安装/卸载都弹出认证框:auth_admin_keep 缓存对新进程调用永远失效 fix(linglong): reuse the cached polkit authorization across package manager calls Oct 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants