Skip to content

test: expand coverage for raw argument collections#1545

Merged
fzipi merged 2 commits into
feat/args_rawfrom
copilot/sub-pr-1493
Mar 11, 2026
Merged

test: expand coverage for raw argument collections#1545
fzipi merged 2 commits into
feat/args_rawfrom
copilot/sub-pr-1493

Conversation

Copilot AI commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Test coverage for the new raw argument collections (ARGS_GET_RAW, ARGS_POST_RAW, ARGS_NAMES_RAW, ARGS_GET_NAMES_RAW, ARGS_POST_NAMES_RAW, ARGS_RAW) was thin. This adds comprehensive unit and integration tests across all layers.

internal/url

  • ParseQueryBoth: plus-sign handling, multi-value keys, empty input
  • ParseQueryRaw: multi-value keys, empty input
  • Benchmarks for both functions

internal/corazawaf (transaction)

  • ExtractGetArguments populates argsGetRaw with raw percent-encoding while argsGet holds decoded values
  • Plus-sign preserved in raw (hello+world) vs decoded in cooked (hello world)
  • Double-encoding preserved (%2500 raw vs %00 cooked)
  • argsGetNamesRaw retains raw key names (p%61ram not param)
  • Argument limit enforced on addGetRequestArgumentRaw

internal/bodyprocessors

  • urlencoded: table-driven test covering percent-encoded, double-encoded, plus-sign, and plain values — asserts both ArgsPost (decoded) and ArgsPostRaw (raw)
  • multipart: ArgsPostRaw populated identically to ArgsPost (multipart fields are not URL-encoded)

testing/engine (integration)

Three new test cases in args_raw.go:

  • ARGS_GET_NAMES_RAW preserves raw GET parameter names
  • ARGS_POST_NAMES_RAW preserves raw POST parameter names
  • ARGS_GET_RAW with multiple values for the same key (color=red&color=gr%65en&color=blue)

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: fzipi <3012076+fzipi@users.noreply.github.com>
Copilot AI changed the title [WIP] Add raw argument collections for non-URL-decoded values test: expand coverage for raw argument collections Mar 9, 2026
Copilot finished work on behalf of fzipi March 9, 2026 23:04
@fzipi fzipi marked this pull request as ready for review March 11, 2026 21:48
@fzipi fzipi requested a review from a team as a code owner March 11, 2026 21:48
@codecov

codecov Bot commented Mar 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.14%. Comparing base (bd40abb) to head (4848b9f).
⚠️ Report is 1 commits behind head on feat/args_raw.

Additional details and impacted files
@@                Coverage Diff                @@
##           feat/args_raw    #1545      +/-   ##
=================================================
+ Coverage          86.06%   86.14%   +0.08%     
=================================================
  Files                175      175              
  Lines               8692     8692              
=================================================
+ Hits                7481     7488       +7     
+ Misses               964      958       -6     
+ Partials             247      246       -1     
Flag Coverage Δ
coraza.rule.case_sensitive_args_keys 86.09% <ø> (+0.08%) ⬆️
coraza.rule.mandatory_rule_id_check 86.13% <ø> (+0.08%) ⬆️
coraza.rule.multiphase_evaluation 85.87% <ø> (+0.08%) ⬆️
coraza.rule.no_regex_multiline 86.13% <ø> (+0.08%) ⬆️
default 86.14% <ø> (+0.08%) ⬆️
examples+ 16.49% <ø> (ø)
examples+coraza.rule.case_sensitive_args_keys 84.16% <ø> (+0.10%) ⬆️
examples+coraza.rule.mandatory_rule_id_check 84.30% <ø> (+0.10%) ⬆️
examples+coraza.rule.multiphase_evaluation 85.87% <ø> (+0.08%) ⬆️
examples+coraza.rule.no_regex_multiline 84.12% <ø> (+0.10%) ⬆️
examples+memoize_builders 84.25% <ø> (+0.10%) ⬆️
examples+no_fs_access 83.80% <ø> (+0.10%) ⬆️
ftw 86.14% <ø> (+0.08%) ⬆️
memoize_builders 86.27% <ø> (+0.08%) ⬆️
no_fs_access 85.66% <ø> (+0.08%) ⬆️
tinygo 86.12% <ø> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fzipi fzipi merged commit e5fe536 into feat/args_raw Mar 11, 2026
20 checks passed
@fzipi fzipi deleted the copilot/sub-pr-1493 branch March 11, 2026 21:56
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.

2 participants