[alpha_factory] Fix Insight v1 demo readiness and CSP-safe bootstrap - #4633
[alpha_factory] Fix Insight v1 demo readiness and CSP-safe bootstrap#4633MontrealAI wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e7bc82539f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| </script> | ||
|
|
||
| <script type="importmap">{"imports":{"d3":"./d3.exports.js"}}</script> | ||
| <script src="bootstrap.js"></script> |
There was a problem hiding this comment.
Preserve SW_HASH assignment in index for build tooling
Moving the service-worker hash constant out of index.html into bootstrap.js breaks the docs build pipeline, because scripts/build_insight_docs.sh still runs python scripts/ensure_insight_sw_hash.py "$DOCS_DIR" (line 97) and that updater only scans index.html for SW_HASH (scripts/ensure_insight_sw_hash.py lines 13 and 32-33). In this commit, index.html no longer contains any SW_HASH assignment, so the updater raises ValueError("SW_HASH not found in index.html") and aborts the build/deploy flow.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7165028372
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| </style> | ||
| <meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src 'self' https://api.openai.com; frame-src 'self' blob:; worker-src 'self' blob:; script-src 'self' 'wasm-unsafe-eval' 'sha384-177zXf5eB3dnF9pKwGvc3ITN0EN04yL+Lju+41FYl59Rk/ooEBgXYv3+I8s/0zR0' 'sha384-79nEfECpiwNfTKeXO3LCt0sLutpd3k4stwrBgGfcJBKvwd9SsNd9wIP34JDO4M50' 'sha384-S/HpIy5nMSwGRdVif2eZ3cvGREvSWay48Hf5S44wcCUQ0HW9qYkQDrwyKoG6dSj5' 'sha384-eR8sYzoSk2xJcnjk7RVrsGWKil+DbPgMionlm2xuFpCTJRuyTQ/l6jHF2OY7ZnIL'; style-src 'self' 'unsafe-inline'" /> | ||
| <meta http-equiv="Content-Security-Policy" content="default-src 'self'; connect-src 'self' https://api.openai.com; frame-src 'self' blob:; worker-src 'self' blob:; script-src 'self' 'wasm-unsafe-eval' 'sha256-dDxHY9jsmwCNT6SL2iClsP0FZJhaJdDwa84djmuXewU=' 'sha256-MZlivqP55xBVZ2jmS02uBj9OM0b1thDoF0fdP8evk2k=' 'sha256-Ieor5mDwXPSfgARysDOt31nGHdS8ZJCQUvuusk0K4pA='; style-src 'self' 'unsafe-inline'; style-src-elem 'self' 'unsafe-inline'" /> |
There was a problem hiding this comment.
Restore SHA-384 CSP hashes for inline scripts
scripts/ensure_insight_csp.py and tests/security/test_csp.py both treat inline script allowlists as SHA-384 entries ('sha384-...'), but this script-src now only lists SHA-256 hashes. That means the test’s computed SHA-384 hashes for the inline scripts are never permitted, so the CSP integrity check fails and the docs build helper will keep rewriting this tag back to SHA-384-based values.
Useful? React with 👍 / 👎.
Motivation
d3module specifier, so the page must be usable offline and CSP-compliant for automated verification.Description
index.htmlto loadstyle.cssso the demo no longer depends on network assets.docs/alpha_agi_insight_v1/bootstrap.jsthat defines required globals, provides a resilientwindow.toast, and performs guarded service-worker registration with SHA-384 integrity checks.sha256CSP entry so the import map and module imports (e.g.,d3) resolve without violating CSP.docs/alpha_agi_insight_v1/index.htmlto referencebootstrap.js, the inline import map, and the localstyle.cssto ensure offline, CSP-safe startup.Testing
python scripts/verify_demo_pages.pyand the script reported all demos ready, includingalpha_agi_insight_v1(pass).python -m playwright install chromiumand system deps withpython -m playwright install-deps chromiumto enable Playwright checks (completed successfully).pre-commit run --files docs/alpha_agi_insight_v1/index.html docs/alpha_agi_insight_v1/bootstrap.jscould not be executed in this environment because thepre-commitbinary is not installed (not run here).Codex Task