ak-sysd: keep the file fallback unless the keyring token reads back - #1360
Open
PeshekDotDev wants to merge 1 commit into
Open
ak-sysd: keep the file fallback unless the keyring token reads back#1360PeshekDotDev wants to merge 1 commit into
PeshekDotDev wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1360 +/- ##
==========================================
- Coverage 42.84% 42.81% -0.04%
==========================================
Files 161 161
Lines 14706 14717 +11
Branches 9721 9732 +11
==========================================
Hits 6301 6301
- Misses 8270 8281 +11
Partials 135 135 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. |
Contributor
|
🚀 Deployed on https://pr-1360--authentik-pkg.netlify.app |
This was referenced Aug 11, 2026
PeshekDotDev
force-pushed
the
fix/sysd-keychain-readback
branch
from
August 12, 2026 06:09
75d0914 to
1bf3f35
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
What does this PR change?
save_domainclearedfallback_tokenwhenever the keyring write returnedOk. It now also reads the value back, and only drops the on-disk copy if the read succeeds and matches.Why is this change needed?
On macOS the write succeeds from a launchd daemon but the read fails with
errSecInteractionNotAllowed— retrieving the item wants an ACL prompt and a root daemon has no UI session to show one:Because the write looked fine,
fallback_tokenwas blanked, soresolve_tokenfell back to an empty string. Every request then went out asBearer+agentand came back:The effect is that any successful
ak-sysd domains joinleaves the device token somewhere sysd can never read, and authentication breaks on the next restart. Observed repeatedly on macOS 26.6; the token had to be written intodomains/<name>.jsonby hand each time to recover.DomainConfig::fallback_tokenis documented as "Only present in the JSON file if the keyring is unavailable" — a keyring that can be written but not read is unavailable for this purpose, so this restores the intended behaviour rather than adding a new one.How was this tested?
cargo check -p ak-sysd. Verified against a live macOS 26.6 host:domains joinsucceeds, the keychain item is created, and the read-back fails — with this change the token stays in the JSON file and sysd authenticates after a restart instead of 403ing.Linked issues
Found alongside two other macOS regressions from the Rust migration (#1262): the PSSO
:authorityrejection andactive()selecting a token-less domain.Checklist
make all)make docs)