Repository navigation
feat(scope): accept *.example.com in asset scope - #520
Merged
Merged
Conversation
Bug bounty programs write a domain and its subdomains as *.example.com.
ParseScopeLine rejected that line ("not recognizable as a valid
domain/IP/CIDR"), and the web scope editor rejected it before it reached
the server, so every wildcard line had to be rewritten by hand.
Drop a leading "*." label and store the line as the example.com domain
rule. Company and task scope match assets on their registrable domain, so
that rule already covers the subdomains. The wildcard is accepted only on
a registrable domain: *.api.example.com would store a rule that matches
nothing, so it is rejected along with *.co.uk and *.<IP>.
Step 1 of BaaRai#519.
Owner
|
Merged. Thanks @Phantom-IN for the wildcard scope: |
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.
Step 1 of #519.
Bug bounty scope pages list in-scope domains as
*.example.com. Pasting that into a company's or a task's asset scope fails twice. The web editor marks the line as invalid, andParseScopeLinerejects it withnot recognizable as a valid domain/IP/CIDR: *.example.com. So each wildcard line has to be rewritten by hand.Change
scopeHostnamedrops a leading*.label and reports that it did.ParseScopeLinestores the line as theexample.comdomain rule. Company scope and taskroot_domainscope match assets on their registrable domain, so that rule already covers the subdomains, and nothing changes in the matching.*.api.example.comwould become a rule that matches no asset, so it's rejected with an explicit message rather than stored as a dead rule.*.co.uk,*.comand*.1.2.3.4are rejected too. Whether a single subdomain likeapi.example.comshould get its own subdomain rule is the open question in [Feature request] Paste a bug bounty program's scope (in scope, out of scope, wildcards) when creating a task #519, and I left it alone here.web/src/lib/company-scope.ts:domainHostnamestrips the same leading label, so the editor accepts the line and the preview and deduplication seeexample.com. A deeper wildcard passes the client check and is refused by the server with the message above, since the client has no public-suffix list.Note that
*.example.comalso covers the apexexample.comhere, because that is what the domain rule covers today. That is the first question in #519. If you'd rather exclude the apex, I'll change it.Tests
TestParseScopeLine/TestParseAutoScopeLine: wildcard domain, wildcard URL with port and mixed case, IDN, and the rejected forms (*.api.example.com,*.co.uk,*.com,*.1.2.3.4,api.*.example.com,*example.com). On main the accepting cases fail with the error above.TestCompanyScopeWildcardAttribution(Postgres): a*.<root>company scope stores<root>and attributesapi.<root>to the company.go test -p 1 ./db/ ./server/against Postgres 16:dbpasses. Inserver,TestManagerSOCKS5UDPOptInAndAssetBlockRuleDropsDatagramandTestPauseShiftsTaskDeadlineOnResumefail on my Mac, the same as on main (the first needs 127.0.0.2).go vet, gofmt,tsc --noEmitandbiome checkon the changed file are clean. I checked the web parser by running it under node with thetimport stubbed.