8000 fix(checkouts): validate repository URLs and refs before calling git by minimal-backporter[bot] · Pull Request #3451 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix(checkouts): validate repository URLs and refs before calling git - #3451

Open
minimal-backporter[bot] wants to merge 2 commits into
release/0.7.xfrom
backport/3378-to-release/0.7.x
Open

minimal-backporter[bot] wants to merge 2 commits into
release/0.7.xfrom
backport/3378-to-release/0.7.x

Conversation

@minimal-backporter
Copy link
Copy Markdown

Backport of #3378 to release/0.7.x.

Squash-merge this PR and keep the PR title as the subject. The cherry-picked commit keeps the source subject.

…3378)

* fix(checkouts): validate repository URLs and refs before calling git

A repository URL or ref from minimal.toml now has to be non-empty and
must not start with `-` before it reaches git, and the clone passes
`--` ahead of the URL so the value is always read as a value. Git
calls on a project's repository also turn the `ext` transport off,
whatever the host's git config says. A malformed value is refused with
the value named and a pointer to minimal.toml.

Fixes gominimal/inbox#1247

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(checkouts): refuse an option-like url or ref early, and redact it

Manager::checkout_of now refuses an option-like remote or ref first, before
the lock, the bare directory and any clone or fetch. A refused URL left an
empty directory under git/db, and a refused ref cost a clone or fetch first
(or surfaced as the clone's failure). Repo keeps its own check for direct
callers.

The refusal stores a URL as scrubbed_remote gives it, so userinfo and a
query never reach the error's Display or Debug.

The option-like test moves above make_local_repo's doc comment, checks that
no bare directory is left and no clone or fetch ran, and a new test covers
the redaction.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

* fix(checkouts): a refused url or ref names its one failed condition; the git guards go on every call

An empty repository URL or ref is now `EmptyValue`, and one starting with `-` stays `OptionLike`.
Each message states its own condition in short sentences, names the value, and points at
minimal.toml or --upstream, since `mip run --upstream` sends the same values with no minimal.toml.

`GIT_SEC_ARGS` is prepended inside `run_git_bare` and `run_git_checkout`, and on the config read
in `Repo::new`, so every git command this crate runs carries it. The doc comment now says so.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 9396210)
@coderabbitai
coderabbitai Bot commented Nov 14, 2026 •
Copy link
Copy Markdown
Contributor

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9eb5a083-ede1-4ee9-8a7d-9015c7a31938

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@minimal-foundry
minimal-foundry Bot commented Nov 14, 2026 •
Copy link
Copy Markdown
Contributor

Approved: no findings at 3c03dbce96cc.

Nothing to do.

Clobber: none seen.

8000

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@minimal-foundry minimal-foundry Bot added the review:approved minimal-review approved the current head label Nov 14, 2026
The backported refusal of an option-like repository URL names the URL through
`scrubbed_remote`, so that a credential in a malformed URL reaches neither the
error's Display nor its Debug. On main that function came with the tracing
work, which this branch does not have, so the backport did not compile.

This adds the function as it is on main, with its test. Nothing else on this
branch calls it.

Co-Authored-By: Claude <noreply@anthropic.com>
@bryan-minimal
Copy link
Copy Markdown
Member

The backport did not compile on release/0.7.x: the new refusal names the URL through scrubbed_remote, which main got with the tracing work (#1995) and this branch does not have. 3c03dbc adds that one function with its test, as it is on main. Nothing else on this branch calls it.

Checked on Linux at 3c03dbc: fmt and clippy pass, the native daemon e2e passes, and the workspace tests pass but one. That one is package_version_is_the_declared_next_release, which fails on this branch whatever this PR does: package.version is still 0.7.3 beside the tag v0.7.3. #3369 is the bump that fixes it, so that one has to land first for this PR's tests to go green.

@minimal-foundry minimal-foundry Bot left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minimal-review — approved

Verdict APPROVE — No findings.

Panel: 3 of 3 personas ran (correctness, security, supply-chain).

@norrietaylor
Copy link
Copy Markdown
Member

/revise

The backport did not compile on release/0.7.x: the new refusal names the URL through scrubbed_remote, which main got with the tracing work (#1995) and this branch does not have. 3c03dbc adds that one function with its test, as it is on main. Nothing else on this branch calls it.

Checked on Linux at 3c03dbc: fmt and clippy pass, the native daemon e2e passes, and the workspace tests pass but one. That one is package_version_is_the_declared_next_release, which fails on this branch whatever this PR does: package.version is still 0.7.3 beside the tag v0.7.3. #3369 is the bump that fixes it, so that one has to land first for this PR's tests to go green.

@minimal-foundry
minimal-foundry Bot commented Nov 16, 2026 •
Copy link
Copy Markdown
Contributor

Round 1 of 10 changed nothing: noop on purpose. The only failing test is package_version_is_the_declared_next_release in crates/common/tests/package_version.rs. It fails because Cargo.toml declares 0.7.3 beside the tag v0.7.3. That is not caused by this backport. The fix is the version bump in PR #3369, which must land on release/0.7.x first. A bump here duplicates #3369 and is outside this pull request, so I made no change. After #3369 merges, merge release/0.7.x into this branch and the tests check can go green. I did not run the checkouts doctests: rustdoc is not installed on this box (cargo test -p checkouts stopped at 'could not execute process rustdoc'). I did not run just ci or the workspace suite.. This pull request is still open.

branch backport/3378-to-release/0.7.x

round outcome job
1 changed nothing: noop on purpose. The only failing test is package_version_is_the_declared_next_release in crates/common/tests/package_version.rs. It fails because Cargo.toml declares 0.7.3 beside the tag v0.7.3. That eceffd45

Updated 2026-11-16T16:44:24.693Z.

@minimal-foundry
Copy link
Copy Markdown
Contributor

Round 1 of 10 on a /revise note: the coder changed nothing. noop on purpose. The only failing test is package_version_is_the_declared_next_release in crates/common/tests/package_version.rs. It fails because Cargo.toml declares 0.7.3 beside the tag v0.7.3. That is not caused by this backport. The fix is the version bump in PR #3369, which must land on release/0.7.x first. A bump here duplicates #3369 and is outside this pull request, so I made no change. After #3369 merges, merge release/0.7.x into this branch and the tests check can go green. I did not run the checkouts doctests: rustdoc is not installed on this box (cargo test -p checkouts stopped at 'could not execute process rustdoc'). I did not run just ci or the workspace suite.

This branch has not been deployed

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

Labels

review:approved minimal-review approved the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0