Skip to content

Validate canonical code-evidence paths in the SDK contract loader #541

Closed

Description

@sylvesterkaczmarek

Summary

Python finalization now validates canonical codeEvidence[].path, but the shared schema and TypeScript loader still leave it less constrained than ordinary source locations. Imported sealed findings should receive the same repository-relative path checks as newly finalized findings.

Current status

#1522 added Python code-evidence path validation. The remaining findings schema constrains this field only to a nonempty string, while the SDK's explicit path validation covers locations[].path rather than canonical code-evidence paths.

Field-schema probes on current main accept traversal, absolute, and Windows-style paths. The original report describes the corresponding sealed-loader regression.

Regression to preserve

  1. Copy a synthetic completed-scan fixture.
  2. Add otherwise valid code evidence with path: "../../outside.ts".
  3. Update the sealed findings digest in the manifest.
  4. Call loadContract() and require rejection of that path.

Include valid repository-relative evidence as a control and verify producer/reader parity.

Remaining work

Enforce the existing canonical source-path contract in the shared schema and/or SDK loader. Preserve valid POSIX filenames; the original blanket ban on colon-containing names should not be carried forward as a new policy.

#542 and #1567 are overlapping open proposals. The implementation should agree with the Python validation already shipped in #1522.

Impact

This is evidence attribution/integrity. codeEvidence.code is embedded in the finding, so the path string alone is not an arbitrary-file-read exploit. It can still cause downstream consumers to display evidence under a path outside the supported repository model.

Activity

  1. added
    area:findingsFinding schemas, identity, deduplication, severity, and comparison decisions.
    bugSomething isn't working
    on Oct 8, 2026
  2. changed the title [-]Canonical code-evidence paths bypass repository-relative path validation[/-] [+]Validate canonical code-evidence paths in the SDK contract loader[/+] on Oct 19, 2026
  3. mldangelo-oai commented on Oct 23, 2026

    @mldangelo-oai
    Collaborator

    Verified resolved by #1567 on main at fe9d77e1c3d973b00209487cc9dd30e42886654e (checked October 24, 2026).

    Reproduced the requested setup with fresh copies of the synthetic completed-scan fixture: added canonical codeEvidence, recomputed the findings.json SHA-256 in the manifest, then called the real SDK loadContract() and Python finalizer JSON export. Both reject ../../outside.ts, absolute paths, and Windows-style paths. The original traversal case produces:

    ContractValidationError: findings.findings[0].codeEvidence[0].path: expected a safe repository-relative POSIX path.
    

    Validation results:

    • All 18 smoke cases passed under Bun 1.3.14 and again with the compiled SDK loader under Node 24.21.0. Valid repository-relative controls, including colon-containing filenames, remained accepted, and sealed findings bytes were unchanged.
    • Focused SDK contract/publication regressions: 22 passed, 0 failed, 83 assertions.
    • Focused Python producer regressions: 9 passed plus 26 subtests passed.

    This was local Linux verification using current source and existing installed dependencies; it does not claim full installed-package, full-suite, native Windows, or hosted CI qualification.

    The SDK now applies its existing source-path validator to canonical code evidence, so the permissive structural schema does not bypass runtime validation. The separate Unicode-colon filename compatibility mismatch remains follow-up work proposed in #542.

    Closing as completed by #1567.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:findingsFinding schemas, identity, deduplication, severity, and comparison decisions.bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions