Repository navigation
fix(auth): refuse an API token while its owner is disabled or deleted - #881
Merged
Merged
Conversation
A disabled user's owk_ token kept authenticating with its full role, so disabling a departing administrator did not stop their automation (bugs/OW-071). Only admin and security_admin hold token:write, so the exposure was the highest-privilege accounts. The workaround was partial: the token list does not show a token's owner. AuthenticateToken now joins the token's owner and refuses the token when the owner is disabled or soft-deleted, and always when the token has no owner (fail closed). It is a check at authentication time, not a revocation: a refusal writes nothing to the token row, so re-enabling the owner restores the token, and a token revoked through Revoke stays revoked. The binder records each refusal with its own declared reason: api_token_owner_disabled, api_token_owner_deleted, api_token_ownerless. This is P8 AC-95 only. P8's audit fields (service_token_effect) are not included. system-api-tokens 1.1.0: C-02 amended, C-04 and AC-06 added. AC-02's fixture now gives its token an active owner, because an ownerless token is refused by design. Mutations on each owner state, on ownerless tokens, on stamping last_used_at on a refusal, on the binder reason, and on implementing the gate as a revocation each turned an AC-06 case red. Upgrade note in CHANGELOG: tokens with no owner stop authenticating; the query to find them is included. Approved as a v0.8 scope-freeze exception on 2026-09-25 (projects/openwatch/V0_8_0_READINESS). Adjacent finding filed, not fixed: bugs/OW-079.
remyluslosius
force-pushed
the
fix/api-token-refused-while-owner-disabled
branch
from
September 27, 2026 00:32
d1a1eae to
e1406a0
Compare
remyluslosius
deleted the
fix/api-token-refused-while-owner-disabled
branch
September 27, 2026 00:57
remyluslosius
added a commit
that referenced
this pull request
Sep 28, 2026
Stage 1 for the sixth 0.8.0 candidate, from main fc1117d. VERSION is 0.8.0-rc.6 in packaging/version.env, the README phrase and the newest CHANGELOG heading; CODENAME stays Eyrie. The hygiene test binds the three. The changelog section records rc.5 on facts: built, every machine gate passed, assets published as a pre-release, no human verdict recorded for its fleet checks, documentation review or release-captain signature, tag and assets preserved. Since rc.5: #870 to #881, #883 and #882. The [Unreleased] notes move into the rc.6 section unchanged. Known limitations gain the two the readiness record lists as shipping with v0.8: drift does not distinguish a corpus change from a host change (D-2 S-3, accepted 2026-09-26), and scan variable values are not type checked (OW-080). Next unused candidate number verified: no v0.8.0-rc.6 tag on the remote or locally, and no release or draft of that name. No tag, publication or attestation.
remyluslosius
added a commit
that referenced
this pull request
Sep 28, 2026
Stage 1 for the sixth 0.8.0 candidate, from main fc1117d. VERSION is 0.8.0-rc.6 in packaging/version.env, the README phrase and the newest CHANGELOG heading; CODENAME stays Eyrie. The hygiene test binds the three. The changelog section records rc.5 on facts: built, every machine gate passed, assets published as a pre-release, no human verdict recorded for its fleet checks, documentation review or release-captain signature, tag and assets preserved. Since rc.5: #870 to #881, #883 and #882. The [Unreleased] notes move into the rc.6 section unchanged. Known limitations gain the two the readiness record lists as shipping with v0.8: drift does not distinguish a corpus change from a host change (D-2 S-3, accepted 2026-09-26), and scan variable values are not type checked (OW-080). Next unused candidate number verified: no v0.8.0-rc.6 tag on the remote or locally, and no release or draft of that name. No tag, publication or attestation.
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.
v0.8 scope-freeze exception, approved 2026-09-25 (
projects/openwatch/V0_8_0_READINESS). Fixesbugs/OW-071. No merge is authorized yet.What was wrong
A disabled user's
owk_API token kept authenticating with its full role.adminandsecurity_adminholdtoken:write, so this is the offboarding case for the highest-privilege accounts.Change
This is P8 AC-95 only.
AuthenticateTokenjoins the token's owner and refuses the token:auth.login.failureapi_token_owner_disabledapi_token_owner_deletedcreated_byNULL)api_token_ownerlesslast_used_atincluded. Re-enabling the owner restores the token, and a token revoked throughDELETE /api/v1/tokens/{id}stays revoked.service_token_effect, AC-97) and any change to the token list.Contract, tests, docs
system-api-tokens1.1.0. C-02 amended; C-04 and AC-06 added.audit/events.yaml, and the AC-80 vocabulary scan passes.last_used_aton a refusal;make spec-checkpasses (100%).Not in this PR
bugs/OW-079, filed: a database failure during token lookup answers 401 rather than 503. It predates this change and is in the backlog under the interruption rule.CHANGELOG.mdmay conflict trivially with the other v0.8 exception PRs.