Repository navigation
Description
Target Language
swift
Library Repository / Documentation URL
To be determined from the linked findings
Data Extension Name (Optional)
cwe-22.model.yml
Library Modules / Components
See linked findings for the frameworks involved.
Data Extension Description
AI Scan reported 1 high-severity CWE-22 (path traversal) finding(s) in Swift public synthetic repositories that the baseline CodeQL default-setup scan did not report. Gap categories: missing-summary. Existing queries considered: swift/path-injection.
Why CodeQL appears to have missed these (unverified until reproduced with a test database):
- Custom URL schemes are modeled as remote sources and Data.write(to:) as a sink; the likely missing link is the helper that builds the Documents URL.
Linked findings (gap-key: swift/data-extension-create/path-traversal)
| Repo | CWE | Severity | AI scan alert | Summary |
|---|---|---|---|---|
| OversecuredVulnerableiOSApp | CWE-22 | high | https://github.com/codeql-forks-felickz/OversecuredVulnerableiOSApp/security/code-scanning/3 | The public deep-link save route uses the attacker-controlled name directly as a path component under Documents. Values containing traversal components can escape Documents within the app sandbox; decoded attacker data is then written there without any path containment check or user confirmation. |
Findings come from AI Scan on public synthetic apps. Hypotheses above are unverified until reproduced with a test database. Verify first whether CodeQL already covers a case (for example via a different query or threat model) before adding code.
Code Examples
See the linked alerts above for the vulnerable pattern; reduce each to a minimal test case with a safe counterpart that should not alert.
Additional References (Optional)
https://cwe.mitre.org/data/definitions/22.html
Code of Conduct
- I agree to follow this project's Code of Conduct
Activity
felickz commentedon Nov 3, 2026
Upstream triage
precision:mediumRelies on heuristics or accepted over-approximation. Community Packs, always tags:experimental.
tags:experimental
Goes to Community Packs: performance, false-positive or synthetic-only concerns.
Community Packs, experimental. Recommended for the Community Packs repository, not
github/codeql. The issue is labeledtags:experimentalfor this.Separable piece. URLComponents, NSURLComponents and URLQueryItem models. This part could be proposed to
github/codeqlon its own, see the split note below.Linked pull request: #107
Why. The URLComponents, NSURLComponents and URLQueryItem models (init summaries, field taint) are exact Foundation additions that github/codeql does not appear to contain, and URLComponents is common in iOS deep link parsing. The PR also adds a receiver-insensitive, field-based UIViewController property step, and the query copies swift/path-injection. Recommend Community Packs for the whole PR, and propose the models upstream separately.
highin the pull request). URLComponents/NSURLComponents/URLQueryItem init summaries and field taint are exact Foundation models, but ViewControllerStoredPropertyStep is a field-based, receiver-insensitive step for any UIViewController stored property, and the query copies stock path-injection.Concerns, overlap and next steps
False-positive concerns
Performance concerns
Heuristics used
What an upstream change would look like. Split: URLComponents models as a github/codeql swift/ql/lib patch (Url.qll style SummaryModelCsv + TaintInheritingContent, test in swift/ql/test/library-tests, swift/ql/lib/change-notes); property step in Community Packs.
Before opening an upstream pull request
Split note. The exact URLComponents/NSURLComponents/URLQueryItem models could be a separate github/codeql library patch; the UIViewController stored-property step is heuristic and stays experimental. The whole-PR recommendation is the conservative one.
Change from the initial guess. When this issue was opened the coarse destination guess was
github/codeql. Reading the actual pull request changed it to Community Packs.This is a recommendation only. A human reviews it before any pull request is opened against
github/codeqlor the Community Packs repository.