JS: Modeling of fs-extra functions#19143
Merged
Napalys merged 11 commits intogithub:mainfrom Mar 31, 2025
Merged
Conversation
5c13997 to
e45edc5
Compare
e45edc5 to
769fe75
Compare
Contributor
There was a problem hiding this comment.
Pull Request Overview
This pull request introduces modeling for previously missing fs-extra functions in our security queries.
- Adds additional fs-extra functions as sinks in HTTP-to-file and file-to-HTTP security tests.
- Expands test coverage for CWE-912, CWE-200, and CWE-022 cases using various fs and fs-extra methods.
- Updates change notes to document the new fs-extra method support.
Reviewed Changes
Copilot reviewed 4 out of 8 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| javascript/ql/test/query-tests/Security/CWE-912/HttpToFileAccess.js | Integrates new fs-extra functions (open, writev, writevSync) in HTTP-based file access tests. |
| javascript/ql/test/query-tests/Security/CWE-200/FileAccessToHttp.js | Adds file operations using readvSync and readv to simulate file access leading to HTTP alerts. |
| javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/more-fs-extra.js | Models a variety of fs-extra methods as potential sinks in tainted path scenarios. |
| javascript/ql/lib/change-notes/2025-03-28-fs-extra.md | Documents the introduction of additional fs-extra method support. |
Files not reviewed (4)
- javascript/ql/lib/semmle/javascript/frameworks/NodeJSLib.qll: Language not supported
- javascript/ql/test/query-tests/Security/CWE-022/TaintedPath/TaintedPath.expected: Language not supported
- javascript/ql/test/query-tests/Security/CWE-200/FileAccessToHttp.expected: Language not supported
- javascript/ql/test/query-tests/Security/CWE-912/HttpToFileAccess.expected: Language not supported
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
asgerf
approved these changes
Mar 31, 2025
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.
The following pull request introduces modeling for previously missing
fs-extrafunctions.