Skip to content

Commit

Permalink
[KB] Does Semgrep scan compressed files? (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
armchairlinguist authored Jan 10, 2025
1 parent 1c15898 commit 0526490
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
24 changes: 24 additions & 0 deletions docs/kb/semgrep-ci/scan-compressed-files-artifacts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
description: Options to scan compressed files or other artifacts with Semgrep.
tags:
- Scans
- Semgrep in CI
---

# Does Semgrep scan compressed files or other non-code files?

Semgrep is a pre-build security tool optimized to search for code and text patterns. It does not scan the files within a compressed archive, nor does it scan binaries (built files).

## How can I scan the files inside a compressed archive file?

To scan code or text files that are stored in a compressed archive file with Semgrep, uncompress the files before performing the scan. When the scan is complete, delete the temporary files that were created.

For local scans, this can be done manually. For scans in CI, add appropriate actions to the CI config.

When implementing this method, it's optimal to place the compressed files in a consistent location, so that Semgrep can detect that any findings within the temporary files are the same across scans.

### What are the limitations of this approach?

When possible, Semgrep AppSec Platform generates [hyperlinks](/docs/semgrep-code/findings#code-page-structure) to a finding's location within a repository and file. If the file is not persistent in the repository, and is scanned at a temporary path, then the hyperlink will lead to that temporary path and will not work properly. This may make it more difficult for developers to identify where and how to fix issues identified in the temporary files.

Currently, it is not possible to uncompress files before running a scan in [Semgrep Managed Scans](/docs/deployment/managed-scanning/overview).
3 changes: 1 addition & 2 deletions docs/kb/semgrep-code/InvalidHeaderValue.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---
description: Troubleshoot "invalid header value" errors in GitHub and Gitlab
tags:
- Scanning
- Scans
- Semgrep Code
- Secrets
append_help_link: true
---

Expand Down

0 comments on commit 0526490

Please sign in to comment.