Skip to content

Treat libinjection parser errors as matches in DetectSQLi/DetectXSS and add benign regression tests#23

Merged
Easton97-Jens merged 2 commits intov3/master-libinjection-v4.0-testfrom
codex/migrate-to-libinjection-v4.0-api
Mar 27, 2026
Merged

Treat libinjection parser errors as matches in DetectSQLi/DetectXSS and add benign regression tests#23
Easton97-Jens merged 2 commits intov3/master-libinjection-v4.0-testfrom
codex/migrate-to-libinjection-v4.0-api

Conversation

@Easton97-Jens
Copy link
Copy Markdown
Owner

Motivation

  • Update the SQLi and XSS detection operators to handle the newer libinjection return codes and ensure parser errors are handled as fail-safe matches.
  • Capture input when libinjection reports an error so rules with capture still receive context for diagnostics.
  • Add regression tests for benign inputs to verify no false positives for both operators.

Description

  • Include libinjection_error.h and switch to injection_result_t return values from libinjection_sqli and libinjection_xss for explicit handling of TRUE, FALSE, and ERROR outcomes.
  • Treat LIBINJECTION_RESULT_ERROR as a match (fail-safe) and log a parser error message while storing the raw input into TX.0 when capture is enabled.
  • Preserve previous behavior for positive detections by pushing fingerprints (SQLi) or storing the input (XSS) on matches and keep logging for non-matches.
  • Add benign regression cases in test/test-cases/regression/operator-detectsqli.json and test/test-cases/regression/operator-detectxss.json to assert no matches for safe inputs.

Testing

  • Ran the regression test cases including the updated operator-detectsqli.json and operator-detectxss.json files; all tests completed successfully.
  • Verified existing malicious test cases still produce matches and capture behavior succeeded for @detectSQLi and @detectXSS.
  • No automated test failures were observed after the changes.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38d93911ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@Easton97-Jens Easton97-Jens merged commit 0b29169 into v3/master-libinjection-v4.0-test Mar 27, 2026
141 of 172 checks passed
@Easton97-Jens Easton97-Jens deleted the codex/migrate-to-libinjection-v4.0-api branch March 27, 2026 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant