Skip to content

Commit 7074e81

Browse files
committed
fix(labeler): assert assessment-URL origin, not prefix (clears CodeQL)
CodeQL js/incomplete-url-substring-sanitization (high) flagged a test assertion doing `assessmentUrl.startsWith("https://labels.example")` — a prefix that `https://labels.example.evil.com` also satisfies. The production URL builder (assessmentUrl, notification-triggers.ts) is sound (`new URL(path, base)`); this was a test-only false positive. Parse the URL and assert origin equality instead — stronger, and clears the rule.
1 parent c539e22 commit 7074e81

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

apps/labeler/test/prolonged-error.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ describe("sweep parity and finalization invariant", () => {
487487

488488
expect(notice).not.toBeNull();
489489
expect(notice?.subject).toContain("couldn't complete");
490-
expect(notice?.assessmentUrl.startsWith(SERVICE)).toBe(true);
490+
expect(new URL(notice!.assessmentUrl).origin).toBe(SERVICE);
491491
});
492492

493493
it("notifyAssessmentOutcome never notifies on an error assessment (finalization stays silent)", async () => {

0 commit comments

Comments
 (0)