MCPcopy
hub / github.com/angular/angular / isHostAllowed

Function isHostAllowed

packages/platform-server/src/utils.ts:408–425  ·  view source on GitHub ↗
(hostname: string, allowedHosts: ReadonlySet<string>)

Source from the content-addressed store, hash-verified

406 * @private
407 */
408export function isHostAllowed(hostname: string, allowedHosts: ReadonlySet<string>): boolean {
409 if (allowedHosts.has('*') || allowedHosts.has(hostname)) {
410 return true;
411 }
412
413 for (const allowedHost of allowedHosts) {
414 if (!allowedHost.startsWith('*.')) {
415 continue;
416 }
417
418 const domain = allowedHost.slice(1);
419 if (hostname.endsWith(domain)) {
420 return true;
421 }
422 }
423
424 return false;
425}

Callers 2

utils_spec.tsFile · 0.90
validateAllowedHostsFunction · 0.85

Calls 1

hasMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…