Repository navigation
Add wildcard patterns to the ignored suggestions - #214
Merged
Merged
Conversation
An ignored url only stopped that exact url being logged, so a section of a site had to be ignored one url at a time, or with a regex in the code. A row with a * in it is now a pattern, which can be added on the Ignored tab. It's checked after everything else, so it only stops suggestions and never a redirect that applies to the url. /* isn't a pattern, as bots request it literally, so a row like that can be saved already and would stop all suggestions. Adding a pattern also removes the suggestions already logged for it. Closes #197 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ
The guard against patterns matching everything only looked at the whole string, so https://example.com/* got past it, which with LogWithHostname on is how a request for /* gets logged. A ? acted as a wildcard, so /?* matched nearly everything while deleting suggestions took it literally. And a pattern starting with * could match on the scheme or host. A pattern starting with http now compares to the whole url and any other to the path and query, * is the only wildcard, and a row with an encoded %2A is a literal url. The form also refuses a pattern saved as a redirect, which saving would have replaced, and one longer than the column. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #197.
What it does
The Ignored tab gets a field for adding a pattern with
*as the wildcard, such as/api/*,*.php,/*/adminorhttps://example.com/api/*. A url matching one isn't logged as a suggestion, and adding one removes the suggestions already logged for those urls.Decisions worth checking
CustomRedirectCollection.Find, so a redirect or regex redirect that applies to a url keeps working, and a broad filter can't break anything that redirects today. This differs slightly from an ignored url without a wildcard, which also stops a shorter redirect from applying to it. That behavior is unchanged.*in it. That avoids a database change, but an ignored row with a literal*that's saved already becomes a pattern. The worst that can do is stop some suggestions, never a redirect./*,https://example.com/*and anything else with only wildcards and slashes in the path. Bots request/*literally, and withLogWithHostnameon it's logged with the host, so such a row can be saved already, and it would silently stop all suggestions after an upgrade. A row with an encoded%2Ais a literal url too.httpcompares to the whole url, including the scheme, and any other to the path and query, so*.com*can't match every request through the host.http*://example.com/api/*covers both schemes.*is the only wildcard.FileSystemName.MatchesSimpleExpressiondoes the matching, as it's built in and doesn't backtrack, which matters as it runs on unmatched requests. It treats?as a wildcard and\as an escape, and?can't be escaped, so both are swapped for private use characters on either side before matching.ISuggestionRepository.DeleteMatchingis a default interface method, so a class implementing the interface keeps compiling.IgnoredModeltakes anISuggestionService.Testing
IgnorePatternTests.LogWithHostnameoff and on. They cover:_,%,[and?in a pattern, upper case, hosts, and words that are only in the host/*and%2Arows not acting as patternsIgnored.cshtmlhasn't changed since, and the sandbox checks cover the new refusals.Limits
*.phpdoesn't match/login.php?a=b, as a*only matches where it's written.*.php*does. I left this, as a plain rule is easier to explain than a special case for the query string.*, such as/wp-*.php, creates a pattern and removes the other suggestions matching it. The confirmation doesn't mention this./a%20bisn't removed by/a b*. This is in the README./api) still logs its children (/api/x). I left that alone, as changing it would stop suggestions on existing sites without anyone asking for it.*://example.com/*, as it doesn't start withhttp./a/*) can't use a shorter redirect, as the row is also an ordinary ignored row. That needs a request containing a literal*.SqlDataExecutorlogs that and the page still reports success, so the old suggestions stay. New ones are still stopped.🤖 Generated with Claude Code
https://claude.ai/code/session_01GUDE6qHSSrhDDLNMCQ5suJ