Repository navigation
fix(reporting): preserve SARIF findings on cyclic symbolic links #722
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rng1995
merged 11 commits into
NVIDIA:main
from
Afloat16:fix/sarif-symlink-loop-locations
Nov 19, 2026
Merged
Changes from 2 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4f7b33f
fix(reporting): preserve SARIF findings on cyclic symbolic links
Afloat16 d10f093
Merge branch 'main' into fix/sarif-symlink-loop-locations
chrisknvidia 6ef9bb6
fix(reporting): preserve artifact names for expanding symlink loops
Afloat16 0b5074e
Merge main to resolve release note conflict in PR #722
Afloat16 0df92f5
Merge latest main to resolve release note conflict in PR #722
Afloat16 5772092
fix(reporting): normalize cyclic-link parent paths before containment…
Afloat16 20ce633
Merge upstream main and preserve unreleased notes
Afloat16 6cdfe16
Merge main into fix/sarif-symlink-loop-locations
Afloat16 eea08ee
chore: integrate main and retain unreleased fixes
Afloat16 1790bf7
chore: integrate latest SkillSpector diagnostics from main
Afloat16 25e8144
Merge main into fix/sarif-symlink-loop-locations
rng1995 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """Findings about cyclic links must remain exportable to SARIF.""" | ||
|
|
||
| import json | ||
| from pathlib import Path | ||
|
|
||
| import pytest | ||
|
|
||
| from skillevaluator.models import Finding, Severity, ValidationResult | ||
| from skillevaluator.reporting import SARIFReporter | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("relative", [False, True]) | ||
| @pytest.mark.parametrize("two_links", [False, True]) | ||
| @pytest.mark.parametrize("with_workspace", [False, True]) | ||
| def test_sarif_preserves_a_finding_on_a_symlink_loop( | ||
| tmp_path: Path, relative: bool, two_links: bool, with_workspace: bool | ||
| ) -> None: | ||
| skill = tmp_path / "skills" / "demo" | ||
| skill.mkdir(parents=True) | ||
| link = skill / "loop.md" | ||
| try: | ||
| link.symlink_to("other.md" if two_links else "loop.md") | ||
| if two_links: | ||
| (skill / "other.md").symlink_to("loop.md") | ||
| except OSError: | ||
| pytest.skip("symlinks are not available") | ||
| result = ValidationResult(validator_name="security") | ||
| result.add_finding( | ||
| Finding( | ||
| category="SECURITY", | ||
| severity=Severity.HIGH, | ||
| check_name="unsafe-link", | ||
| message="The resource is a cyclic symbolic link", | ||
| file_path="loop.md" if relative else str(link), | ||
| ) | ||
| ) | ||
|
|
||
| output = SARIFReporter(workspace_root=tmp_path if with_workspace else None, scan_root=skill).render_all([result]) | ||
|
|
||
| findings = json.loads(output)["runs"][0]["results"] | ||
| assert len(findings) == 1 | ||
| expected = "skills/demo/loop.md" if with_workspace else link.as_uri() | ||
| assert findings[0]["locations"][0]["physicalLocation"]["artifactLocation"]["uri"] == expected | ||
| assert findings[0]["message"]["text"] == "The resource is a cyclic symbolic link" |
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.
Uh oh!
There was an error while loading. Please reload this page.