feat(vault): add key-version header and rotation keyring support (#1770) - #2051
Conversation
|
hey @utksh1 all the 26 checks have been passed with no error please review the pr as it is ready to merge |
|
hi @utksh1 i have resolved the merge conflict and also the issue is solved and PR is ready to merge plese review it |
|
hi @utksh1 i have resolved the merge conflict and also the issue is solved and PR is ready to merge plese review it |
1 similar comment
|
hi @utksh1 i have resolved the merge conflict and also the issue is solved and PR is ready to merge plese review it |
utksh1
left a comment
There was a problem hiding this comment.
The vault key-version work should be reviewed independently. Please remove the unrelated saved-views auth-test edits, retain only vault implementation/tests, and rebase before re-review.
9d9b84d to
5170d55
Compare
|
hey @utksh1 once please review the PR as all 26 checks are passsed and the issue is solved |
Description
Refactor
VaultCryptoinbackend/secuscan/vault.pyto add explicit key-version headers, rotation keyring support, collision-safe legacy fallback decryption, key ID extraction, and strict payload length guards.Key Technical Enhancements
Prepend magic header
b"SV1:"(4 bytes) and raw key fingerprint (8 bytes) to newly encrypted blobs:Updated
VaultCrypto.__init__(key, fallback_keys=[...])to maintain an internal_keyring: Dict[bytes, AESGCM]). Decryption extracts the key ID from the header to look up the correct key instantly without trial-and-error GCM tag failures.If versioned decryption fails or if a legacy random 12-byte nonce coincidentally starts with
b"SV1:"(1 indecrypt()automatically falls back to attempting legacy decryption (nonce(12) || ciphertext), guaranteeing zero false-positive decryption failures for pre-existing secrets.Added
VaultCrypto.extract_key_id(cls, payload: str) -> Optional[str]to inspect base64url payloads and return the colon-separated hex key fingerprint without requiring secret decryption.Enforced strict minimum length guards (
Related Issues
Closes #1770
Type of Change
How Has This Been Tested?
Automated backend unit and integration test suites executed: