MCPcopy
hub / github.com/browserless/browserless / assertNavigationAllowed

Function assertNavigationAllowed

src/network-security.ts:178–189  ·  view source on GitHub ↗
(
  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 */
178export 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};

Callers 5

handlerMethod · 0.85
handlerMethod · 0.85
handlerMethod · 0.85
handlerMethod · 0.85
handlerMethod · 0.85

Calls 1

findBlockedNavigationUrlFunction · 0.85

Tested by

no test coverage detected