Repository navigation
Fix Apache RewriteCond negation for string and integer comparisons - #70556
joshbarros wants to merge 1 commit into
Conversation
RuleBuilder passed the parsed Invert flag as StringMatch's ignoreCase argument and omitted it from IntegerMatch, so a leading '!' in a RewriteCond comparison was treated as case-insensitivity (strings) or ignored (integers) instead of negating the result. Add a negate parameter to StringMatch and IntegerMatch and invert the comparison result, following the existing RegexMatch/IsFileMatch convention. StringMatch now also honors the [NC] flag for case-insensitivity. Fix dotnet#70505
|
Thanks for your PR, @joshbarros. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
|
/review |
There was a problem hiding this comment.
Source-only review of frozen head f01b1e2b9f04942a5f12c901a4b78ce71d4ec0df.
The cross-cutting guide completed its in-scope review. The only proposed candidate—nonnumeric input under a negated integer comparison—was independently verified and discarded because the exact input follows the same early-failure path at merge base 59835e6087e90b972a905dc303523cfbb5d828ef and at the frozen head. It is surfaced inline with its discarded disposition as required by the review protocol.
Existing feedback contained no source-supported duplicate finding. No unresolved candidates remain. Changed tests were assessed from source: the new middleware cases exercise the parser and middleware path and would fail with the fix reverted; unit coverage does not include nonnumeric integer inputs, but that omission does not establish a regression.
Guide completion: docs/CrossCuttingGuidance.md complete for applicable source checks. Security assessment and execution of code, tests, CI, browser workflows, and samples were excluded by the frozen bundle policy. No materially changed area lacked a routed specialist guide.
Provenance: complete version-2 trusted bundle; guidance from immutable commit 59835e6087e90b972a905dc303523cfbb5d828ef; per-guide worker and candidate verifier both ran with gpt-5.6-sol and runtime-default reasoning effort. Proof is source-only. Tracked Git bytes only; symlink, submodule, and LFS targets cannot establish behavior, and no runtime validation was performed.
Generated by ASP.NET Core Pull Request Review for #70556 · copilot · gpt56 · 98.4 AIC · ⌖ 12.5 AIC · ⊞ 18.8K
Comment /review to run again
|
@dotnet-policy-service agree |
|
Looks like this PR hasn't been active for some time and the codebase could have been changed in the meantime. |
Description
A leading
!in an ApacheRewriteCondcomparison was not negating the result:!=https),RuleBuilder.AddConditionFromPartspassed the parsedInvertflag asStringMatch'signoreCaseargument, so the pattern matched case-insensitively instead of negating.!-eq1), theInvertflag was dropped entirely.This adds a
negateparameter toStringMatchandIntegerMatchand inverts the comparison result, following the existingRegexMatch/IsFileMatchconvention.StringMatchnow also honors the[NC]flag for case-insensitivity, which was previously ignored for string comparisons.Validation
Invoke_RewriteCondNegationIsAppliedcovers!=https,=httpsand!-eq1(both matching and non-matching query values).StringMatchTestsandIntegerMatchTests.dotnet test src/Middleware/Rewrite/test/Microsoft.AspNetCore.Rewrite.Tests.csproj: 488 passed, 0 failed.Fixes #70505