test-cases: add CWE-77 (JS), CWE-912 (Java), CWE-23 (Ruby) - #17
Closed
CSTRSK wants to merge 1 commit into
Closed
Conversation
…(Ruby path traversal) Three new scanner test cases in languages/categories with zero coverage: - javascript/command-injection-shelljs.js (CWE-77, cmd injection via string concat vs execFile argv) - java/hidden-backdoor-endpoint.java (CWE-912, magic-token backdoor on health route) - ruby/relative-path-traversal.rb (CWE-23, ../ escape vs expand_path containment) All follow the five safety rules (if (false)/NEVER_RUN guards, .invalid/.example hosts, no side effects). Catalog regenerated: 65 test cases, 49 CWEs.
| function archiveLogVulnerable(userFilename) { | ||
| if (false) { | ||
| // VULNERABLE: CWE-77 — user input interpolated into a shell string | ||
| return shell.exec('tar -czf /tmp/archive-' + userFilename + '.tar.gz /var/log/app'); |
| if (false) { | ||
| // SAFE: input passed as argv element — no shell metacharacters interpreted | ||
| const { execFile } = require('child_process'); | ||
| return execFile('tar', ['-czf', '/tmp/archive-' + userFilename + '.tar.gz', '/var/log/app']); |
Contributor
|
Closing: this PR has merge conflicts against master (conflicting on the shared VULNERABILITY_CATALOG files) and cannot be merged as-is. Reopen and rebase if you want to revive it. |
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.
Adds three scanner test cases in categories with zero coverage:
vulns/javascript/command-injection-shelljs.jsexec()string concat (vuln) vsexecFileargv (safe)vulns/java/hidden-backdoor-endpoint.java/healthzroute (vuln) vs real auth check (safe)vulns/ruby/relative-path-traversal.rbFile.openwith raw../input (vuln) vsexpand_pathcontainment (safe)All follow the five safety rules:
if (false)/NEVER_RUNdead-code guards, no network, no side effects, no live credentials. Catalog regenerated — 65 test cases, 49 CWEs,validate-test-case.shpasses all 6 check groups.