Skip to content

Prevent target Git execution and harden provenance/report contracts - #61

Merged
hyperpolymath merged 1 commit into
mainfrom
codex/provenance-signed-followup
Oct 25, 2026
Merged

hyperpolymath merged 1 commit into
mainfrom
codex/provenance-signed-followup

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

A target repository's local Git configuration could make git status execute a filesystem monitor while Pons collected provenance. Pons now reads only the commit identity, with configuration isolation, and leaves whole-target dirty as unknown. Per-file digests continue to identify analysed bytes. No target status/diff operation is used, avoiding both monitors and clean-filter execution.

Also addresses three post-merge review findings from #58:

  • Build provenance watches embedded schemas, protocol fixtures, Cargo inputs and Git metadata resolved for ordinary repositories/worktrees.
  • validate-report reads buffered JSON without an arbitrary 16 MiB input ceiling. Schema/semantic checks still materialise the value; external process resource limits remain necessary for hostile reports.
  • strict_transitions=true is rejected under protocol schema 0.1.0 and requires 0.2.0.

Validation:

  • 219 Rust tests and 46 end-to-end checks passed; clippy with warnings denied and formatting passed.
  • The Git monitor control demonstrates ordinary status really executes a benign hook; scanning the same target does not execute it and reports dirty=null.
  • A 17 MiB schema-valid report is accepted; appended trailing garbage is rejected.
  • An isolated minimal Cargo repository exercises the production build script: clean build reports false, then changing only the embedded schema reports true.
  • Legacy strict-transition rejection and modern positive control pass.

This is a narrowly scoped follow-up to merged #58. Historical eleven-target scan evidence remains tied to its measured source commits; no new application-rule results or performance claims are inferred from these checks. The five format/toolchain prompts remain in docs/handoffs/format-toolchain/.

Verified checkpoint 3946e40f112dfdd42736e2683195be22b9858997 has exact tested tree 3158e9ad401ff47ab27ad962d3ed06e9b7273d1b; original commits are retained at codex/pons-provenance-unsigned-backup. Checkpoint PR #60 targeted a non-main branch. Main branch protection is unchanged.

Tested follow-up to #58: preserve unknown target dirty state without hook-capable Git commands; track embedded build inputs; validate reports without the arbitrary 16 MiB ceiling; reserve strict transitions for protocol schema 0.2.0. Exact reviewed tree 3158e9a.
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 17 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 8d8f524b-54cc-4591-ae41-64113a81cc42
Commits

Reviewing files that changed from the base of the PR and between 6a20ca7 and 3946e40.

Files selected for processing: 7
  • crates/pons-cli/src/main.rs
  • crates/pons-cli/tests/coverage.rs
  • crates/pons-core/build.rs
  • crates/pons-core/src/report/validate.rs
  • crates/pons-protocols/src/lib.rs
  • docs/COVERAGE-MIGRATION.adoc
  • tests/build_provenance.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-25T17:37:46.100082Z 3946e40 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@sonarqubecloud

Copy link
Copy Markdown

@coderabbitai

coderabbitai Bot commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

Add Carrot credits or activate Agent usage billing to use Autofix

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3946e40f11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +21 to +22
pub fn validate_reader(reader: impl std::io::Read) -> Result<String> {
validate_value(serde_json::from_reader(reader)?)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reconcile the evidence contract with unbounded report input

The public contract in docs/EVIDENCE-CONTRACT.adoc still states that report JSON is capped at 16 MiB, but this reader now accepts arbitrarily large input and materializes it in memory. Consumers relying on that documented resource bound may process unexpectedly large reports without external limits; update the authoritative contract alongside this behavior change or retain an explicit ceiling.

Useful? React with 👍 / 👎.

Comment thread tests/build_provenance.sh
Comment on lines +3 to +4
# Exercise the production build script in a minimal isolated Cargo repository.
set -euo pipefail

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wire the provenance regression test into CI

This standalone shell test is not discovered by cargo test, and the checked .github/workflows/rust-ci.yml, Justfile, and repository-wide references do not invoke it; CI currently runs only the Rust tests and tests/e2e.sh. Consequently, the new build-provenance behavior can regress while every configured project check remains green, so add this script to the CI/check entry point.

Useful? React with 👍 / 👎.

Comment thread crates/pons-core/build.rs
println!("cargo:rerun-if-changed=../../.git/HEAD");
println!("cargo:rerun-if-changed=../../.git/refs/heads");
// Ask Git for metadata paths: .git may be a worktree pointer file.
for name in ["HEAD", "refs/heads", "index", "packed-refs"] {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid watching absent Git metadata files

In repositories where .git/packed-refs does not exist, such as an ordinary freshly initialized repository with only loose refs, git rev-parse --git-path packed-refs still succeeds and this emits a dependency on the missing file. Cargo then reports that dependency as stale on every invocation and reruns the build script, recompiling pons-core and its dependents even when nothing changed. Emit the directive only when the resolved metadata path exists, or watch an existing containing path instead.

Useful? React with 👍 / 👎.

Comment on lines +407 to +410
.env("GIT_CONFIG_NOSYSTEM", "1")
.env(
"GIT_CONFIG_GLOBAL",
if cfg!(windows) { "NUL" } else { "/dev/null" },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve trusted safe-directory handling for provenance

When Pons runs under a different UID from the target checkout—a common container or mounted-workspace setup—Git permits the repository only through safe.directory in protected global or system configuration. Nulling both configuration scopes discards that operator-approved exception, so rev-parse fails and the report silently emits target.commit = null even though the same command previously succeeded. Keep the target configuration isolated while explicitly marking the scanned directory safe for this read-only command.

Useful? React with 👍 / 👎.

@hyperpolymath
hyperpolymath merged commit 334d7b4 into main Oct 25, 2026
12 checks passed
@hyperpolymath
hyperpolymath deleted the codex/provenance-signed-followup branch October 25, 2026 17:37
hyperpolymath added a commit that referenced this pull request Oct 25, 2026
…am prompts

* `docs/CI-CD.adoc` — the contract this repository's CI holds itself to:
  what runs, what is required, what each gate may assume, and the failure
  modes this repository actually suffered. The invisible ones are the
  point: a workflow that calls a reusable under an owner the Actions
  allowlist does not admit dies at startup with no job and no check run,
  and `gh pr checks` shows nothing, because a rejected run produces no
  check run.

* `docs/PR57-RECONCILIATION.adoc` — the final disposition. PR #57
  branched before #58, #61 and #63 and was never rebased, so merging it
  forward as a branch would DELETE main's reconciled work, not merely
  conflict with it. The reconciliation above stands, and the reasons are
  now sharper: PR #57's generic `empty-php-function` rule is not a merge
  conflict but a CONTRADICTION of #63's contract, because main's
  `php-empty-security-function` negative corpus asserts that an empty
  non-security function produces no finding and PR #57's rule fires on
  it. The narrower rule that would be correct — empty ANONYMOUS
  callables, which PR #57's callback fixture covers and no existing rule
  does — is specified, and needs a compiler in hand.

  The six SonarCloud diagnostics that remain on main's fixtures are
  handled by the fixture-aware gate added in the previous commit, and the
  rule keys come from the analyser's source rather than from memory.

* `docs/handoffs/upstream-prompts.adoc` — seven ready-to-paste prompts
  for the repositories that have to change for this work to be complete.
  The first is the merge blocker this repository could not fix alone: the
  estate's canonical Actions allowlist admits `hyperpolymath/*` and does
  not list `metadatastician/*`, so a caller that spells the transferred
  owner is refused at startup and the required context is never emitted.
  The others are the KYAML step-6 precondition, the canonical-bytes
  contract for reports that cross a trust boundary, the squabbler's
  consumer-side permission story, the `proven-bench` document contract for
  non-Idris harnesses, the panic-attack interop for a Rust producer, and
  the vocabulary for "structurally valid but not conformant" in DEED/K9.

* `docs/handoffs/format-toolchain/05-pons-asinorum.md` — the standing
  prompt for this repository, with a status update: what is done, what is
  deliberately not done, and why. The library-level ijson-jcs adoption is
  explicitly still open, because it needs `Cargo.lock` regenerated
  against a git dependency.

* `CHANGELOG.adoc` — the user-visible half of all of the above.

Co-authored-by: arena-agent <[email protected]>
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