fix: scope install security scan to deployable content - #2598
Open
Aryan Singh K. (aryansk) wants to merge 1 commit into
Open
fix: scope install security scan to deployable content#2598Aryan Singh K. (aryansk) wants to merge 1 commit into
Aryan Singh K. (aryansk) wants to merge 1 commit into
Conversation
Aryan Singh K. (aryansk)
requested review from
Daniel Meppiel (danielmeppiel) and
Sergio Sisternes (sergio-sisternes-epam)
as code owners
August 16, 2026 12:48
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR narrows the pre-deploy security scan to “deployable” package content by introducing a path filter in the security gate and defining deployable-path heuristics, with accompanying unit tests.
Changes:
- Add an optional
path_filtercallback toSecurityGate.scan_filesto skip scanning non-matching files. - Define
_is_deployable_source_pathand deployable path patterns used by the install pre-deploy scan. - Add unit tests covering deployable vs source-only paths and Windows path normalization.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| tests/unit/install/test_security_scan_scope.py | Adds tests for deployable-path detection logic and path normalization. |
| src/apm_cli/security/gate.py | Adds path_filter to optionally exclude files from scanning. |
| src/apm_cli/install/helpers/security_scan.py | Implements deployable path heuristics and wires filtering into the pre-deploy scan. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+84
to
86
| path_filter=None, | ||
| ) -> ScanVerdict: | ||
| """Walk *root*, scan every regular file, return a verdict. |
| @@ -96,6 +97,8 @@ def scan_files( | |||
| if fpath.is_symlink(): | |||
| continue | |||
| rel = portable_relpath(fpath, root) | |||
| @@ -0,0 +1,29 @@ | |||
| from apm_cli.install.helpers.security_scan import _is_deployable_source_path | |||
Comment on lines
+70
to
+75
| verdict = SecurityGate.scan_files( | ||
| install_path, | ||
| policy=BLOCK_POLICY, | ||
| force=force, | ||
| path_filter=_is_deployable_source_path, | ||
| ) |
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.
Closes #2490
Summary
SecurityGate.scan_filescallers to restrict which paths are scannedValidation
main