Clear CodeQL and Sonar security findings from the broker PR

The gateway URL's trailing slashes were stripped with /\/+$/, which CodeQL
flags as polynomial on a URL of many slashes; a plain loop replaces it.
CI now pins setup-bun to a commit and installs with --ignore-scripts, and
run-all.sh uses [[ ]].

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_012AuVk4nEvBXaTjs4G6wdW4
This commit is contained in:
Claude committed 2026-10-16 19:28:37 +00:00
1 parent 27b63716f9
commit 241ff08662
3 files changed
+12 -5

No files matched your search

+2 -2
View File
@@ -14,9 +14,9 @@ jobs:
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: 1.4.2
- run: bun install --frozen-lockfile
- run: bun install --frozen-lockfile --ignore-scripts
- run: make check
- run: make accept
+1 -1
View File
@@ -7,7 +7,7 @@ set -euo pipefail
cd "$(dirname "$0")/../.."
mapfile -t scripts < <(find scripts/accept -maxdepth 1 -name 'wave-*.sh' -print | sort -V)
if [ "${#scripts[@]}" -eq 0 ]; then
if [[ "${#scripts[@]}" -eq 0 ]]; then
echo "FAIL: no scripts/accept/wave-*.sh found" >&2
exit 1
fi
+9 -2
View File
@@ -82,12 +82,19 @@ export function remoteToolName(server: string, catalogName: string): string {
return catalogName.slice(prefix.length);
}
/** Drops trailing slashes without a regex, so a hostile URL stays linear. */
function stripTrailingSlashes(url: string): string {
let end = url.length;
while (end > 0 && url[end - 1] === "/") end--;
return url.slice(0, end);
}
/** Per-target MCP endpoint on the gateway: `${gateway}/mcp/<target>`. */
export function targetUrl(gatewayUrl: string, server: string): string {
return `${gatewayUrl.replace(/\/+$/, "")}/mcp/${endpointFor(server).target}`;
return `${stripTrailingSlashes(gatewayUrl)}/mcp/${endpointFor(server).target}`;
}
/** Multiplexed MCP endpoint on the gateway (all targets, prefixed names). */
export function multiplexedUrl(gatewayUrl: string): string {
return `${gatewayUrl.replace(/\/+$/, "")}/mcp`;
return `${stripTrailingSlashes(gatewayUrl)}/mcp`;
}