test(phase-c): document §3 invariant 3 BoJ-side enforcement (FINDING, standards#98)#94
Closed
hyperpolymath wants to merge 1 commit into
Closed
test(phase-c): document §3 invariant 3 BoJ-side enforcement (FINDING, standards#98)#94hyperpolymath wants to merge 1 commit into
hyperpolymath wants to merge 1 commit into
Conversation
… standards#98) Adds `elixir/test/phase_c_seam_test.exs` — a Phase C seam-test module that complements http-capability-gateway#11 (gateway-side X-Trust-Level strip + re-emit) by documenting the BoJ-side half of the §3 defence-in-depth pair. ## Live tests (4 passing) * Loopback callers (127.0.0.1 + ::1) honour gateway-forwarded X-Trust-Level — the gateway-equivalent path. * :public cartridge accepts a non-loopback caller regardless of header. * `TrustPolicy.satisfies?/3` accepts every trust claim when `is_local: true`. ## Skipped tests (5 — they document a finding) Phase A contract §3 invariant 3 states: > Any X-Trust-Level arriving from any other source MUST be ignored > and treated as untrusted. `BojRest.TrustPolicy.satisfies?/3` does not currently enforce this — its third clause (`satisfies?(:authenticated, trust, _local) when trust in ["authenticated", "internal"]`) matches regardless of `is_local`. A non-loopback caller reaching BoJ's back-side bind (a §4 violation) can therefore claim any trust class by setting a header. Mitigation today: §4 (back-side bind isolation) keeps the non-loopback path unreachable in well-configured deployments. The §3 invariant is nonetheless "mandatory, not advisory" per the contract. The 5 skipped tests are tagged `@tag skip: <reason>`; they will pass as-is when the fix lands (one additional clause in `satisfies?/3`: `def satisfies?(_required, _trust, false), do: false` between the `:public` and `:authenticated` clauses). Tests-only PR — production code, the bug-codifying assertions in `trust_policy_test.exs` / `router_test.exs`, and the contract-doc implementation note are deliberately NOT included this round, pending owner decision on the §3 enforcement (separate follow-up PR). `mix test` 188 → 186 + 5 skipped = same coverage, +5 skipped, +4 live; 0 failures. Refs hyperpolymath/standards#98 Refs hyperpolymath/standards#91 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
🔍 Hypatia Security ScanFindings: 29 issues detected
View findings[
{
"reason": "Stale AI session file -- delete",
"type": "stale",
"file": "GEMINI.md",
"action": "delete",
"rule_module": "root_hygiene",
"severity": "medium"
},
{
"reason": "Issue in quality.yml",
"type": "missing_workflow",
"file": "quality.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Issue in security-policy.yml",
"type": "missing_workflow",
"file": "security-policy.yml",
"action": "create",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Action hyperpolymath/standards/.github/workflows/governance-reusable.yml@main needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "high"
},
{
"reason": "Python file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/.github/scripts/validate-eclexiaiser.py",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
},
{
"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/cartridges/sanctify-mcp/adapter/mod.ts",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
},
{
"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/cartridges/academic-workflow-mcp/adapter/mod.ts",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
},
{
"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/cartridges/fireflag-mcp/adapter/mod.ts",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
},
{
"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/cartridges/ephapax-mcp/adapter/mod.ts",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
},
{
"reason": "TypeScript file detected -- banned language",
"type": "banned_language_file",
"file": "/home/runner/work/boj-server/boj-server/cartridges/bofig-mcp/adapter/mod.ts",
"action": "flag",
"rule_module": "cicd_rules",
"severity": "critical"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
Owner
Author
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.
Summary
Phase C seam-test module for
BojRestthat documents the BoJ-side halfof the http-capability-gateway §3 trust-header invariant.
Tests-only — surfaces a security finding for owner decision; no
production code change in this PR.
Companion to http-capability-gateway#11 (gateway-side X-Trust-Level
strip + re-emit, opened by the dedicated
hcg-tier2-channelbot earlier today).Together they would form the Phase C defence-in-depth pair.
The finding
Phase A contract §3 invariant 3 (
docs/integration/http-capability-gateway-boj-contract.md) states:BojRest.TrustPolicy.satisfies?/3currently:The third clause matches regardless of
is_local— so a non-loopbackcaller presenting
X-Trust-Level: authenticated|internalto an:authenticatedcartridge is accepted. The §3 invariant is unenforcedat the BoJ side.
Mitigation in practice today: §4 (back-side bind isolation) keeps the
non-loopback path unreachable in well-configured deployments. The §3
enforcement is nonetheless "mandatory, not advisory" per the contract.
Proposed fix (NOT in this PR)
One additional clause in
satisfies?/3, between the:publicclauseand the
:authenticatedclause:This rejects every non-
:publicexposure whenis_local: false, so thenon-loopback header is effectively ignored.
What this PR adds
elixir/test/phase_c_seam_test.exs— 186 LOC, 9 tests, 0 production code change.Live tests (4 passing today)
X-Trust-Level— positive control:publiccartridge is still allowed (header is irrelevant) — controlTrustPolicy.satisfies?/3accepts every claim whenis_local: true— function-level paritySkipped tests (5 — document the finding)
Tagged
@tag skip: "Phase A §3 invariant 3 unenforced ..."; will passas-is when the proposed one-line fix lands. They cover:
X-Trust-Level: internal|authenticated→ expects 4032001:db8::1) → expects 403/cartridge/:name/sse)TrustPolicy.satisfies?/3function-level parity foris_local: falseTest plan
mix test— 186 passed, 0 failed, 5 skipped (the finding):public-cartridge-from-non-loopback (control)Why
RefsnotClosesstandards#98 (Phase C) and standards#91 (HCG tier-2 channel) are
major,requirements-target— joint-close only on explicit owneragreement. Phase C is the bot's lane; this is a complementary slice.
Refs hyperpolymath/standards#98
Refs hyperpolymath/standards#91
🤖 Generated with Claude Code