Go: Handle quoted dots in hostname regexps by theinfosecguy · Pull Request #22824 · github/codeql · GitHub
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.

@owen-mc

owen-mc commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

@theinfosecguy

Copy link
Copy Markdown
Contributor Author

I came across #15894 while looking for a way to contribute and reproduced it locally. Fair point about the added complexity. I'm happy to pick up something higher priority.

@owen-mc

owen-mc commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

What languages are you interested in working on? Since our support for Rust is much newer, there are some FPs to fix there which would be much more impactful. CodeQL for actions is also a newly-supported language, where there are lots of things that could be improved.

Another way to contribute is to add queries that we have for some languages to other languages where they are missing. For example, I used Copilot to make #22019 (C#) but I haven't had a chance to review it. I also wanted to adopt this request forgery query for C# written by Microsoft on their fork of CodeQL.

Complicated modelling is also very welcome, like your Spring MVC PR.

@theinfosecguy

Copy link
Copy Markdown
Contributor Author

Thanks, Owen! I'm open to working across languages, though I'd lean toward GitHub Actions over Rust. Is there a specific issue you'd like me to prioritize?

@owen-mc

owen-mc commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

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

2 participants