Skip to content

Shared: Treat trusted_schema names as non-sensitive - #22962

Merged
geoffw0 merged 2 commits into
github:mainfrom
LucaCappelletti94:upstream/trusted-schema-not-secret
Nov 4, 2026
Merged

geoffw0 merged 2 commits into
github:mainfrom
LucaCappelletti94:upstream/trusted-schema-not-secret

Conversation

@LucaCappelletti94

Copy link
Copy Markdown
Contributor

The secret-name heuristic in SensitiveDataHeuristics.qll matches any name containing trusted, so set_trusted_schema counts as a source of secret data. That name is SQLite's trusted_schema switch (PRAGMA trusted_schema, SQLITE_DBCONFIG_TRUSTED_SCHEMA), a hardening flag that carries no secret. Diesel exposes it as SqliteConnection::set_trusted_schema, and rust/cleartext-logging reports any formatting of its result as cleartext logging of sensitive information.

The regular expression already excludes trusted_iter with a lookahead, so this extends that lookahead to _?schema. Both the snake case and camel case spellings become non-sensitive, while names such as trusted_token stay secret.

Copilot AI auto review requested due to automatic review settings October 30, 2026 16:08
@LucaCappelletti94
LucaCappelletti94 requested review from a team as code owners October 30, 2026 16:08

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.

🟡 Changes recommended

An active moderate finding remains because the Go change note incorrectly claims that set_trusted_schema will not be classified as sensitive, while the Go queries use their own heuristic.

1 open issue
What changed in this PR

This pull request updates the shared sensitive-data heuristic so SQLite’s trusted_schema and trustedSchema names are not classified as secrets, reducing false positives in affected queries.

Changes:

  • Excludes trusted-schema names from the shared secret-name heuristic.
  • Adds Rust regression coverage for schema names, the setter method, and trusted_token.
  • Adds language-specific analysis change notes.
File Summary
swift/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents the Swift analysis improvement.
shared/​concepts/​codeql/​concepts/​internal/​SensitiveDataHeuristics.qll Excludes trusted-schema names from secret detection.
rust/​ql/​test/​library-tests/​sensitivedata/​test.rs Covers snake_case, camelCase, setter-method behavior, and continued detection of trusted_token.
rust/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents the Rust analysis improvement.
ruby/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents the Ruby analysis improvement.
python/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents the Python analysis improvement.
javascript/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents the JavaScript analysis improvement.
go/​ql/​lib/​change-notes/​2026-10-30-trusted-schema-not-sensitive.md Documents a claimed Go analysis improvement; review identified that Go uses a separate unchanged heuristic.

This pull request requires changes.

Review effort: Lite (auto)

---
category: minorAnalysis
---
* The sensitive data heuristics treat names built on `trusted_schema`, such as SQLite's `set_trusted_schema` setting, as non-sensitive. This removes false positive results from queries that use the sensitive data library (for example `go/clear-text-logging`).

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.

This is correct: most languages use this shared library, but not Go, so it shouldn't have a change note.

@github-actions github-actions Bot removed the Go label Oct 30, 2026

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

Thank you for this improvement.

@geoffw0

geoffw0 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

I'll start DCA runs to check this does behave as expected. I don't think we necessarily need approvals for all languages individually to merge this.

@geoffw0

geoffw0 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

All the DCA runs look good to me. Merging.

Thank you @LucaCappelletti94 !

@geoffw0

geoffw0 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

... apparently the rules don't let me merge this at this time. Possibly that means that other approvals are required as well now, or something else needs doing???

@geoffw0
geoffw0 merged commit c9bbcf9 into github:main Nov 4, 2026
117 checks passed
@LucaCappelletti94

Copy link
Copy Markdown
Contributor Author

Also consider PR service is having problems https://www.githubstatus.com/

@geoffw0

geoffw0 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Ahah, got it (I think I wasn't fully signed in when I hit merge the first time).

@geoffw0

geoffw0 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Also consider PR service is having problems https://www.githubstatus.com/

That could've been the problem.

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