Repository navigation
proof(SafeCORS): discharge misconfiguredNoHeaders OWED to real proof - #91
Merged
Merged
Conversation
Replace the bodyless `0 misconfiguredNoHeaders` OWED declaration with a genuine proof, using a small bridge lemma `validatePolicyNonNil`. The earlier OWED comment claimed Idris2 0.8.0 could not reduce the `validatePolicy` / `generateHeaders` chain past the leading `++` conjunct; in fact it can — `rewrite`ing by the `isUnsafeConfiguration policy = True` hypothesis collapses the inner `if` to its `True` arm, after which `[WildcardWithCredentials] ++ tail` unfolds to `WildcardWithCredentials :: tail` and `isNil (_ :: _)` reduces by `Refl`. The opaque `emptyMethods` right operand never needs inspection because `isNil` matches the spine constructor of the *whole* list, not its content. Zero `believe_me`, zero `postulate`, zero `assert_total`. The two new top-level functions are both `public export` so downstream proof modules can reuse `validatePolicyNonNil` directly. Scope discipline: this PR does NOT touch the four pre-existing broken `Refl` proofs in the same file (`defaultPolicyDeniesAll`, `defaultPolicyIsSafe`, `defaultPolicyNoErrors`, `defaultPolicyNoHeaders`). Those fail for a separate reason — Idris2 0.8.0 does not reduce record-field projection on a literal `MkCORSPolicy ...` constructor unless the value name is *qualified* (`Proven.SafeCORS.defaultPolicy.allowOrigins` reduces by Refl; `defaultPolicy.allowOrigins` does not). That is independent tech debt and is filed as a separate follow-up. Local oracle: - `idris2 --build cors-check.ipkg` reports exactly the 4 pre-existing Refl errors and zero new errors at `misconfiguredNoHeaders` or `validatePolicyNonNil`. - `Proven.SafeCORS.Proofs` is not in `proven.ipkg`, so this change does not move CI status; the discharge stands on its own type signature. Refs hyperpolymath/standards#124 Refs hyperpolymath/standards#158 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
hyperpolymath
enabled auto-merge (squash)
May 30, 2026 13:11
4 tasks
|
🔍 Hypatia Security ScanFindings: 385 issues detected
View findings[
{
"reason": "Action perpolymath/standards/.github/workflows/governance-reusable.yml@main\n needs attention",
"type": "unpinned_action",
"file": "governance.yml",
"action": "pin_sha",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in architecture-enforcement.yml",
"type": "unknown",
"file": "architecture-enforcement.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in architecture-enforcement.yml",
"type": "unknown",
"file": "architecture-enforcement.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in boj-build.yml",
"type": "unknown",
"file": "boj-build.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in casket-pages.yml",
"type": "unknown",
"file": "casket-pages.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in cflite_batch.yml",
"type": "unknown",
"file": "cflite_batch.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in cflite_pr.yml",
"type": "unknown",
"file": "cflite_pr.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in codeql.yml",
"type": "unknown",
"file": "codeql.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
},
{
"reason": "Issue in dogfood-gate.yml",
"type": "unknown",
"file": "dogfood-gate.yml",
"action": "flag",
"rule_module": "workflow_audit",
"severity": "medium"
}
]Powered by Hypatia Neurosymbolic CI/CD Intelligence |
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
0 misconfiguredNoHeadersOWED declaration insrc/Proven/SafeCORS/Proofs.idrwith a genuine proof via a smallvalidatePolicyNonNilbridge lemma.believe_me, zeropostulate, zeroassert_total. Both new top-level functions arepublic exportfor downstream reuse.Why this works (refuting the OWED note)
The prior OWED comment claimed Idris2 0.8.0 could not reduce the
validatePolicy/generateHeadersguard chain past the leading++conjunct. In fact:rewriteing byisUnsafeConfiguration policy = Truecollapses the innerifto itsTruearm.[WildcardWithCredentials] ++ tailthen unfolds toWildcardWithCredentials :: tail.isNil (_ :: _)reduces byRefl.emptyMethodsright operand of++never needs to be inspected, becauseisNilmatches the spine constructor of the whole list, not its content.Scope discipline
This PR does NOT touch the four pre-existing broken
Reflproofs in the same file (defaultPolicyDeniesAll,defaultPolicyIsSafe,defaultPolicyNoErrors,defaultPolicyNoHeaders). They fail for a different reason — Idris2 0.8.0 does not reduce record-field projection onMkCORSPolicy ...unless the value name is qualified. Independent tech debt; will file as separate follow-up issue.Test plan
idris2 --build cors-check.ipkg(private isolated package) reports exactly the 4 pre-existing Refl errors and zero new errors atmisconfiguredNoHeadersorvalidatePolicyNonNil.believe_me/postulate/assert_totalintroduced.Proven.SafeCORS.Proofsis not inproven.ipkg(see follow-up issue) so this PR does not change CI surface; the discharge stands on its own type signature.Refs hyperpolymath/standards#124
Refs hyperpolymath/standards#158
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
🤖 Generated with Claude Code