forked from NVIDIA-AI-Blueprints/vulnerability-analysis
-
Notifications
You must be signed in to change notification settings - Fork 15
Appeng 5540 Enhancement and bug fixes for adding manifest_path and ecosystem fields to agentic logic: #272
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
Open
gnetanel
wants to merge
5
commits into
RHEcosystemAppEng:main
Choose a base branch
from
gnetanel:APPENG-5540_mixed_repo_part_2_to_deliver
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
7862387
APPENG-5540: enhancments and bug fixes for adding manifest_path and e…
c501113
bug fix: when ecosystem is defined, validate file exist in path, if n…
556ffe6
only use ecosystem and manifest path as parameters instead as member …
9b40c5e
Fix failed unittests as a result of changes in this PR
4ef3712
Fixes for code review comments
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
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,48 @@ | ||
| import pytest | ||
| from pathlib import Path | ||
|
|
||
| from exploit_iq_commons.utils.git_utils import resolve_path_to_manifest | ||
| from exploit_iq_commons.utils.git_utils import validate_manifest_relative_path | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def repo_with_subdir(tmp_path: Path) -> Path: | ||
| repo_path = tmp_path / "repo" | ||
| subdir = repo_path / "module" / "sub" | ||
| subdir.mkdir(parents=True) | ||
| return repo_path | ||
|
|
||
|
|
||
| class TestValidateManifestRelativePath: | ||
| def test_accepts_valid_subdirectory(self, repo_with_subdir: Path): | ||
| validate_manifest_relative_path(repo_with_subdir, "module/sub") | ||
|
|
||
| def test_rejects_absolute_path(self, repo_with_subdir: Path): | ||
| with pytest.raises(ValueError, match="must be a relative path"): | ||
| validate_manifest_relative_path(repo_with_subdir, "/etc/passwd") | ||
|
|
||
| def test_rejects_parent_traversal(self, repo_with_subdir: Path): | ||
| with pytest.raises(ValueError, match="parent directory references"): | ||
| validate_manifest_relative_path(repo_with_subdir, "../outside") | ||
|
|
||
| def test_rejects_embedded_parent_traversal(self, repo_with_subdir: Path): | ||
| with pytest.raises(ValueError, match="parent directory references"): | ||
| validate_manifest_relative_path(repo_with_subdir, "module/../../outside") | ||
|
|
||
| def test_rejects_nonexistent_directory(self, repo_with_subdir: Path): | ||
| with pytest.raises(ValueError, match="does not exist"): | ||
| validate_manifest_relative_path(repo_with_subdir, "missing/path") | ||
|
|
||
| def test_rejects_file_path(self, repo_with_subdir: Path): | ||
| (repo_with_subdir / "file.txt").write_text("x") | ||
| with pytest.raises(ValueError, match="does not exist"): | ||
| validate_manifest_relative_path(repo_with_subdir, "file.txt") | ||
|
|
||
|
|
||
| class TestResolvePathToManifest: | ||
| def test_returns_repo_root_when_manifest_path_is_none(self, repo_with_subdir: Path): | ||
| assert resolve_path_to_manifest(repo_with_subdir, None) == repo_with_subdir | ||
|
|
||
| def test_resolves_valid_subdirectory(self, repo_with_subdir: Path): | ||
| assert resolve_path_to_manifest(repo_with_subdir, "module/sub") == repo_with_subdir / "module" / "sub" | ||
|
|
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
Oops, something went wrong.
Oops, something went wrong.
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.