fix: relativise absolute --file path against root for uv monitor#6891
Open
snyk-will wants to merge 1 commit into
Open
fix: relativise absolute --file path against root for uv monitor#6891snyk-will wants to merge 1 commit into
snyk-will wants to merge 1 commit into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Contributor
PR Reviewer Guide 🔍
|
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.
Pull Request Submission Checklist
are release-note ready, emphasizing
what was changed, not how.
What does this PR do?
Fixes UNIFY-1419: UI-applied ignores were silently no-op'd for UV projects in CI when --file was an absolute path (the GitLab CI default). snyk monitor was registering the project under one name (:/builds/.../pyproject.toml) and snyk test was looking it up under another (:pyproject.toml), so the test-time project lookup missed and the policy never loaded.
The fix changes getResolvedTargetFile in the TS UV plugin to relativise the lockfile path against the project root before swapping the basename to pyproject.toml, matching the npm/yarn workspaces convention. Monitor and test now send byte-identical project identities for the same uv.lock, regardless of whether --file was absolute or relative.
Where should the reviewer start?
src/lib/plugins/uv/index.ts — the new getResolvedTargetFile(root, targetFile) function is the whole fix.
How should this be manually tested?
In an org with enableUvCLI enabled, against any UV project:
PROJ=$(pwd)
snyk monitor --org= --file=$PROJ/uv.lock
Apply an ignore on one vulnerability in the UI
snyk test --org= --file=$PROJ/uv.lock
Expected: the test summary shows the ignored vuln as Ignored: 1, not Open. Before this fix it would show as Open because the test lookup couldn't find the project.
What's the product update that needs to be communicated to CLI users?
UV (early access): UI-applied ignore policies now apply correctly when snyk monitor and snyk test are invoked with an absolute --file path
Risk assessment (Low)
Gated behind uv feature flag
What are the relevant tickets?
https://snyksec.atlassian.net/browse/UNIFY-1419