Skip to content

Commit 788b38e

Browse files
authored
Merge branch 'main' into fix/DEVA11Y-480-sanitize-version-string
2 parents 95f7990 + 576f0d5 commit 788b38e

6 files changed

Lines changed: 14 additions & 11 deletions

File tree

.github/workflows/Semgrep.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ jobs:
2626
runs-on: ubuntu-latest
2727

2828
container:
29-
# A Docker image with Semgrep installed. Do not change this.
30-
image: returntocorp/semgrep
29+
# Pinned by digest for supply-chain integrity (DEVA11Y-476).
30+
# To update: docker manifest inspect returntocorp/semgrep:latest
31+
image: returntocorp/semgrep@sha256:f682953ce85e3725f4a4dd94bd7ad13e570bb6b2c7a8cf7c6e38a9eac89239b2
3132

3233
# Skip any PR created by dependabot to avoid permission issues:
3334
if: (github.actor != 'dependabot[bot]')

Package.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ let package = Package(
1919
),
2020
permissions: [
2121
.allowNetworkConnections(
22-
// scope: .all(ports: []),
23-
scope: .all(),
22+
scope: .all(ports: [80, 443]),
2423
reason: "Please allow network connection permission to authenticate and run accessibility rules."
2524
),
2625
.writeToPackageDirectory(reason: "Please allow writing to package directory for logging.")

Plugins/BrowserStackAccessibilityLint/BrowserStackAccessibilityLint.swift

Lines changed: 7 additions & 4 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] {
@@ -339,7 +342,7 @@ private struct BrowserStackCLIDownloader {
339342
private func defaultDownloadURL() throws -> URL {
340343
let os = try currentOSName()
341344
let arch = try currentArchName()
342-
guard let url = URL(string: "http://api.browserstack.com/sdk/v1/download_cli?os=\(os)&os_arch=\(arch)") else {
345+
guard let url = URL(string: "https://api.browserstack.com/sdk/v1/download_cli?os=\(os)&os_arch=\(arch)") else {
343346
throw PluginError("Failed to create download URL for \(os) \(arch).")
344347
}
345348
return url

scripts/bash/cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ script_self_update() {
8888
}
8989

9090
download_binary() {
91-
curl -R -z "$BINARY_ZIP_PATH" -L "http://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
91+
curl -R -z "$BINARY_ZIP_PATH" -L "https://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
9292
bsdtar -xvf "$BINARY_ZIP_PATH" -O > "$BINARY_PATH" && chmod 0775 "$BINARY_PATH"
9393
}
9494

scripts/fish/cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ script_self_update() {
100100
}
101101

102102
download_binary() {
103-
curl -R -z "$BINARY_ZIP_PATH" -L "http://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
103+
curl -R -z "$BINARY_ZIP_PATH" -L "https://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
104104
bsdtar -xvf "$BINARY_ZIP_PATH" -O > "$BINARY_PATH" && chmod 0775 "$BINARY_PATH"
105105
}
106106

scripts/zsh/cli.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ script_self_update() {
9999
}
100100

101101
download_binary() {
102-
curl -R -z "$BINARY_ZIP_PATH" -L "http://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
102+
curl -R -z "$BINARY_ZIP_PATH" -L "https://api.browserstack.com/sdk/v1/download_cli?os=${OS}&os_arch=${ARCH}" -o "$BINARY_ZIP_PATH"
103103
bsdtar -xvf "$BINARY_ZIP_PATH" -O > "$BINARY_PATH" && chmod 0775 "$BINARY_PATH"
104104
}
105105

0 commit comments

Comments
 (0)