Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
QHelp previews: unified/ql/src/queries/security/CWE-094/UnsafeJsEval.qhelpJavaScript InjectionEvaluating JavaScript that contains a substring from a remote origin may lead to remote code execution. Code written by an attacker can execute unauthorized actions, including exfiltration of local data through a third party web service. RecommendationWhen loading JavaScript into a web view, evaluate only known, locally-defined source code. If part of the input comes from a remote source, do not inject it into the JavaScript code to be evaluated. Instead, send it to the web view as data using an API such as ExampleIn the following (bad) example, a call to let webview: WKWebView
let remoteData = try String(contentsOf: URL(string: "http://example.com/evil.json")!)
...
_ = try await webview.evaluateJavaScript("console.log(" + remoteData + ")") // BADIn the following (good) example, we sanitize the remote data by passing it using the let webview: WKWebView
let remoteData = try String(contentsOf: URL(string: "http://example.com/evil.json")!)
...
_ = try await webview.callAsyncJavaScript(
"console.log(data)",
arguments: ["data": remoteData], // GOOD
contentWorld: .page
)References
|
Adds a
unified/swift/unsafe-js-evalquery for unified Swift. Done with the same agent skill as before, but a different model to test its versatility of that skill (MAI-Code-2.x1 high effort rather than GPT-6.1 Sol high effort). No problems there.... and no manual edits this time. We do fairly well on the QL test. There are some newly missing test results (and some that were missing even in the original analysis), addressing those will be follow-up work.
DCA run to follow.