Skip to content

feat(audit): persist no-match + unknown-method denials (audit #31, P4)#35

Merged
hyperpolymath merged 1 commit into
mainfrom
audit/audit-no-match-and-unknown-method
Jun 2, 2026
Merged

feat(audit): persist no-match + unknown-method denials (audit #31, P4)#35
hyperpolymath merged 1 commit into
mainfrom
audit/audit-no-match-and-unknown-method

Conversation

@hyperpolymath
Copy link
Copy Markdown
Owner

Summary

Audit issue: #31 (priority 4 — provenance/audit logging coverage).

Two denial paths were previously logged via Logger but NOT persisted to
the VeriSimDB audit ledger:

  1. no-match (PolicyCompiler.lookup/3 returns {:error, :no_match})
  2. unknown HTTP method (safe_verb/1 returns nil; PROPFIND, MKCOL,
    REPORT, arbitrary garbage strings)

Both are the most security-relevant paths — probes for undeclared routes
or unsupported verbs are exactly the events a forensic reader most wants
to replay — yet were the ones missing from the audit stream.

Scope

  • lib/http_capability_gateway/gateway.ex: VeriSimDB.audit_deny/4 calls
    on both paths, with a policy_ref discriminator
    (\"no_match\" or \"unknown_method:<METHOD>\") so audit readers can
    distinguish these from explicit-rule denials
  • test/gateway_audit_paths_test.exs: 128 LoC of regression tests that
    drain the VeriSimDB ETS buffer and assert on the cast having landed
    (sys.get_state used to flush the cast queue)

Diff: 2 files, +146 LoC.

Test plan

  • mix test test/gateway_audit_paths_test.exs
  • mix test — confirm no existing tests broke
  • Manual: tail VeriSimDB locally and confirm probes for
    /api/undeclared-route and PROPFIND / produce ledger rows
  • Status: DRAFT — please do not auto-merge. Owner review only.

Echo-types audit

record-as-not-relevant. Audit-ledger persistence is a side-effect, not
a typed protocol; no L3 obligation in scope.

Refs: #31

…audit #31, P4)

Two denial paths were previously logged via Logger but NOT persisted to
the VeriSimDB audit ledger:

1. no-match (PolicyCompiler.lookup returns {:error, :no_match})
2. unknown HTTP method (safe_verb/1 returns nil; PROPFIND/MKCOL/garbage)

Both are the most security-relevant paths — probes for undeclared routes
or unsupported verbs are exactly the events a forensic reader most wants
to replay — yet were the ones missing from the audit stream.

Adds VeriSimDB.audit_deny/4 calls on both paths with a "policy_ref"
discriminator ("no_match" or "unknown_method:<METHOD>") so an audit
reader can distinguish these from explicit-rule denials.

Test coverage:
* /api/totally-undeclared DELETE -> 403 + a no_match audit entry
* PROPFIND /api/known -> 405 + an unknown_method:PROPFIND audit entry
* Both tests drain the VeriSimDB ETS buffer and assert on the cast
  having landed (sys.get_state used to flush the cast queue).

Refs: #31 (self-audit, priority 4)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

🔍 Hypatia Security Scan

Findings: 65 issues detected

Severity Count
🔴 Critical 6
🟠 High 17
🟡 Medium 42

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Issue in boj-build.yml",
    "type": "missing_timeout_minutes",
    "file": "boj-build.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in casket-pages.yml",
    "type": "missing_timeout_minutes",
    "file": "casket-pages.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in codeql.yml",
    "type": "missing_timeout_minutes",
    "file": "codeql.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in dogfood-gate.yml",
    "type": "missing_timeout_minutes",
    "file": "dogfood-gate.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  },
  {
    "reason": "Issue in governance.yml",
    "type": "missing_timeout_minutes",
    "file": "governance.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

@hyperpolymath hyperpolymath marked this pull request as ready for review June 2, 2026 10:17
@hyperpolymath hyperpolymath merged commit 78f4004 into main Jun 2, 2026
18 checks passed
@hyperpolymath hyperpolymath deleted the audit/audit-no-match-and-unknown-method branch June 2, 2026 10:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant