Function
assertNavigationAllowed
(
url: string | undefined,
patterns: string[],
ranges: NetworkRangeSet | null,
allowedHosts?: readonly string[],
)
Source from the content-addressed store, hash-verified
| 176 | * `html`-only request that never navigates). |
| 177 | */ |
| 178 | export const assertNavigationAllowed = ( |
| 179 | url: string | undefined, |
| 180 | patterns: string[], |
| 181 | ranges: NetworkRangeSet | null, |
| 182 | allowedHosts?: readonly string[], |
| 183 | ): void => { |
| 184 | if (!url) return; |
| 185 | const blocked = findBlockedNavigationUrl(url, patterns, ranges, allowedHosts); |
| 186 | if (blocked) { |
| 187 | throw new Forbidden(`Navigation to "${blocked}" is not allowed`); |
| 188 | } |
| 189 | }; |
Tested by
no test coverage detected