Repository navigation
fix(impersonation): mirror support sessions into canonical audit trail (#229) - #308
Merged
BigDella merged 1 commit intoOct 19, 2026
Conversation
Every impersonation session start, end, expiry, allowed action and blocked mutation now writes to the canonical tamper-evident audit trail in addition to the local trail. Declare the five impersonation actions in SENSITIVE_ACTIONS, attribute them to the maintainer, target the user, and record denials with an outcome and error code. Add canonical-audit tests and document scopes, expiry, failure modes and rollback/recovery for support access.
|
@Goodyslim Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Author
|
CI is waiting for maintainer approval ( Local checks:
The full |
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.
Closes #229
Summary
Closes the remaining support-access gap in issue #229: the scoped, time-bounded impersonation model from #80 now writes every session event into the canonical, tamper-evident
core/audittrail, and the operational edge cases/failure modes/rollback steps are documented.Problem
core/impersonationalready provided time-bounded sessions, scopes, read-only defaults, dangerous-mutation blocking, elevated confirmation and a user-safe banner projection. However, its audit events were only written to a local in-memory array. They never reachedcore/audit, so a support session could not be reviewed alongside the rest of the sensitive-action trail, and there was no operational runbook for expiry, scope failures, audit availability or recovery.Solution
SENSITIVE_ACTIONS:impersonation.session_startedimpersonation.session_endedimpersonation.session_expiredimpersonation.actionimpersonation.mutation_blockedrecordAuditwith:{ kind: "maintainer", id }maintainer{ kind: "user", id }support_accesserrorCode: "impersonation_denied"core/impersonation/__tests__/audit-trail.test.tscovering session start, allowed action, blocked mutation, expiry and session end in the canonical trail.docs/SUPPORT_ACCESS.mdcovering scopes, expiry, audit mapping, edge cases, failure modes, rollback/recovery and verification.docs/AUDIT.md.Validation
npx vitest run core/impersonation core/auditΓÇö 6 files, 82 tests passed.npx eslint core/audit/audit.ts core/impersonation/impersonation.ts core/impersonation/__tests__/audit-trail.test.tsΓÇö 0 errors.npm run checkis blocked by pre-existing failures onmain(cce0053), including 25 unrelated lint errors and failing ownership/invariants/export/webhook/faucet tests, plus duplicate-import build errors inclaimable-balancesandtestnet-faucet. Main CI is already red for the same reasons. None of the failures are in the touched files.Parallel-work check
No PR referencing #229 existed when work began or immediately before pushing. The other assigned Savitools issue (#431) was skipped because it was already fixed incidentally by PR #434 on Oct 16. This branch is based on current
main(cce0053).