Skip to content

Tail-anchor the H-05 audit-log Edit append check and reject replace_all #172

Description

@SUaDtL

Tail-anchor the H-05 audit-log Edit append check and reject replace_all — mid-file insertion currently passes

Severity: medium | Confidence: 0.85 | Effort: S
Where:
plugins/ca/hooks/pre-edit.py:100-125
Evidence: The H-05 single-Edit check is only if not new.startswith(old): block(...) (pre-edit.py:121). Nothing verifies that old_string is the file's current trailing content, and replace_all is never inspected. Two pass-through shapes: (1) old = any interior log line, new = old + "injected\n" — inserts content between existing audit entries; (2) replace_all=true with an old that occurs N times and new = old + suffix — rewrites all N interior occurrences. Both satisfy new.startswith(old).
Impact: The append-only guarantee on overrides.log / triage.log / sprint-log.md (ORCHESTRATOR §7) is enforceable only against tail-appends; interleaved insertions or multi-site suffix rewrites reorder/alter the audit record while every hook reports it clean. A false allow on the audit trail is called unrecoverable in pre-bash.py's own header (lines 13-15).
Recommendation: For an audit-class Edit: block replace_all outright; read the real file (as _resulting_context already does for CONTEXT.md) and require the edit's old_string to match the file's trailing content (or that the resulting text equals original + appended suffix).
Acceptance criteria:

  • An Edit inserting after an interior audit-log line is BLOCKED [H-05]
  • An Edit with replace_all=true on an audit log is BLOCKED [H-05]
  • A genuine tail append still passes; test_hook_guards.py covers all three

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitySecurity / supply-chain relevantsev:medTribunal/triage: medium severity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions