Html support - #9
Conversation
|
🐕 Corgea found the following new SCA issues in the codebase:
Showing 10 out of 122 findings. See full results |
There was a problem hiding this comment.
Pull request overview
This PR adds support for detecting vulnerabilities in HTML, SQL, configuration, and properties files by introducing new language parsers and security rules.
Changes:
- Added support for four new file types: HTML, SQL, properties, and config files
- Implemented pattern-based security scanning for these file types
- Updated taint analysis to gracefully handle languages without taint rules
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/scanner/utils.rs | Added file extension mappings for SQL, properties, and config file types |
| src/scanner/modes.rs | Modified taint analysis to return empty results instead of error when no taint rules exist |
| src/scanner/core.rs | Added HTML-specific security indicators for XSS detection |
| src/rules.rs | Added rule loading logic for HTML, SQL, properties, and config languages |
| src/language.rs | Implemented new language support structs for SQL, properties, config, and updated HTML parsing |
| rules/sql/sql_security.ron | Created SQL security rules for injection detection |
| rules/properties/properties_security.ron | Created properties file security rules for secret detection |
| rules/html/html_security.ron | Created HTML security rules for XSS and other vulnerabilities |
| rules/config/config_security.ron | Created config file security rules for secret and misconfiguration detection |
| Dockerfile | Removed cross-compilation tools and simplified build configuration |
| Cargo.toml | Bumped version to 0.1.2 and added new language features |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Overall, LGTM but I don't think sighthound should be detecting anything hardcoded credentials related. |
Resolves conflicts introduced when PR #22 (engine modernization + review fixes) merged into the shared base branch. Conflicts resolved (both sides were our own changes, combined rather than chosen): - utils.rs is_git_ignored: kept PR #22's build-once RepoGitignore matcher (#15) and applied PR #23's path normalization on top (normalize_for_ignore_check before lookup); dropped the now-unused old per-path walk + is_within_git_repo. - core.rs compute_variable_source: combined PR #23's strip_inline_comment with PR #22's split_once('=') RHS fix. - core.rs trace_local_assignment_taint: kept PR #23's method-name fallback resolution, retargeted onto PR #22's callee_name rename (#12) and resolved_function_name. - core.rs (semantic, not textual): PR #23 code referencing the pre-rename line_num / the pre-visited trace_local_assignment_taint signature updated to PR #22's file_line (#9/#14) and visited-set parameter (#11). Verified: cargo build + cargo test green (49 unit + 21 strictness + 7 integration + 5 e2e + 1 doc-test).
| patterns: Some([ | ||
| "<!DOCTYPE*<!ENTITY", | ||
| "<!DOCTYPE*SYSTEM", | ||
| "<!ENTITY*SYSTEM", | ||
| ]), |
There was a problem hiding this comment.
These patterns use * as an inline wildcard, but the matcher treats it as an anchored glob over the entire file text. <!DOCTYPE*SYSTEM therefore does not match normal XML files, and the same issue affects several new SQL and HTML rules. Use plain substrings or regex: patterns instead.
| unless: Some([ | ||
| "http://localhost", | ||
| "http://127.0.0.1", | ||
| "http://www.w3.org", | ||
| "http://schemas.", | ||
| "xmlns:*=\"http://", | ||
| ]), |
There was a problem hiding this comment.
UnifiedRule has no unless field, so serde drops these exclusions and nothing evaluates them. xml-insecure-001 will flag benign namespace URLs despite this block; the same applies to the new HTML and config exclusions. Add matcher support before relying on unless, or remove these clauses.
Co-authored-by: Cursor <cursoragent@cursor.com>
…usions, tuned rules, and production strictness tests.
| mod django_security; | ||
| mod false_positive_regressions; | ||
| mod language_coverage; | ||
| mod markup_config_languages; |
There was a problem hiding this comment.
strictness_tests cannot compile because markup_config_languages has no module. Could we add the intended test module or remove the declaration?
| "sql" | "ddl" | "dml" => Some("sql"), | ||
|
|
||
| "xml" | "xsd" | "xsl" | "xslt" | "wsdl" | "svg" | "pom" => Some("xml"), | ||
|
|
||
| "properties" | "props" => Some("properties"), | ||
|
|
||
| "conf" | "cfg" | "ini" | "env" | "config" | "json" | "yaml" | "yml" | "toml" => { | ||
| Some("config") |
There was a problem hiding this comment.
the routed extensions do not satisfy the loaded rules' file_types; could we align routing, rule packs, and file_types so they receive the advertised coverage?
| || !crate::rules::rule_matches_pattern_scoped( | ||
| rule, | ||
| &line.searchable, | ||
| &line.searchable, | ||
| ) |
There was a problem hiding this comment.
a matching unless value elsewhere on the line suppresses later positive matches; should we evaluate exclusions per match or local context?
| "href=\"javascript:", | ||
| "href='javascript:", | ||
| "href=javascript:", | ||
| ]), |
There was a problem hiding this comment.
these patterns miss case and whitespace variants and can match names like data-href; could we use boundary-aware, case-insensitive attribute matching?
| "\"debug\": true", | ||
| "'debug': true", | ||
| "debug: true", | ||
| "\"DEBUG\": true", | ||
| "DEBUG: true", | ||
| ]), |
There was a problem hiding this comment.
these patterns miss compact JSON and TOML = syntax; could we allow whitespace variation and both : and = separators?
| "config" => { | ||
| trimmed.starts_with('#') || trimmed.starts_with(';') || trimmed.starts_with("//") | ||
| } |
There was a problem hiding this comment.
inline YAML and TOML comments remain searchable and can produce findings; could we strip inline comments while preserving markers in quoted values?
Adding html, sql, config, properties support for detecting simple vulnerabilities.