Skip to content

Commit 7e92021

Browse files
sunny-seclaude
andcommitted
fix(security): restrict download URL override to HTTPS only
F-008 / DEVA11Y-479 — parseOverride() accepted file:// URLs and bare paths (CWE-918), enabling SSRF and local-file exfiltration via bsdtar. Restrict to HTTPS-only to prevent local file access. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0428b32 commit 7e92021

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

Plugins/BrowserStackAccessibilityLint/BrowserStackAccessibilityLint.swift

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,13 @@ private func parseOverride(urlString: String?) throws -> URL? {
100100
guard let urlString = urlString, !urlString.isEmpty else {
101101
return nil
102102
}
103-
if let url = URL(string: urlString), let scheme = url.scheme, ["http", "https", "file"].contains(scheme.lowercased()) {
104-
return url
103+
guard let url = URL(string: urlString), let scheme = url.scheme else {
104+
throw PluginError("Invalid download URL: \(urlString). Only HTTPS URLs are supported.")
105+
}
106+
guard scheme.lowercased() == "https" else {
107+
throw PluginError("Unsupported URL scheme '\(scheme)' in download URL. Only HTTPS is allowed.")
105108
}
106-
return URL(fileURLWithPath: urlString)
109+
return url
107110
}
108111

109112
private func sanitizeArguments(_ arguments: [String]) -> [String] {

0 commit comments

Comments
 (0)