chore: checkpoint web Blender feature-gap work, docs and tests
- update native web_engine sources and rebuilt wasm artifacts - add task cards, status notes and tooling scripts - add web e2e specs, tutorial UI sources and tutorial assets - sync golden task manifests and audit records Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -18,10 +18,14 @@ const directives = new Map(policy.split(";").map((directive) => {
|
||||
const tokens = directive.trim().split(/\s+/u);
|
||||
return [tokens.shift(), tokens];
|
||||
}));
|
||||
const sourceTokens = [...directives.values()].flat();
|
||||
const scriptDirectives = ["default-src", "script-src", "script-src-elem", "script-src-attr", "worker-src"];
|
||||
const sourceTokens = scriptDirectives.flatMap((name) => directives.get(name) ?? []);
|
||||
for (const forbidden of ["'unsafe-inline'", "'unsafe-eval'", "data:", "*", "blob:"]) {
|
||||
assert.equal(sourceTokens.includes(forbidden), false, `CSP contains forbidden token ${forbidden}`);
|
||||
assert.equal(sourceTokens.includes(forbidden), false, `CSP script/worker directives contain forbidden token ${forbidden}`);
|
||||
}
|
||||
/* React Flow positions nodes/edges with inline style attributes; scripts stay strict. */
|
||||
assert.deepEqual(directives.get("style-src-attr"), ["'unsafe-inline'"], "CSP must allow only inline style attributes for React Flow");
|
||||
assert.deepEqual(directives.get("style-src"), ["'self'"], "CSP style elements must remain same-origin only");
|
||||
for (const required of ["default-src 'self'", "script-src 'self'", "worker-src 'self'", "connect-src 'self'", "object-src 'none'", "base-uri 'none'", "frame-ancestors 'none'"]) assert.ok(policy.includes(required), `CSP is missing ${required}`);
|
||||
const index = fs.readFileSync(path.join(root, "web/app/index.html"), "utf8");
|
||||
assert.doesNotMatch(index, /<script\b[^>]*(?:\b(?:src\s*=\s*["']data:|type\s*=\s*["']text\/javascript["']))/iu);
|
||||
|
||||
Reference in New Issue
Block a user