Skip to content

Resolve Semgrep findings on dev - #2537

Closed
dscpinheiro wants to merge 2 commits into
devfrom
fix-semgrep-findings
Closed

Resolve Semgrep findings on dev#2537
dscpinheiro wants to merge 2 commits into
devfrom
fix-semgrep-findings

Conversation

@dscpinheiro

Copy link
Copy Markdown
Contributor

Issue #, if available: N/A

Description of changes: Fixes / ignores the findings that are causing the semgrep-analysis.yml action to fail.

  • Sanitize saved-request file names with Path.GetFileName in both test tools so a crafted name cannot escape the request directory (unsafe-path-combine).
  • Add a cooldown to the github-actions dependabot config (dependabot-missing-cooldown).
  • Ignore the TestWebApp integration-test host (intentionally unauthenticated fixtures) and the v1 preview test tool's Blazor debug UI (developer exception page is intended) in .semgrepignore

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

The push-to-dev Semgrep job does a full-repo scan and blocks on all findings,
so a standing set of 18 kept it red. Addressing them:

- Sanitize saved-request file names with Path.GetFileName in both test tools so a
  crafted name cannot escape the request directory (unsafe-path-combine).
- Add a cooldown to the github-actions dependabot config (dependabot-missing-cooldown).
- Ignore the TestWebApp integration-test host (intentionally unauthenticated fixtures)
  and the v1 preview test tool's Blazor debug UI (developer exception page is intended)
  in .semgrepignore, since a code "fix" there would break the intended behavior.
@dscpinheiro
dscpinheiro requested review from a team as code owners August 17, 2026 21:24
@dscpinheiro
dscpinheiro requested review from normj and a lite review from Copilot August 17, 2026 21:24
@dscpinheiro dscpinheiro added the Release Not Needed Add this label if a PR does not need to be released. label Aug 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses Semgrep findings that were causing the semgrep-analysis.yml GitHub Actions workflow to fail on the dev branch, primarily by hardening file-path handling in the Lambda test tools and tuning security-scanner configuration.

Changes:

  • Prevent saved-request path traversal by constraining loaded request paths to the basename via Path.GetFileName(...) (v1 and v2 Lambda test tools).
  • Add a Dependabot “cooldown” window for GitHub Actions updates to reduce churn from freshly-published versions.
  • Extend .semgrepignore to exclude specific intentionally-unauthenticated/local-debug-only fixtures from scanning.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
Tools/LambdaTestTool/src/Amazon.Lambda.TestTool/SampleRequests/SampleRequestManager.cs Sanitizes saved-request filename before combining into a filesystem path.
Tools/LambdaTestTool-v2/src/Amazon.Lambda.TestTool/Services/LambdaRequestManager.cs Applies the same saved-request filename sanitization for the v2 tool.
.semgrepignore Ignores specific integration-test host and preview Blazor debug UI paths to avoid intentional findings.
.github/dependabot.yml Adds a cooldown delay for GitHub Actions dependency update PR creation.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Use ordinal StartsWith/IndexOf for the saved-request routing token in both test
tools (it is a fixed internal token on a file-path security boundary). Add a unit
test covering that a traversal-style saved-request name cannot read outside the
saved-request directory.
@dscpinheiro
dscpinheiro deleted the fix-semgrep-findings branch August 17, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Release Not Needed Add this label if a PR does not need to be released.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants