Repository navigation
JS: Add OpenTelemetry logging sink models - #23320
Open
adityareddy-dev wants to merge 3 commits into
Open
adityareddy-dev wants to merge 3 commits into
adityareddy-dev wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The log-injection sink incorrectly flags structured request attributes, requiring separate attribute modeling and a negative regression test.
1 open issue
What changed in this PR
Adds OpenTelemetry logging coverage to JavaScript/TypeScript security analysis.
Changes:
- Models
Logger.emitand diagnostic logging methods. - Enables clear-text logging analysis to consume
log-injectionsink models. - Adds regression fixtures and expected results for both queries.
| File | Description |
|---|---|
javascript/ql/test/query-tests/Security/CWE-312/opentelemetry.ts |
Adds sensitive-data logging tests. |
javascript/ql/test/query-tests/Security/CWE-312/CleartextLogging.expected |
Records expected clear-text logging results. |
javascript/ql/test/query-tests/Security/CWE-117/opentelemetry.ts |
Adds log-injection tests and safe cases. |
javascript/ql/test/query-tests/Security/CWE-117/LogInjection.expected |
Records expected log-injection results. |
javascript/ql/lib/semmle/javascript/security/dataflow/CleartextLoggingCustomizations.qll |
Incorporates model-defined logging sinks. |
javascript/ql/lib/ext/opentelemetry.model.json |
Defines OpenTelemetry types and logging sinks. |
javascript/ql/lib/change-notes/2026-12-01-opentelemetry-logging.md |
Documents expanded analysis coverage. |
Review effort: Balanced (adaptive)
This branch has not been deployed
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.

Adds OpenTelemetry logging sink models for JS/TS in
javascript/ql/lib/ext/opentelemetry.model.jsonand wireslog-injectionmodels intojs/clear-text-logging.Right now
js/clear-text-loggingonly checksLoggerCalland ignoreslog-injectionsinks from models-as-data. AddingSinkFromModelinCleartextLoggingCustomizations.qllmatchesLogInjectionQuery.qlland the Java, Go, and Rust clear-text logging queries.The model covers
Logger.emit(bodyandexceptionforlog-injection, plus structuredattributesmodeled separately forjs/clear-text-loggingviaOpenTelemetryLogAttributesSink) across@opentelemetry/api-logs,@opentelemetry/api1.10+, and@opentelemetry/sdk-logs. It also modelsDiagLoggermethods ondiag,diag.createComponentLogger(...), andnew DiagConsoleLogger().I left tracing span APIs like
span.setAttributeand structured logattributesout oflog-injectionon purpose. Passing request metadata into structured attributes is standard OpenTelemetry instrumentation and would create false positives injs/log-injection.