Skip to content

test-cases: add CWE-77 (JS), CWE-912 (Java), CWE-23 (Ruby) - #17

Closed
CSTRSK wants to merge 1 commit into
profullstack:masterfrom
CSTRSK:add-cwe77-cwe912-cwe23
Closed

test-cases: add CWE-77 (JS), CWE-912 (Java), CWE-23 (Ruby)#17
CSTRSK wants to merge 1 commit into
profullstack:masterfrom
CSTRSK:add-cwe77-cwe912-cwe23

Conversation

@CSTRSK

@CSTRSK CSTRSK commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Adds three scanner test cases in categories with zero coverage:

File CWE Pattern
vulns/javascript/command-injection-shelljs.js CWE-77 shelljs exec() string concat (vuln) vs execFile argv (safe)
vulns/java/hidden-backdoor-endpoint.java CWE-912 magic-token backdoor on a /healthz route (vuln) vs real auth check (safe)
vulns/ruby/relative-path-traversal.rb CWE-23 File.open with raw ../ input (vuln) vs expand_path containment (safe)

All follow the five safety rules: if (false)/NEVER_RUN dead-code guards, no network, no side effects, no live credentials. Catalog regenerated — 65 test cases, 49 CWEs, validate-test-case.sh passes all 6 check groups.

…(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']);
@ralyodio

ralyodio commented Aug 9, 2026

Copy link
Copy Markdown
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.

@ralyodio ralyodio closed this Aug 9, 2026
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.

3 participants