Skip to content

Add opt-in AI output threat model - #22810

Open
jacknojo wants to merge 3 commits into
mainfrom
jacknojo-llm-output-threat-model
Open

jacknojo wants to merge 3 commits into
mainfrom
jacknojo-llm-output-threat-model

Conversation

@jacknojo

Copy link
Copy Markdown
Contributor

Summary

Introduce the shared ai threat-model kind for output generated by large language models (LLMs). This establishes the configuration support for follow-up source models and queries, without adding third-party library models or new queries.

  • Register ai under all, making it a known, independently configurable threat-model kind. It remains disabled by default.
  • Document the new opt-in kind and add a change note for codeql/threat-models.
  • Add a regression test that explicitly enables ai and requires both knownThreatModel("ai") and currentThreatModel("ai") to hold. The existing default-configuration test confirms that ai is not enabled by default.

No new QL framework logic is necessary: the existing threat-model implementation derives known kinds and configuration behavior from the shared grouping table.

Validation

Both tests passed with the CodeQL CLI:

codeql test run \
  javascript/ql/test/library-tests/threat-models/ai-enabled \
  javascript/ql/test/library-tests/threat-models/default

Register ai as a shared threat model, document its scope, and add a regression test for explicit enablement.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 3b1133f4-388a-4e13-a00f-dce2b41cd295
owen-mc
owen-mc previously approved these changes Oct 14, 2026
- ["windows-registry", "local"]

# AI threat models
- ["ai", "all"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe this line would be better at the bottom of the file, with the other threat models that aren't grouped with any other threat models.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done in c2fa18d


The less commonly used categories are:

- ``ai`` which represents output generated by large language models (LLMs). This threat model is opt-in and does not include any built-in source models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wouldn't mention that it doesn't include any built-in source models. We'll just have to remove it at some point soon (I assume we're merging some soon). But if you want to coordinate removing it when we merge the first ones then it's fine.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, done in 80619c8

@jacknojo jacknojo left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks Owen, made two followup commits for your comments.

- ["windows-registry", "local"]

# AI threat models
- ["ai", "all"]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good idea, done in c2fa18d


The less commonly used categories are:

- ``ai`` which represents output generated by large language models (LLMs). This threat model is opt-in and does not include any built-in source models.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agreed, done in 80619c8

@jacknojo
jacknojo marked this pull request as ready for review October 14, 2026 12:02
@jacknojo
jacknojo requested review from a team as code owners October 14, 2026 12:02
Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The shared configuration, documentation, and focused regression coverage consistently implement the described opt-in behavior.

0 open findings

What changed in this PR

Adds the shared, opt-in ai threat model for LLM-generated output.

Changes:

  • Registers ai as a known threat-model kind.
  • Documents the new kind and adds a change note.
  • Tests explicit enablement while preserving default-disabled behavior.
File Description
shared/​threat-models/​ext/​threat-model-grouping.model.yml Registers ai under all.
shared/​threat-models/​change-notes/​2026-10-12-ai-threat-model.md Announces the opt-in threat model.
javascript/​ql/​test/​library-tests/​threat-models/​ai-enabled/​ActiveAiThreatModel.ql Verifies ai is known and active.
javascript/​ql/​test/​library-tests/​threat-models/​ai-enabled/​ActiveAiThreatModel.ext.yml Enables ai for the regression test.
javascript/​ql/​test/​library-tests/​threat-models/​ai-enabled/​ActiveAiThreatModel.expected Records the expected test result.
docs/​codeql/​reusables/​threat-model-description.rst Documents the ai category.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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.

3 participants