Skip to content

Go: Handle quoted dots in hostname regexps - #22824

Open
theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:go-hostname-regexp-quoting
Open

theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:go-hostname-regexp-quoting

Conversation

@theinfosecguy

Copy link
Copy Markdown
Contributor

go/incomplete-hostname-regexp reports literal hostname dots inside Go's \Q...\E quoting as wildcards. For example, ^\Qhttps://github.com/\E$ produces a false positive.

Recognize quoted dots when the complete pattern is statically known. Preserve existing alerts for wildcard dots outside quoting and unsafe concatenations with escaped quote openers, and retain existing behavior for unresolved patterns.

Add regressions for raw and interpreted strings, quoting boundaries, constant aliases, and regexp compilation and matching APIs, plus a change note.

Validation:

  • All four Go CWE-020 query-test suites pass with CodeQL 2.27.0.
  • The new quoting fixture covers 13 unsafe operations and 11 safe operations.
  • QL formatting and git diff --check pass.

Fixes #15894.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

False positive for go/incomplete-hostname-regexp and \Q

1 participant