Skip to content

fix: add path traversal protection in markdownlint-frontmatter#122

Open
scottschreckengaust wants to merge 1 commit intomainfrom
fix/code-scanning-136-path-traversal
Open

fix: add path traversal protection in markdownlint-frontmatter#122
scottschreckengaust wants to merge 1 commit intomainfrom
fix/code-scanning-136-path-traversal

Conversation

@scottschreckengaust
Copy link
Copy Markdown
Member

Summary

  • Fixes code scanning alert #136 — CWE-22 path traversal in tools/markdownlint-frontmatter.cjs
  • Adds path.normalize() + startsWith guard to validate the schema file path stays within the schemas/ directory before reading
  • Moves the nosemgrep suppression to the same line as fs.readFileSync so it is reliably honored in SARIF output (the previous-line comment was not being respected in CI)

Test plan

  • mise run build passes locally with no semgrep findings for this file
  • CI security scanners pass
  • Code scanning alert #136 closes after merge

Generated with Claude Code


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

Resolves code scanning alert #136 (CWE-22). The schema file path was
constructed dynamically without validation. Added path.normalize() and
a startsWith guard to ensure the resolved path stays within the schemas
directory. Moved the nosemgrep suppression to the same line as the
fs.readFileSync call so it is reliably honored in SARIF output.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@scottschreckengaust scottschreckengaust marked this pull request as ready for review April 8, 2026 02:53
@scottschreckengaust scottschreckengaust requested review from a team, krokoko and theagenticguy April 8, 2026 02:53
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