Skip to content

JS: Add 'browser' source kinds#21368

Open
asgerf wants to merge 3 commits intogithub:mainfrom
asgerf:browser-sources
Open

JS: Add 'browser' source kinds#21368
asgerf wants to merge 3 commits intogithub:mainfrom
asgerf:browser-sources

Conversation

@asgerf
Copy link
Contributor

@asgerf asgerf commented Feb 25, 2026

Previously, sources contributed via MaD would always be seen as server-side sources, but now client-side sources can be contributing using one of the following source kinds:

  • browser
    • browser-window-name (window.name)
    • browser-message-event
    • browser-url (window.location.href)
      • browser-url-query
      • browser-url-fragment
      • browser-url-path

No additional threat models have been added. The above source kinds are activated as part of the remote threat model, but many queries treat them differently from server-side sources.

See also discussion here (internal link).

@github-actions github-actions bot added the JS label Feb 25, 2026
@asgerf asgerf changed the title JS: Add 'browser' source kinds and corresponding threat model kinds JS: Add 'browser' source kinds Feb 27, 2026
@asgerf asgerf marked this pull request as ready for review March 11, 2026 14:41
@asgerf asgerf requested a review from a team as a code owner March 11, 2026 14:41
Copilot AI review requested due to automatic review settings March 11, 2026 14:41
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Contributor

@Napalys Napalys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, couple of small nits. 👍

predicate isUrl() { this = "url" }
predicate isUrl() { this = "browser-url" }

/** Holds if this is the `query` or `fragment` kind. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:
We could update the ql doc to reflect the changes?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request(window.location.href + '?q=123');

const custom = require('testlib').getBrowserSource(); // $ Source[js/client-side-request-forgery]
request(custom) // $ Alert[js/client-side-request-forgery];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that semicolumn does not belong there?

Suggested change
request(custom) // $ Alert[js/client-side-request-forgery];
request(custom) // $ Alert[js/client-side-request-forgery]

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.

4 participants