Repository navigation
Conversation
crowdsecurity/traefik-logs reads the Referer and User-Agent with NOTDQUOTE. Traefik escapes a quote in those fields as \", so the hub parser drops the whole line and the client skips every HTTP scenario. Add a local parser that handles only those lines.
Collaborator
Author
|
the pr has been accepted crowdsecurity/hub#1978, lets close it here |
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.
NethServer/ns8-traefik#152 makes Traefik log the User-Agent so CrowdSec can use it (NethServer/dev#8233). I tested it on a node and found a side effect. Traefik writes a quote inside the User-Agent as
\", and the hub parsercrowdsecurity/traefik-logsreads that field with a pattern that refuses any quote. The whole line is dropped. A client that puts a"in its User-Agent then skips every HTTP scenario, path based ones included.Nothing changes for lines the hub parser already reads. I added a local parser
nethserver/traefik-escaped-logs, a copy of the hub CLF pattern that accepts escaped quotes. Its filter only takes lines that contain\", so it runs only where the hub parser fails. The hub parser stays untouched and keeps its updates.Today the bug can't be triggered: the User-Agent is always
"-"and the Referer is dropped. A quote in the path is encoded as%22, and a raw quote in the query string still parses. So this PR should be released before or with the Traefik one.How to test
cscli explain -v --type syslog --log '<line>'with a traefik line whose User-Agent contains\", like the one intests/20__parsers.robotnethserver/traefik-escaped-logsis green,traefik_router_nameis the real route, andhttp-sensitive-filesmatches on/.envcrowdsecurity/traefik-logsSee also