You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(hub): preserve canonical provider keys in audits - #167
A provider key accepted by Hub's canonical parser could still be rejected while building a typed security audit when its opaque value resembled credential text, such as secret:workforce. Identity creation and provider revision operations could then roll back, and their terminal failure audit could fail for the same reason. This is a focused follow-up to #163.
What changes
Canonical provider keys now carry a branded type from parseProviderKey() into the audit layer. Typed identity audit events use a narrow provider-key encoder that preserves the exact key for correlation and retains the existing string, byte, entry, and context limits, while bypassing only the generic credential-value heuristic that is inappropriate for this already-validated field. Generic untyped audit context still rejects credential-shaped values, secret-bearing fields, bearer tokens, and private-key material.
Regression coverage exercises representative opaque and Unicode provider keys through the public audit boundary, identity creation and provider revision success, post-rollback failure audits, invalid keys, generic credential rejection, context limits, and raw-error leakage. This changes no provider-key acceptance rules, database schema or migrations, product behavior outside identity auditing, or UI.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The oversized fixture never exercises the final byte-limit check, and the new encoder lacks tests confirming rejection of credential-shaped values outside provider.
Preserves canonical provider keys in Hub’s identity audits so credential-shaped keys no longer cause identity or provider-revision transactions to roll back. This follows up on the identity transaction foundation in #163.
Changes:
Carries a branded provider-key type from parsing into typed audit events.
Adds provider-specific context encoding while retaining context limits and generic credential protections.
Adds regression coverage for exact key preservation, successful transactions, and post-rollback failure audits.
File
Description
hub/server/utils/parse-provider-key/index.ts
Brands validated provider keys without changing acceptance rules.
This adds a second exported function to the module, contrary to hub/docs/coding-conventions.md:11. Move createSecurityAuditContextWithProviderKey and its tests into a dedicated function directory with a matching describe("createSecurityAuditContextWithProviderKey()") block, and update the audit mapper's import.
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
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.
Why
A provider key accepted by Hub's canonical parser could still be rejected while building a typed security audit when its opaque value resembled credential text, such as
secret:workforce. Identity creation and provider revision operations could then roll back, and their terminal failure audit could fail for the same reason. This is a focused follow-up to #163.What changes
Canonical provider keys now carry a branded type from
parseProviderKey()into the audit layer. Typed identity audit events use a narrow provider-key encoder that preserves the exact key for correlation and retains the existing string, byte, entry, and context limits, while bypassing only the generic credential-value heuristic that is inappropriate for this already-validated field. Generic untyped audit context still rejects credential-shaped values, secret-bearing fields, bearer tokens, and private-key material.Regression coverage exercises representative opaque and Unicode provider keys through the public audit boundary, identity creation and provider revision success, post-rollback failure audits, invalid keys, generic credential rejection, context limits, and raw-error leakage. This changes no provider-key acceptance rules, database schema or migrations, product behavior outside identity auditing, or UI.