Repository navigation
Refuse a token whose audit sync uses up the handover allowance - #3344
Open
jparker2006 wants to merge 2 commits into
Open
jparker2006 wants to merge 2 commits into
jparker2006 wants to merge 2 commits into
Conversation
Co-authored-by: Jake Parker <jparker2006@users.noreply.github.com>
Member
Author
Review #3344 at 9f18899
Checked the repository standards, #1925 and its parent spec, and the full diff. All 42 tests passed across the token-service, token contract, App selection and helper sealing tests. The PR's new test failed against the base for the expected reason. VERDICT: CHANGES at 9f18899 |
…lowance. The log is locked while a line is written and synced. If the sync after the append leaves too little time, that line is replaced in place with an expiry refusal that has no grant fields. Any audit failure leaves a valid unavailable line, or no line at all, and revokes a token GitHub already minted. The test finds the log by device and inode instead of /proc, so it runs the same way on macOS.
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.
Summary
The token service checked the minted lifetime before the audit log write and sync, so a sync longer than the ten-second handover allowance could still return a token the helper must not use.
It checks again after that sync. If the allowance is gone, it revokes the token, records
expiryin the mint log, and returns that refusal.Fixes #1925
Tests
python3 -I tools/github-app/test_token_service.py RequestFixtureTests.test_a_slow_audit_sync_is_refused_when_it_uses_up_the_handover_allowanceadvances the clock by 12 seconds on each mint-log sync. A token with 311 seconds left is refused and revoked; one with 360 seconds left is still minted. The existing handover test still passes.