fix: address security vulnerabilities across credential, path, and command handling#47
Merged
yiftach-armis merged 1 commit intomainfrom Jan 18, 2026
Merged
Conversation
…mmand handling This commit addresses multiple security vulnerabilities: - HTTPS Enforcement: NewClient() now enforces HTTPS for all non-localhost URLs, preventing credential transmission over unencrypted connections (CVE-class: credential exposure) - Enhanced Secret Masking: Extended credential masking patterns to detect SSH keys, OAuth secrets, database credentials, and service tokens across multiple formats - Path Traversal Prevention: SafeJoinPath() now requires base path to exist, preventing TOCTOU vulnerabilities - Command Injection Prevention: GitHub Action shell commands replaced with safe array-based execution and input validation (prevents eval-based injection) - Least Privilege: Added explicit permissions to workflows (contents: read) - Installation Script Hardening: Improved temp directory handling with cryptographically secure random names and better path traversal detection All changes include comprehensive test coverage.
Test Coverage Reporttotal: (statements) 77.7% Coverage by function |
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.
Description
This PR addresses multiple security vulnerabilities through comprehensive hardening across credential handling, path manipulation, command execution, and installation scripts.
Type of Change
Changes Made
1. HTTPS Enforcement (API Client Security)
NewClient()now enforces HTTPS for all non-localhost URLsinternal/api/client.go,internal/api/client_test.go2. Enhanced Secret Masking
:=,=>)internal/util/mask.go,internal/util/mask_test.go3. Path Traversal Prevention (TOCTOU Fix)
SafeJoinPath()now validates base path exists and is a directoryinternal/util/path.go,internal/util/path_test.go,internal/output/sarif.go4. Command Injection Prevention
eval $SCAN_CMDwith safe array-based executionaction.yml,.github/actions/armis-cli-action/action.yml5. Least Privilege Principle
permissions: contents: readto workflows.github/workflows/security-scan.yml,.github/workflows/armis-cli-marketplace-sample.yml6. Installation Script Hardening
scripts/install.sh,scripts/install.ps17. Defensive Coding
internal/httpclient/client.go,internal/scan/image/image.go,internal/scan/repo/repo.goTesting
Checklist
Related Issues
Addresses: Security audit findings
Notes
This PR includes a breaking change to
NewClient()signature - it now returns(*Client, error)instead of*Client. All callers have been updated to handle the error return value.