Skip to content

Commit 3b8616a

Browse files
authored
Merge pull request #580 from ForgeRock/SDKS-4732/tv-fix
fix(token-vault): replace substring URL matching with strict equality
2 parents 588b6f9 + 168c723 commit 3b8616a

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

.changeset/config.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"baseBranch": "master",
1414
"updateInternalDependencies": "patch",
1515
"ignore": [
16-
"@forgerock/token-vault",
1716
"autoscript-apps",
1817
"autoscript-suites",
1918
"mock-api",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@forgerock/token-vault': patch
3+
---
4+
5+
fix(security): replace substring URL matching with strict equality in evaluateUrlForInterception to prevent URL allow-list bypass via query parameter injection

packages/token-vault/src/lib/network/network.utilities.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ describe('Test network utility functions', () => {
3535
expect(evaluateUrlForInterception(url, urls)).toBe(false);
3636
});
3737

38-
// Test evaluateUrlForInterception with matching URL containing blob
39-
it('evaluateUrlForInterception should return true for matching URLs with blob', () => {
40-
const urls = ['https://example.com', 'https://example.com/*'];
41-
const url = 'blob:https://example.com/1234';
42-
expect(evaluateUrlForInterception(url, urls)).toBe(true);
38+
// Test evaluateUrlForInterception rejects URLs containing a valid URL as a query parameter
39+
it('evaluateUrlForInterception should return false when valid URL appears as query parameter', () => {
40+
const urls = ['https://valid.com'];
41+
const url = 'https://evil.com?https://valid.com';
42+
expect(evaluateUrlForInterception(url, urls)).toBe(false);
4343
});
4444

4545
// Test extractOrigins

packages/token-vault/src/lib/network/network.utilities.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ export function evaluateUrlForInterception(url: string, urls: string[]) {
109109
}
110110
}
111111
// Do full URL matching
112-
if (url.includes(u)) {
112+
if (url === u) {
113113
return true;
114114
}
115115
}

0 commit comments

Comments
 (0)