-
Notifications
You must be signed in to change notification settings - Fork 1.8k
C++: Rewrite cpp/path-injection
to not use DefaultTaintTracking
#11435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6333476
C++: Rewrite `cpp/path-injection` to not use `DefaultTaintTracking`
jketema 7186634
C++: Stop flow from going through another source
jketema 378206a
C++: Stop taint from flowing to arithmetic types
jketema d3cccca
C++: Filter duplicate (source, sink)-pairs
jketema 3dfe18b
C++: Introduce the coarse upper bound check from default taint tracking
jketema 6dbc59d
C++: Simplify `isSink` based on reviewer comments
jketema 5637d57
C++: Add test case that is no longer detected after latest changes
jketema 995efef
C++: Add explanatory comment to `hasFilteredFlowPath`
jketema File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
15 changes: 2 additions & 13 deletions
15
cpp/ql/test/query-tests/Security/CWE/CWE-022/SAMATE/TaintedPath/TaintedPath.expected
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
edges | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | (const char *)... | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data indirection | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | (const char *)... | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data indirection | | ||
subpaths | ||
nodes | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | semmle.label | ... + ... | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | semmle.label | fgets output argument | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | (const char *)... | semmle.label | (const char *)... | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | semmle.label | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | semmle.label | data | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data indirection | semmle.label | data indirection | | ||
subpaths | ||
#select | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | This argument to a file access function is derived from $@ and then passed to fopen(filename). | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | user input (fgets) | | ||
| CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | fgets output argument | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:77:23:77:26 | data indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | CWE23_Relative_Path_Traversal__char_console_fopen_11.cpp:55:27:55:38 | ... + ... | user input (fgets) | |
31 changes: 18 additions & 13 deletions
31
cpp/ql/test/query-tests/Security/CWE/CWE-022/semmle/tests/TaintedPath.expected
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
edges | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | (const char *)... | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | (const char *)... | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName indirection | | ||
| test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName indirection | | ||
subpaths | ||
| test.c:31:22:31:25 | argv | test.c:32:11:32:18 | fileName indirection | | ||
| test.c:37:17:37:24 | fileName | test.c:38:11:38:18 | fileName indirection | | ||
| test.c:37:17:37:24 | scanf output argument | test.c:38:11:38:18 | fileName indirection | | ||
| test.c:43:17:43:24 | fileName | test.c:44:11:44:18 | fileName indirection | | ||
| test.c:43:17:43:24 | scanf output argument | test.c:44:11:44:18 | fileName indirection | | ||
nodes | ||
| test.c:9:23:9:26 | argv | semmle.label | argv | | ||
| test.c:9:23:9:26 | argv | semmle.label | argv | | ||
| test.c:17:11:17:18 | (const char *)... | semmle.label | (const char *)... | | ||
| test.c:17:11:17:18 | fileName | semmle.label | fileName | | ||
| test.c:17:11:17:18 | fileName | semmle.label | fileName | | ||
| test.c:17:11:17:18 | fileName indirection | semmle.label | fileName indirection | | ||
| test.c:31:22:31:25 | argv | semmle.label | argv | | ||
| test.c:32:11:32:18 | fileName indirection | semmle.label | fileName indirection | | ||
| test.c:37:17:37:24 | fileName | semmle.label | fileName | | ||
| test.c:37:17:37:24 | scanf output argument | semmle.label | scanf output argument | | ||
| test.c:38:11:38:18 | fileName indirection | semmle.label | fileName indirection | | ||
| test.c:43:17:43:24 | fileName | semmle.label | fileName | | ||
| test.c:43:17:43:24 | scanf output argument | semmle.label | scanf output argument | | ||
| test.c:44:11:44:18 | fileName indirection | semmle.label | fileName indirection | | ||
subpaths | ||
#select | ||
| test.c:17:11:17:18 | fileName | test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:9:23:9:26 | argv | user input (argv) | | ||
| test.c:17:11:17:18 | fileName | test.c:9:23:9:26 | argv | test.c:17:11:17:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:9:23:9:26 | argv | user input (argv) | | ||
| test.c:32:11:32:18 | fileName | test.c:31:22:31:25 | argv | test.c:32:11:32:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:31:22:31:25 | argv | user input (argv) | | ||
| test.c:38:11:38:18 | fileName | test.c:37:17:37:24 | fileName | test.c:38:11:38:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:37:17:37:24 | fileName | user input (scanf) | | ||
| test.c:44:11:44:18 | fileName | test.c:43:17:43:24 | fileName | test.c:44:11:44:18 | fileName indirection | This argument to a file access function is derived from $@ and then passed to fopen(filename). | test.c:43:17:43:24 | fileName | user input (scanf) | |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.