Skip to content

fix(security): publish RE2-safe repository locator contract - #400

Merged
seonghobae merged 13 commits into
mainfrom
cursor/bc-7a8773c3-4dd9-4430-9381-30e81e3365cc-ae77
Aug 16, 2026
Merged

fix(security): publish RE2-safe repository locator contract#400
seonghobae merged 13 commits into
mainfrom
cursor/bc-7a8773c3-4dd9-4430-9381-30e81e3365cc-ae77

Conversation

@cursor

@cursor cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Purpose

Supersede draft #399 at 8a0abeca906ab91b9bb0c6e86d4139403f2b9bdb (and draft #397) with the same fail-closed . / .. repository check plus the buyer-facing contract that #399 still published as PCRE lookaheads.

#399 correctly rejects ContextualWisdomLab/.., ContextualWisdomLab/., ../noema, and ./noema as 400 ERR_VALIDATION_INPUT before GitHub App private-key use. That head still documented the rule with (?!...) patterns that RE2-based buyer tooling cannot compile, string-compared the OpenAPI pattern instead of executing it, omitted .github / percent-encoded / slash / Unicode / backslash cases, and said URL interpolation happens before key import.

What to do next

Repair

  • Publish a shared OpenAPI RepositoryLocator that uses RE2-safe allOf / not patterns and $ref it from the /exchange request, ExchangeRequest, and success repository.
  • Execute that schema against ContextualWisdomLab/.github and realistic traversal / encoding / slash / Unicode / backslash values.
  • Prove PKCS#8 import happens only after validation, and that .github is the name that reaches key import.
  • Correct doctoring so validation → private-key import → GitHub path interpolation is the recorded order, with OpenAPI 3.1 / JSON Schema 2020-12 / RE2 citations.

Verification

Local Node 24.19.0: npm run typecheck and npm test — 1525 tests, 100% statements/branches/functions/lines.

Related: #84, #397, #399.

Open in Web View Automation 

seonghobae and others added 10 commits August 16, 2026 22:36
Reject owner and name `.`/`..` before GitHub App work, restore the
src/index.ts trailing newline, and publish the same fail-closed rule in
OpenAPI, api-spec, and the changelog so integrators do not send path
traversal segments.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Cite RFC 3986 path normalization and keep the public API docs pointing
integrators at the fail-closed `.` / `..` rule before they send
target_repository.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Replace OpenAPI lookaheads with a shared RepositoryLocator allOf/not
schema, execute that schema against realistic traversal and .github
values, and prove PKCS#8 import happens only after validation.

Co-authored-by: Seongho Bae <seonghobae@users.noreply.github.com>
Preserve the protected-main workflow-registry disablement slice while retaining the repository-locator security contract and both Unreleased changelog entries.
@seonghobae
seonghobae marked this pull request as ready for review August 16, 2026 18:02
@cursor

cursor Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

Preserve current main, including the merged runner-audit hardening, while replaying the repository-locator source, executable OpenAPI tests, and doctoring from PR #400. The pre-restack CHANGELOG insertion is intentionally not allowed to overwrite newer main changelog content; source contract verification remains authoritative until the changelog entry is re-added on the fresh head.
@seonghobae
seonghobae merged commit f5c41fc into main Aug 16, 2026
15 checks passed
@seonghobae
seonghobae deleted the cursor/bc-7a8773c3-4dd9-4430-9381-30e81e3365cc-ae77 branch August 16, 2026 21:34
seonghobae added a commit that referenced this pull request Aug 16, 2026
Record the current protected main as the second parent without changing the already-converged acquisition tree. This repairs live-base ancestry after #400 while preserving the branch's acquisition-only semantic delta and avoids destructive history rewriting.
seonghobae added a commit that referenced this pull request Aug 16, 2026
Restore the current protected-main repository-locator source, OpenAPI/schema contracts, doctoring, and coverage regressions that were unintentionally shadowed by the ancestry-only merge. Keep the acquisition-integrity tree delta while preserving #400 byte-for-byte on its nine owned paths.
seonghobae added a commit that referenced this pull request Aug 17, 2026
* test(acquisition): define fail-closed data-room integrity boundary

* feat(acquisition): recompute bounded data-room evidence integrity

* feat(acquisition): bind generated manifests to exact source evidence

* feat(acquisition): add fail-closed manifest integrity pre-gate

* refactor(acquisition): route manifest generation through integrity policy

* feat(acquisition): require manifest integrity before readiness audit

* fix(release): verify generated acquisition evidence integrity

* docs(acquisition): define authenticated buyer data-room boundary

* docs(doctoring): ground acquisition evidence integrity in current standards

* docs(acquisition): make manifest integrity explicit to buyers

* test(acquisition): exercise forged npm gate and evidence substitutions

* test(acquisition): enforce 100% integrity-module coverage

* docs(changelog): record fail-closed acquisition manifest integrity

* test(acquisition): pin external evidence to reviewed retained path

* fix(acquisition): pin external retained artifact paths

* test(acquisition): bind external evidence fixtures to reviewed paths

* test(acquisition): cover reviewed external artifact path policy

* docs(acquisition): document catalog-pinned external artifacts

* docs(acquisition): index pinned FigJam export evidence

* docs(doctoring): bind external evidence identity to reviewed paths

* test(acquisition): keep unsafe catalog fixture type-safe

* test(acquisition): refuse dirty tracked exact-head evidence

* feat(acquisition): authenticate tracked checkout before evidence use

* fix(acquisition): preflight exact tracked source before manifest load

* fix(acquisition): preflight exact tracked source before integrity audit

* test(acquisition): cover isolated exact-Git preflight policy

* test(acquisition): enforce 100% Git preflight coverage

* docs(acquisition): define exact tracked-checkout trust root

* docs(doctoring): record exact-checkout preflight trust root

* test(acquisition): close Git preflight environment branches

* docs(changelog): record exact tracked-checkout acquisition preflight

* test(acquisition): expose index-flag hidden tracked drift

* fix(acquisition): reject hidden index-state drift

* test(acquisition): cover bounded index-hint refusal

* docs(acquisition): document unsafe Git index-hint refusal

* docs(doctoring): ground index-hint refusal in Git semantics

* docs(changelog): record unsafe Git index-hint refusal

* test(acquisition): add review regression coverage

* fix(acquisition): fail closed on catalog and empty-file edge cases

* fix(acquisition): admit exact CI checkout as safe directory

* test(acquisition): fix empty-evidence fixture setup

* fix(acquisition): enforce private manifest permissions

* fix(acquisition): enforce private audit permissions

* test(acquisition): cover remaining integrity and path regressions

* fix(acquisition): bind default manifest path to exact head

* fix(acquisition): bind integrity audit to shared exact-head path

* test(acquisition): make integrity entrypoint test portable

* test(acquisition): isolate clean-checkout default coverage

* test(acquisition): isolate Git-binding fixture environment

* docs(doctoring): correct evidence-integrity standards and path binding

* refactor(acquisition): remove unreachable path-normalization branch

* docs(acquisition): document exact-head data-room hardening

* docs(acquisition): bind buyer data-room path to exact head

* fix(acquisition): preserve manifest compatibility contract markers

* test(acquisition): close integrity branch coverage gaps

* test(acquisition): cover fail-closed integrity branches

* test(acquisition): close remaining branch coverage gaps

* test(acquisition): fail closed on Git status probe errors

* test(acquisition): assert audit exit contracts

* test(acquisition): reject symlink output targets

* fix(acquisition): add no-follow private output writer

* fix(acquisition): refuse unsafe manifest output targets

* fix(acquisition): refuse unsafe audit output targets

* test(acquisition): cover private output trust boundary

* test(acquisition): enforce private output coverage

* docs(acquisition): document no-follow output boundary

* docs(doctoring): justify no-follow evidence outputs

* docs(doctoring): keep repository citations portable

* docs(changelog): record safe acquisition output writes

* test(acquisition): expose local worktree redirection

* fix(acquisition): bind Git preflight worktree

* docs(acquisition): bind audited Git worktree

* docs(changelog): record Git worktree binding

* docs(doctoring): justify Git worktree binding

* test(acquisition): expose clean-filter trust bypass

* fix(acquisition): isolate tracked comparisons from filters

* test(acquisition): cover split tracked comparisons

* test(acquisition): reproduce parent symlink output escape

* docs(acquisition): isolate source checks from clean filters

* test(acquisition): cover parent symlink entrypoint escapes

* fix(acquisition): reject symbolic-link output parents

* fix(acquisition): validate manifest output parents before mkdir

* fix(acquisition): validate audit output parents before mkdir

* test(acquisition): cover parent-chain validation branches

* docs(doctoring): localize acquisition worktree binding

* docs(acquisition): document parent symlink output boundary

* docs(doctoring): record output parent path integrity rationale

* docs(changelog): record parent symlink output hardening

* test(acquisition): require permission hardening before content mutation

* fix(acquisition): harden output permissions before content mutation

* test(acquisition): preserve content when permission hardening fails

* docs(acquisition): harden permissions before output mutation

* docs(doctoring): bind output mutation to prior permission hardening

* docs(changelog): record permission-before-mutation output hardening

* test(ci): require exact live pull-request head verification

* fix(ci): verify the exact live pull-request head

* fix(ci): bind reviewer verification to the live PR head

* docs(ci): define exact-head pull-request verification

* docs(doctoring): justify exact-head CI binding

* docs(changelog): record exact-head CI binding

* test(ci): keep PR metadata token out of untrusted test steps

* fix(ci): scope PR metadata token to stale-head checks

* fix(ci): isolate PR metadata token from reviewer execution

* docs(ci): keep metadata token out of PR-controlled execution

* docs(doctoring): scope metadata token away from PR code

* test(acquisition): expose repository stat-cache drift bypass

* fix(acquisition): override Git stat-cache trust settings

* test(acquisition): require raw tracked-byte authentication

* test(acquisition): require strict Git stat policy

* fix(acquisition): authenticate raw tracked Git blob bytes

* test(acquisition): cover tracked-byte index refusal paths

* test(acquisition): cover raw tracked-byte verifier

* test(acquisition): cover tracked-object hashing failures

* test(acquisition): enforce byte budget before hashing

* fix(acquisition): enforce byte budgets before blob hashing

* docs(acquisition): document raw tracked-byte authentication

* docs(doctoring): justify raw Git content authentication

* test(acquisition): require descriptor-bound raw byte verification

* fix(acquisition): bind raw Git hashing to no-follow descriptors

* test(acquisition): consolidate descriptor-bound blob coverage

* test(acquisition): fold byte budgets into descriptor tests

* test(acquisition): consolidate descriptor-bound content coverage

* test(acquisition): reach invalid executable-mode metadata branch

* docs(acquisition): align raw-byte authentication with descriptors

* docs(doctoring): bind Git content evidence to descriptors

* test(acquisition): cover empty path and malformed index header

* docs(changelog): record descriptor-bound Git byte authentication

* test: reject index rewrite against exact acquisition tree

* fix: bind acquisition raw-byte inventory to exact HEAD tree

* docs: bind acquisition bytes to immutable exact tree

* docs: doctor immutable exact-tree acquisition authority

* test: cover clean and malformed exact-tree identities

* test: align tracked-source failure contract

* test: require exact tree for production byte authentication

* fix: require immutable tree identity for production byte reads

* test: bind racy Git regression to immutable exact tree

* test(acquisition): bind changelog to exact-tree authority

* docs(acquisition): correct exact-tree byte authority

* test(docs): require integrity in buyer release gate

* docs(acquisition): include integrity in release gate

* test(acquisition): reject unbound transfer rights evidence

* fix(acquisition): bind transfer pass to licensing and IP evidence

* docs(acquisition): define transfer rights evidence schema

* test(acquisition): prove transfer rights binding green path

* test(acquisition): isolate audit rights fixtures from repository state

* test(acquisition): require exact release artifact digest binding

* fix(acquisition): authenticate exact release artifact digests

* test(acquisition): retain exact release fixture artifacts

* test(security): reject symlinked acquisition rights evidence

* fix(security): bind acquisition reads to real repository paths

* test(acquisition): isolate transfer audit environment

* test(acquisition): isolate readiness audit environment

* test(acquisition): require exact artifact rights metadata

* fix(acquisition): authenticate release artifact rights metadata

* test(acquisition): add passing artifact rights receipt

* docs(acquisition): require artifact rights receipt binding

* docs(acquisition): add artifact rights metadata template

* test(acquisition): cover approved OCI SPDX rights

* docs(acquisition): index exact artifact rights evidence

* test(acquisition): reject duplicate artifact-rights keys

* fix(acquisition): reject ambiguous artifact-rights JSON

* test(acquisition): reject duplicate top-level evidence keys

* fix(acquisition): reject duplicate top-level JSON evidence

* test(acquisition): restore transfer-rights RED contract

Reintroduce the realistic report-only acquisition audit regression suite for owner/legal rights, retained digest bindings, exact-release artifact metadata, package-license consistency, contributor IP evidence, and symlink-resistant retained paths. Current protected audit logic does not yet enforce these contracts, so this commit intentionally establishes the RED boundary before the semantic source merge.

* fix(acquisition): bind transfer readiness to retained licensing evidence

Semantically merge the predecessor transfer-rights validator onto the current protected acquisition audit without regressing fatal UTF-8 or decoded duplicate-key rejection. Require owner/legal decision evidence, repository-rights digest binding, package-license consistency, exact-release SBOM/license/NOTICE/provenance and artifact-rights metadata, contributor IP evidence, and symlink-resistant bounded retained reads before transfer evidence can pass.

* test(acquisition): preserve strict JSON evidence boundaries

Add exact-release artifact-rights duplicate-key regression coverage and keep the protected top-level decoded duplicate-key contract executable after the transfer-rights semantic merge. These tests ensure acquisition licensing evidence cannot reintroduce last-key-wins ambiguity while preserving the newer protected JSON parser behavior.

* test(acquisition): restore end-to-end readiness regressions

Restore the end-to-end acquisition audit suite on the rebuilt branch so successful evidence must exercise production pilot, revenue, transfer-rights, saleable-readiness and data-room paths together, while placeholder, stale, missing and report-only evidence remains fail-closed or explicitly NOT_READY as designed.

* docs(acquisition): restore placeholder-safe rights evidence templates

Restore buyer/operator templates for transfer-rights and exact-release artifact-rights metadata using explicit replacement markers rather than invented legal decisions, license expressions, release identities, digests, or contributor-ownership evidence.

* test(acquisition): retain resolved review regressions

Restore the predecessor's resolved acquisition review regression suite on the rebuilt current-main lineage, covering bounded catalog shape, zero-byte retained evidence, read-bound handling, unsupported kinds, external receipt bounds, canonical paths, direct command materialization, isolated Git stat policy and owner-only retained-output modes.

* fix(stack): preserve protected #400 security contract

Restore the current protected-main repository-locator source, OpenAPI/schema contracts, doctoring, and coverage regressions that were unintentionally shadowed by the ancestry-only merge. Keep the acquisition-integrity tree delta while preserving #400 byte-for-byte on its nine owned paths.

* test(acquisition): reject symlinked top-level evidence

* fix(acquisition): read top-level JSON evidence fail-closed

* test(acquisition): align unsafe-object evidence classification

* test(acquisition): bound full entrypoint integration time

* test(acquisition): bound multi-entrypoint integration time
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.

2 participants