Skip to content

fix: validate CrowdSec archive entry names with a standard local-path check - #1536

Merged
Wikid82 merged 2 commits into
developmentfrom
fix/crowdsec-zipslip-codeql
Oct 10, 2026
Merged

Wikid82 merged 2 commits into
developmentfrom
fix/crowdsec-zipslip-codeql

Conversation

@Wikid82

@Wikid82 Wikid82 commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Summary

A local CodeQL Go scan reported a new go/zipslip result in extractTarGz (backend/internal/crowdsec/hub_sync.go) after #1535. That PR replaced a HasPrefix(name, "..") guard with a custom helper (to accept names such as ..foo), and CodeQL cannot see through a custom helper.

Entry names are now checked with the standard filepath.IsLocal before they reach the path join. Behaviour is unchanged for real archives: ..foo, a/..b, ./a.txt are accepted; ../x, a/../../x and absolute paths are rejected. One edge case differs: an empty entry name is now rejected instead of cleaning to .. The containment check, symlink-safe file creation and engine-owned-path skip are unchanged.

Testing

  • go test ./internal/crowdsec/..., go vet, full golangci-lint config: clean.
  • New test covers ./ directory entries, ./a.txt and the empty-name case.
  • Local CodeQL: Go "4 suppressed, 0 blocking, 4 total" (the existing suppressions), JS 0 results; no new suppression entry was needed.

@github-advanced-security

Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

✅ Supply Chain Verification Results

✅ PASSED

📦 SBOM Summary

  • Components: 1870

🔍 Vulnerability Scan

Severity Count
🔴 Critical 0
🟠 High 0
🟡 Medium 0
🟢 Low 0
Total 0

📎 Artifacts

  • SBOM (CycloneDX JSON) and Grype results available in workflow artifacts

Generated by Supply Chain Verification workflow • View Details

@codecov

codecov Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Wikid82
Wikid82 merged commit 0aa34bd into development Oct 10, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants