Skip to content

Add client-response Threat Model and update JS ClientsRequests #19656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

GeekMasher
Copy link
Member

I've added the client-response threat model to the Threat Modelling shared library. This is a new local threat model that includes the sources of client libraries (mainly focuses at JavaScript / Typescript).

This is needed to discover XSS or other types of security issues when the source of untrusted data in the response content of REST, GraphQL, Soap, etc. clients.

@Copilot Copilot AI review requested due to automatic review settings June 3, 2025 15:59
@GeekMasher GeekMasher requested a review from a team as a code owner June 3, 2025 15:59
Copy link
Contributor

@Copilot 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.

Pull Request Overview

Adds a new client-response threat model for client-side response data and updates the JavaScript QL logic and documentation to use it

  • Included client-response in the shared threat‐model grouping
  • Added change notes in both shared and JS QL directories
  • Updated the ClientRequests.qll module to return "client-response" instead of "response"

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
shared/threat-models/ext/threat-model-grouping.model.yml Added client-response under local extensions
shared/threat-models/change-notes/2025-06-03-client-response-threatmodel.md Documented addition of the client-response threat model
javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll Changed getThreatModel() to return "client-response"
javascript/ql/lib/change-notes/2025-06-03-client-response-threatmodel.md Added JS QL change note for the new threat model
Comments suppressed due to low confidence (2)

javascript/ql/lib/semmle/javascript/frameworks/ClientRequests.qll:950

  • You’ve introduced a new client-response threat model but haven’t added tests for it. Please add unit tests that verify HTTP response data is correctly flagged under the client-response model.
override string getThreatModel() { result = "client-response" }

shared/threat-models/ext/threat-model-grouping.model.yml:21

  • The indentation for the comment and the new client-response entry doesn't match existing list items. Align them with the other entries (8 spaces) to maintain valid YAML structure.
# Client-side threat models for request responses.

@asgerf
Copy link
Contributor

asgerf commented Jun 4, 2025

Could you say a few words about why the existing response threat model is not doing what you want? Is it because you want local to enable the threat sources from response?

@GeekMasher
Copy link
Member Author

Correct, right now you can't enable response using either remote or local models because JavaScript has disabled response models by default.

@aegilops
Copy link
Contributor

aegilops commented Jun 5, 2025

Default Setup cannot use response. This will allow it to.

I would argue for allowing response in remote, since we should favour increasing true positives, over some possible false positives.

I haven't seen the data on the testing, but I understand a decision last year was made to favour work on dealing with false negatives over false positives - this decision to make response harder to use seems to run counter to that, I don't understand the reasoning.

Allowing an explicit response threat model in Default Setup is an alternative to this PR.

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.

3 participants