Repository navigation
Expire a stored policy after thirty days, not a year - #1070
Merged
Merged
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
A signed policy stayed enforceable for a year, which is how far back a rollback could reach. Restoring an older copy of the policy record puts older, more permissive rules back in force, and at a 365 day window rules retired eleven months ago still loaded as active. This shortens the window to thirty days, so a warden renews monthly and a rollback reaches back at most that far.
Why the window rather than a stored floor. The obvious fix is a high-water mark kept in its own record, refusing any bundle below it. It does not hold here. The policy record lives in app-private storage encrypted under a key the app can use without the operator present, so the access needed to restore an older record is also enough to rewrite a floor sitting beside it. A floor also has to be bounded in the forward direction, for the reason
monotonic_timestampinaudit.rsalready documents: one entry planted far in the future would refuse every legitimate policy after it, and an escape hatch for that either voids the floor or bricks the device. The validity window needs no new record, no protection for that record and no escape hatch, and the machinery it relies on is already built: an expired bundle faults and every rule refuses, while the bundle stays readable so a replacement installs over it rather than requiring the record be deleted first.What this costs. A device left idle past thirty days comes back with an expired policy, and every rule refuses until a warden signs a new bundle. For an unattended co-signer that is an outage rather than a prompt, which is the deliberate trade: refusing is the safe direction, and recovery is a renewal rather than a reinstall.
What it does not do. Bounding is not preventing. Rollback inside the window still works, and closing that needs a witness the device cannot roll back on its own, meaning a warden-issued epoch checked at import. That is connectivity-dependent and tracked separately rather than folded in here.
The test pins the window in absolute days rather than against the constant. Every other date in these tests is expressed in terms of
MAX_POLICY_AGE_SECS, so all of them pass at any window; this one fails if the value changes, which is what makes a future change to it deliberate.