MCPcopy Create free account
hub / github.com/cure53/DOMPurify / isInside

Function isInside

test/browser/server.js:41–45  ·  view source on GitHub ↗
(child, parent)

Source from the content-addressed store, hash-verified

39 * Uses path.relative semantics which CodeQL recognizes as a path-containment
40 * sanitizer for js/path-injection. */
41function isInside(child, parent) {
42 if (child === parent) return true;
43 const rel = path.relative(parent, child);
44 return rel.length > 0 && !rel.startsWith('..') && !path.isAbsolute(rel);
45}
46
47const server = http.createServer((req, res) => {
48 /* Parse the request URL defensively. A malformed URL yields 400 before any

Callers 1

server.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected