Skip to content

Commit a44732b

Browse files
committed
fix(ui): keep the UI security audit green on the Atlas branch
Three findings scripts/security-ui.sh raised on this branch, none new to the merge: - The analytics pattern matched the English word "plausible" in the wiki text, and `\s` inside an ERE bracket is a literal backslash and 's', which cut every localhost URL at its first 's' and then failed the allowlist. Same two regex fixes as on the stacked branch (plausible.io; [:space:]). - graph-ui/src/lib/rationale.ts carried a literal GitHub URL in a doc comment, and its test built forge links from a literal GitHub base. The audit forbids external URLs anywhere in the UI source, tests included; the comment now describes the shape, and the test composes the same links from a loopback base (the composition is host-agnostic). Audit passes; rationale tests 5 passed. Signed-off-by: Martin Vogel <[email protected]>
1 parent da7235a commit a44732b

3 files changed

Lines changed: 10 additions & 8 deletions

File tree

‎graph-ui/src/lib/rationale.test.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,14 @@ describe("linkifyRefs", () => {
3535

3636
describe("forge URLs", () => {
3737
it("builds commit and issue/PR URLs from the remote base", () => {
38-
const remote = "https://github.com/DeusData/codebase-memory-mcp";
38+
/* A loopback base: the composition is host-agnostic, and the UI
39+
* security audit forbids literal external URLs in this tree. */
40+
const remote = "http://localhost:9749/DeusData/codebase-memory-mcp";
3941
expect(commitUrl(remote, "617a4b14")).toBe(
40-
"https://github.com/DeusData/codebase-memory-mcp/commit/617a4b14",
42+
"http://localhost:9749/DeusData/codebase-memory-mcp/commit/617a4b14",
4143
);
4244
expect(refUrl(remote, 123)).toBe(
43-
"https://github.com/DeusData/codebase-memory-mcp/issues/123",
45+
"http://localhost:9749/DeusData/codebase-memory-mcp/issues/123",
4446
);
4547
});
4648
});

‎graph-ui/src/lib/rationale.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ export interface SymbolCommit {
1313

1414
export interface SymbolHistoryPayload {
1515
max_commits: number;
16-
/* Normalized https forge base (e.g. "https://github.com/owner/repo");
17-
* absent when the repo has no usable remote — then hashes render as
18-
* plain text and #refs stay unlinked. */
16+
/* Normalized https forge base (scheme, host, owner and repository, no
17+
* trailing slash); absent when the repo has no usable remote — then
18+
* hashes render as plain text and #refs stay unlinked. */
1919
remote_url?: string;
2020
available: boolean;
2121
/* Newest first, at most max_commits; absent on the unavailable paths. */

‎scripts/security-ui.sh‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ else
5151
if find "$UI_DIR" -type f \( -name '*.js' -o -name '*.ts' -o -name '*.tsx' -o -name '*.css' \) -exec grep -lE 'https?://' {} \; 2>/dev/null | head -20 > "$SEC_TMPDIR/urls"; then
5252
while IFS= read -r file; do
5353
relfile="${file#"$ROOT/"}"
54-
grep -onE 'https?://[^\s"'"'"')]+' "$file" 2>/dev/null | while IFS=: read -r lineno url; do
54+
grep -onE 'https?://[^[:space:]"'"'"')]+' "$file" 2>/dev/null | while IFS=: read -r lineno url; do
5555
case "$url" in
5656
http://localhost*|http://127.0.0.1*|https://localhost*|https://127.0.0.1*)
5757
;; # OK — local dev/runtime
@@ -85,7 +85,7 @@ else
8585

8686
# A3: No tracking/analytics
8787
echo " Checking for tracking/analytics..."
88-
TRACKING='google-analytics|gtag|mixpanel|segment\.com|hotjar|sentry\.io|plausible|posthog'
88+
TRACKING='google-analytics|gtag|mixpanel|segment\.com|hotjar|sentry\.io|plausible\.io|posthog'
8989
if find "$UI_DIR" -type f \( -name '*.js' -o -name '*.ts' -o -name '*.tsx' -o -name '*.html' \) \
9090
-exec grep -lE "$TRACKING" {} \; 2>/dev/null > "$SEC_TMPDIR/track"; then
9191
while IFS= read -r file; do

0 commit comments

Comments
 (0)