feat(security): SEC003 / SEC005 / SEC008 multi-language strengthen (PR #19)#19
Merged
Conversation
…#19) Continues PR #18's audit. SEC003/005/008 already had decent multi-language coverage, but each had specific gaps that surface in real-world auth / DB / serialization code. ## SEC003 — TLS verification disabled Added detection for: - **PHP curl**: \`CURLOPT_SSL_VERIFYPEER => false / 0\` and \`CURLOPT_SSL_VERIFYHOST => 0\`. Both positional (\`curl_setopt($ch, OPT, 0)\`) and inline-array (\`curl_setopt_array($ch, array(OPT => false))\`) forms. Deferred-via-variable form intentionally not caught (would need dataflow). - **Ruby OpenSSL**: \`VERIFY_NONE\` / \`OpenSSL::SSL::VERIFY_NONE\`. - **Java**: \`NoopHostnameVerifier\` / \`TrustAllHostnameVerifier\` class names. Doesn't catch arbitrary anonymous-inner-class trust managers — those need real flow analysis. ## SEC005 — SQL string concat Receiver-method matcher expanded: | Family | Methods added | |---|---| | Python | (existing: execute, executemany) | | JDBC | + executeLargeUpdate, executeBatch | | Node.js / Go | + Query, QueryRow, QueryContext, Exec, ExecContext | | PHP PDO | + exec, prepare | | Ruby | + find_by_sql | | PHP global | + mysqli_query, mysql_query, pg_query, sqlite_query | Plus: - \`leaf_method_name\` used (handles PHP \`::\` / \`->\`). - \`text_has_interp\` (introduced in PR #18) replaces SEC005's Python-shaped local check, picking up PHP \`.\` concat correctly. - \`contains_sql_in_string_literal\` extended to recognize PHP's \`encapsed_string\` / \`string_value\` and heredoc / template literal kinds, so the SQL-keyword gate sees the string content. ## SEC008 — insecure deserialization Dangerous-call list extended: | Language | Added | |---|---| | Python | + shelve.open, dill.loads, dill.load | | Java | + XMLDecoder.readObject | | **PHP** | + unserialize (textbook unsafe path) | | **Ruby** | + Marshal.load, YAML.load, Oj.load | | **C# / .NET** | + BinaryFormatter.Deserialize, SoapFormatter.Deserialize, NetDataContractSerializer.ReadObject | | Go | + gob.NewDecoder | ## Tests 7 new (SEC003 PHP curl ×3, SEC005 Go db.Query + PHP mysqli_query, SEC008 PHP unserialize + C# BinaryFormatter). 184 → 191 total tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
Continues PR #18's audit. The three rules I marked "decent
multi-language coverage" each had specific gaps that surface in
real-world auth / DB / serialization code.
SEC003 — TLS verification disabled
Deferred-via-variable PHP form intentionally not caught (needs
dataflow). Java arbitrary anonymous-inner-class trust managers
also out of scope.
SEC005 — SQL string concat
Receiver-method matcher expanded across families:
`Exec` / `ExecContext`
Plus three under-the-hood fixes:
local check, picking up PHP `.` concat
`encapsed_string` + `string_value` plus heredoc / template
literal kinds — so the SQL-keyword gate sees the string content
in PHP code
SEC008 — insecure deserialization
Dangerous-call list extended across 5 languages:
Tests
7 new (SEC003 PHP curl ×3, SEC005 Go db.Query + PHP mysqli_query,
SEC008 PHP unserialize + C# BinaryFormatter).
`cargo test --workspace`: 184 → 191 tests pass.
Test plan
walker
🤖 Generated with Claude Code