Repository navigation
fix: match group prefix and suffix literally - #135
Conversation
Tests that configured group names are matched literally; they fail until the fix for #134 lands. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quote the configured group prefix, admin subgroup and suffix in the team and team admin group patterns, so that characters such as . are matched as text and only the exact group names count. Closes #134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Refs #134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Reviewer's GuideImplementationQuote configured group-name components in the team and admin patterns so they match literally, while retaining pattern matching for the team name.
DocumentationExplain that configured group-name components are compared literally and describe the compatibility change in the upgrade guide.
TestsVerify exact matching of default and regex-metacharacter-containing group names, and rejection of near-matching prefixes and suffixes.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #135 +/- ##
==========================================
+ Coverage 65.93% 65.95% +0.01%
==========================================
Files 67 67
Lines 2698 2699 +1
Branches 288 288
==========================================
+ Hits 1779 1780 +1
Misses 772 772
Partials 147 147 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Refs #134 Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Linked issues
#134 fix: match group prefix and suffix literally · 4 of 4 met
| # | Requirement | Status | Notes |
|---|---|---|---|
| 1 | Match the configured group prefix, base group, admin subgroup and suffix literally; leave only the team name variable text without :. |
✅ Met | Both group patterns quote the configured base-group prefix and suffix; the managed-group pattern also quotes the admin subgroup, while the team name remains ([^:]+). |
| 2 | Quote the configured parts with Pattern.quote. |
✅ Met | The literal helper uses Pattern.quote(String.valueOf(part)) for each configured part. |
| 3 | Add unit tests for exact names, near-identical names, and other regex characters matched as text. | ✅ Met | The tests cover exact defaults, prefix and suffix variants differing at ., and configured characters including +, *, (, $ and \E. |
| 4 | Document that configured group names are matched literally. | ✅ Met | The access-control configuration docs describe literal comparison and that patterns no longer work; the upgrading guide also explains the behavior change. |
Sourcery assessment
Needs a human reviewer. The configured group parts now match literally, so groups that previously matched only because a regex character acted as a wildcard may stop granting membership or admin access; a mistake in the new matching could also grant access to the wrong groups. Reverting restores the old matching, but any access or data exposure during the time the change was live cannot be undone.
Summary
ElixirPrincipalExtractorrecognises team and team admin groups with regular expressions built from the configured base group prefix, admin subgroup and group suffix. These parts went into the expressions as they were, so characters such as the.in the default prefix and suffix matched any character. They are now quoted (Pattern.quote), so only the exact configured text counts; the team name in between stays a pattern (any text without:).ElixirPrincipalExtractor: quote the configured parts (unset parts keep their previous textnull).ElixirPrincipalExtractorTest: exact names with the default prefix and suffix still match; names that differ from the configured prefix or suffix only at a.give no team or team admin group; other regex characters (+ * ( $ \E) are matched as text.access-control.md(configuration) says that the names are compared as plain text;upgrading.md(To 1.2.0) has a new item.No other place builds regular expressions from configuration (checked
Pattern.compile,matches(,replaceAll(,split(andString.formatundersrc/main/java).Closes #134
Verification
PatternSyntaxException) and pass after it../mvnw -B spotless:check checkstyle:check: BUILD SUCCESS, 0 Checkstyle violations../mvnw -B clean verify(Temurin 8): BUILD SUCCESS, all unit and integration tests pass, coverage checks met.mkdocs build --strict: built without warnings.Lane
Full review (authorisation code). Adversarial review: no findings. Quality review: docs now name the affected settings and say that patterns no longer work (fixed in c83c83e).
Declined review findings
nulltext for unset parts with a test, or fail instead: it keeps the previous behaviour (an unset part matches no real group); changing it is out of scope.Open questions
None.
🤖 Generated with Claude Code
Summary by Sourcery
Ensure configured team group-name components are matched literally while preserving pattern matching only for the team name.
Bug Fixes:
Documentation:
Tests: