Skip to main content
← Back to list
01Issue
FeatureClosedSwamp CLI
Assigneesstack72

#258 feat(security): redact sensitive method arg values from audit log

Opened by stack72 · 5/5/2026

Context

Issue #243 implemented redaction of z.meta({ sensitive: true }) argument fields from per-run log files, result resource attributes, and method summary reports. However, the audit JSONL log is not yet covered.

Problem

When a method executes, the audit log records method arguments verbatim. If a field is marked sensitive: true, its value should be replaced with *** in audit entries just as it is in other output locations.

Acceptance criteria

  • Audit log entries for sensitive argument fields show *** rather than the plaintext value
  • Non-sensitive fields remain unredacted
  • Applies to both string and string-array typed sensitive fields
  • Issue #243: initial sensitive arg redaction implementation
  • UAT: swamp-uat#190
02Bog Flow
OPENTRIAGEDIN PROGRESSCLOSED+ 1 MOREASSIGNED+ 14 MOREREVIEW+ 1 MOREIMPLEMENTATION

Closed

5/5/2026, 9:26:56 PM

No activity in this phase yet.

03Sludge Pulse
stack72 assigned stack725/5/2026, 8:35:56 PM
Editable. Press Enter to edit.

stack72 commented 5/5/2026, 9:28:17 PM

Implementation paused mid-stream — leaving a note for future-me / anyone resuming.

Branch: feat/issue-258-audit-log-redaction on stack72/swamp (uncommitted).

Landed and tested (61 unit tests, all passing):

  • src/domain/audit/audit_command_parser.ts (+ test) — tokenizes, recognizes swamp model method run / swamp model create, extracts --input / --global-arg pairs.
  • src/domain/audit/audit_command_redactor.ts (+ test) — assembles inputs via setNestedValue, runs extractSensitiveFieldValues against the schema, registers values with SecretRedactor, returns redacted command.
  • src/domain/audit/test_fixtures.ts — shared Zod schema + buildAuditFixtureDefinition().
  • src/domain/repo/repo_init_check.ts (+ test) — non-throwing isRepoInitialized probe.
  • src/cli/commands/audit.ts — extracted pure recordAuditEntry helper; registry-only lookup with null auto-resolver; lazy-load gated on parser match; try/catch around redactor.
  • src/cli/commands/audit_test.ts — exercises the full pipeline against a temp JsonlAuditRepository.
  • design/audit.md — new "Sensitive value redaction" section.
  • design/vaults.md — appended audit log to redaction sites list.

deno check, deno lint, deno fmt clean. 61/61 new tests green.

Open decisions before this can ship:

  1. The original plan included a global-flag pre-walk so leading invocations like swamp --json model method run … would still redact. Implemented and tested, but on review the cost-benefit is poor: Cliffy already accepts global flags at the leaf level, so swamp model method run … --json --input password=x works fine — the parser skips unknown leaf flags. The leading-flag form is stylistic. Recommendation: rip out skipGlobalFlags + the constants + the drift test (~50 lines saved), document the caveat in design/audit.md, accept that leading-flag invocations won't redact.
  2. src/domain/repo/repo_init_check.ts imports RepoMarkerRepository from infrastructure — same pattern as the existing primary_tool.ts violation. The architecture-boundary test (KNOWN_DOMAIN_INFRA_VIOLATIONS=22) needs a bump to 23, OR refactor to inject the repository.

Not done:

  • Step 10 verification gate (waiting on decision 1)
  • Step 1 follow-up issues — atomic with the PR open: swamp-club issue (security+enhancement) covering vault put + workflow run --input redaction; swamp-uat issue (adversarial) for audit-log scenario; cross-link comment on swamp-uat#190
  • PR open + link_pr lifecycle transition

Out of scope (intentional, deferred via the swamp-club follow-up): --input-file paths, swamp vault put, swamp workflow run --input, direct shell commands. Existing JSONL rows are not retroactively redacted (7-day retention sweeps; manual cleanup is rm .swamp/audit/commands-*.jsonl).

Sign in to post a ripple.