Repository navigation
Validate Cargo.lock input to the MxcDependencies feed seed pipeline - #1924
Open
Elliot (theelliotm) wants to merge 3 commits into
Open
Elliot (theelliotm) wants to merge 3 commits into
Elliot (theelliotm) wants to merge 3 commits into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83e19dbb-1bf5-41ad-80f0-47fe416d8093
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
PR-controlled names or versions can still inject active Azure Pipelines logging commands through validation diagnostics, allowing pipeline variables to be set before validation fails.
2 open issues
What changed in this PR
Hardens MXC’s MxcDependencies feed-seeding pipeline against untrusted pull request input.
Changes:
- Validates crates.io package names and versions before requests and encodes URL segments.
- Secures PR-number handling, removes persisted checkout credentials, and improves request failures.
- Adds offline tests to
dependency-feed-checkand updates contributor guidance.
| File | Description |
|---|---|
| docs/development/build-and-test/pull-requests.md | Documents seed validation behavior. |
| docs/development/build-and-test/ci-validation-infrastructure.md | Records the new offline test step. |
| .github/workflows/Dependency.Feed.Check.Job.yml | Runs seed-script tests. |
| .azure-pipelines/Update.Feed.Dependencies.yml | Validates PR numbers and removes persisted credentials. |
| .azure-pipelines/scripts/test_seed_feed.py | Adds validation, URL, and failure tests. |
| .azure-pipelines/scripts/seed_feed.py | Validates lockfile input and hardens feed requests. |
Review effort: Max
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 83e19dbb-1bf5-41ad-80f0-47fe416d8093
| try: | ||
| crates = _read_locked_crates() | ||
| except ValueError as error: | ||
| print(error) |
This branch has not been deployed
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.


📖 Description
The seed pipeline turns each crates.io entry in a PR's
Cargo.lockinto feed request URLs. It now checks those entries first, and also checks the PR number it is given.The script only seeds packages from crates.io. Each name must follow crates.io naming rules and each version must be valid semver. If any entry fails, the script lists all of them and stops before sending a request. In that list,
##is printed as#\x23so Azure Pipelines doesn't treat a value as a logging command. Names and versions are percent-encoded in URLs; for valid crates the URLs are unchanged. Fetching the feed'sconfig.jsonnow has a timeout and a clear error, and one crate failing no longer crashes the whole run.In the pipeline,
prNumbermust be a number and is passed through an environment variable instead of being pasted into the script. The checkout no longer keeps git credentials, since the only later git command fetches from the public GitHub repo.New offline tests in
test_seed_feed.pyrun in thedependency-feed-checkjob.Limitation: packages from git or other registries are skipped, not reported as errors.
🔗 References
docs/development/build-and-test/pull-requests.md,docs/development/build-and-test/ci-validation-infrastructure.md.🔍 Validation
python -m unittest test_seed_feed(from.azure-pipelines/scripts, Windows and Ubuntu): passed, 6 tests. The##vso[test fails without the fix.src/Cargo.lockpasses validation, and the script produces the same 690 index and download URLs as before.✅ Checklist
feature-acceptedCargo.lock, thedependency-feed-checkcheck passes (see pull request builds)📋 Issue Type