Conversation
The data flow graph has no actual edges yet
|
QHelp previews: unified/ql/src/queries/security/CWE-312/CleartextLogging.qhelpCleartext logging of sensitive informationAttackers could gain access to sensitive information that is logged unencrypted. RecommendationAlways make sure to encrypt or obfuscate sensitive information before you log it. Generally, you should decrypt sensitive information only at the point where it is necessary for it to be used in cleartext. Be aware that external processes often store the standard output and standard error streams of the application. This will include logged sensitive information. ExampleThe following example code logs user credentials (in this case, their password) in plaintext: let password = "P@ssw0rd"
NSLog("User password changed to \(password)")Instead, you should encrypt or obfuscate the credentials, or omit them entirely: let password = "P@ssw0rd"
NSLog("User password changed")References
|
| */ | ||
| predicate relevantNode(AstNode node) { | ||
| // Match an ancestor node by location so its whole subtree is shown. | ||
| node.getParent*().getLocation().toString().matches("%test.swift@13:%") |
|
|
||
| from DummyFlow::PathNode source, DummyFlow::PathNode sink | ||
| where DummyFlow::flowPath(source, sink) | ||
| select sink.getNode(), source, sink, "Logging of $@", source.getNode(), "sensitive data" |
44d00a0 to
b3f892e
Compare
b3f892e to
2d1a99c
Compare
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The standard query is knowingly noisy, while type contexts and tuple indices above 20 are modeled incorrectly.
Get a fresh assessment by requesting another Copilot review.
Review tier: Balanced
Findings: 3
Open findings (3)
What changed in this PR
Adds foundational Unified data-flow/taint tracking and a Swift cleartext-logging query.
Changes:
- Implements data-flow nodes, SSA integration, content tracking, and flow steps.
- Exposes public data-flow APIs and testing utilities.
- Adds cleartext-logging query documentation and tests.
| File | Description |
|---|---|
CleartextLoggingGood.swift (test) |
Adds negative query case. |
CleartextLoggingBad.swift (test) |
Adds positive query case. |
CleartextLogging.qlref |
Configures query test. |
CleartextLogging.expected |
Generated query expectation. |
dataflow/test.swift |
Exercises local and taint flow. |
dataflow/test.ql |
Runs inline flow tests. |
dataflow/test.expected |
Generated flow expectations. |
dataflow/implicit-self.swift |
Tests implicit receiver flow. |
CleartextLoggingGood.swift (query) |
Adds safe documentation example. |
CleartextLoggingBad.swift (query) |
Adds unsafe documentation example. |
CleartextLogging.ql |
Implements the security query. |
CleartextLogging.qhelp |
Documents the query. |
InlineFlowTest.qll |
Adds Unified flow-test support. |
unified.qll |
Exports the data-flow API. |
qlpack.yml |
Adds data-flow dependencies. |
StaticNameBinding.qll |
Exposes member names. |
FacadeAst.qll |
Adds call argument counting. |
ExprPositions.qll |
Classifies expression contexts. |
debugDataFlowGraph.ql |
Adds graph visualization. |
VariableRefKind.qll |
Defines variable access kinds. |
TaintTrackingInstantiation.qll |
Instantiates taint tracking. |
Step.qll |
Defines flow-step kinds. |
LocalSsa.qll |
Integrates local SSA. |
DataFlowPublic.qll |
Exposes public modules. |
DataFlowNode.qll |
Defines data-flow nodes. |
DataFlowInstantiation.qll |
Instantiates data flow. |
DataFlowGraph.qll |
Constructs local flow edges. |
Content.qll |
Models field-sensitive content. |
AllDataFlow.qll |
Aggregates internal modules. |
AstExtra.qll |
Separates identifier labels. |
DataFlowConsistency.ql |
Adds consistency checks. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| or | ||
| // Tuple elements can be accessed as named members, e.g. `tuple.0`, `tuple.1`, etc, | ||
| // so just model their elements as named members. | ||
| name = [0 .. 20].toString() |
| * @kind path-problem | ||
| * @problem.severity error | ||
| * @security-severity 7.5 | ||
| * @precision high |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
geoffw0
left a comment
There was a problem hiding this comment.
Prototype query, .qhelp and query test LGTM (apart from one dead link). 🎉 🚀
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>

Adds the first basic version of data flow, with the following features:
selfaccessThe PR also adds a basic version of the clear-text logging query, mainly for exercising data flow in DCA. This query was chosen because it is easily stubbed without elaborate library modelling and will tend to have sources and sinks in many projects. It is not expected to be precise at this point in time.
What is not included:
Commit-by-commit review strongly recommended.