[PPSC-840] fix(scan): add inline suppression directives for remaining CI findings#198
Merged
yiftach-armis merged 2 commits intoMay 26, 2026
Merged
Conversation
Add and update armis:ignore comments to suppress false-positive findings from the inline matching engine. Adds cwe:22, cwe:78, cwe:94, cwe:522, and cwe:20 directives where inputs are already validated or bounded by design.
Test Coverage Reporttotal: (statements) 77.4% Coverage by function |
There was a problem hiding this comment.
Pull request overview
This PR reduces CI scan noise by adding armis:ignore inline suppression directives (with reasons) for known false-positive findings across the CLI codebase and installer scripts.
Changes:
- Added inline suppression directives for remaining reported CWEs (e.g., 22/78/94/522/770/918/73/20) in targeted hot spots.
- Updated a few existing suppressions to include additional CWEs where multiple CWEs were reported on the same line/pattern.
- Documented suppression rationale inline to preserve auditability of the exceptions.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/install.ps1 | Adds an inline suppression for executing the already-installed binary during upgrade detection. |
| internal/update/update.go | Adds an additional inline suppression near cache path sanitization. |
| internal/scan/repo/matcher.go | Adds an inline suppression around matching logic over parsed CWE directives. |
| internal/scan/mask.go | Adds an inline suppression related to intentionally not masking prose text fields. |
| internal/scan/image/image.go | Adds/updates inline suppressions around docker/podman command execution paths. |
| internal/install/claude.go | Adds an inline suppression for writing credentials to an env file with restricted permissions. |
| internal/httpclient/client.go | Adds an additional inline suppression around the HTTP request execution line. |
| internal/cmd/scan_repo.go | Adds an inline suppression where a validated CLI repo path is passed into scanning. |
| internal/cmd/scan_image.go | Adds an inline suppression around tarball path sanitization before use. |
| internal/agentdetect/userprofile.go | Adds/updates suppressions around enumerating user home directories and path joins. |
| internal/agentdetect/mcpconfig.go | Adds cwe:22 to existing bounded-config-file read suppressions. |
| internal/agentdetect/agentdetect.go | Adds an inline suppression around flattening results (bounded in-memory iteration). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| // armis:ignore cwe:918 reason:URL validated by api.Client caller (HTTPS enforced, no redirects) | ||
| resp, err = c.httpClient.Do(req) //nolint:gosec // G704: URL is from API client, validated before use | ||
| // armis:ignore cwe:918 reason:URL validated by api.Client caller (HTTPS enforced, no redirects) |
| // armis:ignore cwe:94 reason:dockerCmd from getDockerCommand (hardcoded docker/podman); imageName validated by validateImageName() | ||
| // armis:ignore cwe:78 reason:dockerCmd validated by validateDockerCommand allowlist; imageName validated by validateImageName | ||
| pullCmd := exec.CommandContext(ctx, dockerCmd, "pull", imageName) //nolint:gosec // G204: dockerCmd is validated, imageName is validated by validateImageName() | ||
| // armis:ignore cwe:78 cwe:94 reason:dockerCmd validated by validateDockerCommand allowlist; imageName validated by validateImageName |
Comment on lines
192
to
197
| // getCacheFilePath returns the path to the cache file. | ||
| // armis:ignore cwe:73 reason:cacheDir set from XDG/home path; SanitizePath validates before use | ||
| func (c *Checker) getCacheFilePath() string { | ||
| if c.cacheDir != "" { | ||
| // armis:ignore cwe:73 reason:cacheDir set from XDG/home path; SanitizePath validates before use | ||
| sanitized, err := util.SanitizePath(c.cacheDir) |
Inline suppression only scans upward from the finding line. Remove directives placed after the flagged lines in httpclient/client.go and scan/image/image.go as they have no effect — the above-line directives already provide coverage.
7 tasks
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.
Related Issue
Type of Change
Problem
The inline matching engine flags certain code patterns as potential vulnerabilities (CWE-22, CWE-78, CWE-94, CWE-522, CWE-20, CWE-770) even though the inputs are already validated or bounded by design. This causes CI scan noise on every run.
Solution
Add and update
armis:ignoreinline suppression comments across 12 files to suppress false-positive findings. Each directive includes areason:explaining why the flagged code is safe (e.g., path validated byisUnderDir, command args validated by allowlist, credentials written with 0600 permissions). Also adds missingcwe:22to existingcwe:770directives where both CWEs are reported on the same line.Testing
Automated Tests
Manual Testing
Verified that
make lintandmake testpass with no regressions from these changes.Checklist