Inline event handlers in sub-app HTML survive the build: dead under CSP, and a dark-mode leak without it
メンテナーはふだん 1 日以内に返信
@oto-macenauer-absa がすでに取り組んでいます。
2026年8月14日 から。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 50/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- html, javascript
調査の方向性
Start in src/utils/transform.js, where inline <script> handling is implemented, and add policy logic for on* event attributes in the same transform pipeline. Check scripts/hoist-inline-scripts.js and the docs-example onclick snippet for expected behavior, then extend tests/build-integrity.spec.js so it asserts the output has no inline event-handler attributes. Update contract/HEADLESS_RULES.md accordingly; done means tests pass and the new invariant is documented in that rule file.
索引モデルが issue の本文から書いたものです。
説明
Summary
The "nothing inline in the output" invariant is enforced for <script> elements only. Inline event-handler attributes are neither hoisted nor stripped, and script-src 'self' blocks them exactly like an inline script.
The vendored docs-example fixture ships one, and it reaches dist/:
<button id="theme-toggle" aria-label="Toggle theme" onclick="
const r=document.getElementById('docs-root');
r.classList.toggle('dark');
localStorage.setItem('theme',r.classList.contains('dark')?'dark':'light');
">
Two problems
- It is dead code in production.
script-src 'self'with no'unsafe-inline'blocks inline handlers, so the button is inert and logs a CSP violation when clicked.scripts/hoist-inline-scripts.jsexists precisely so that already-published bundles keep working under the policy; it does not cover this case, so any doc app whose interactivity is written asonclick=is quietly broken instead. - It is a light-only leak wherever the CSP is absent.
astro devandastro previewserve no CSP, so there the toggle works and addsdarkto the sub-app root — the exact thingtransform.jsstrips the theme bootstrap to prevent (#48).
tests/build-integrity.spec.js asserts every <script> has a src, which is why this got through. Nothing asserts on on* attributes.
Suggested fix
Decide between the two available policies and apply it in src/utils/transform.js, where the document is already parsed:
- Strip
on*attributes. Honest about what production does — the handler cannot run anyway — and closes the dev-mode dark leak. Cost: a doc app's inline interactivity disappears rather than failing loudly. - Hoist them, the way
<script>bodies are hoisted: turnonclick="…"into a listener registered from a generated file. Preserves behaviour, but needs a stable element handle and is a good deal more machinery.
Either way, add the assertion to tests/build-integrity.spec.js so the invariant covers attributes and not just elements, and say so in contract/HEADLESS_RULES.md — this is a rule onboarding repositories need to know about.
Separately worth deciding whether the docs-example fixture should keep shipping a dark-mode toggle at all, given the marketplace is light-only.
- 主要言語
- JavaScript
- スター
- 0
- フォーク
- 0
- 平均マージ
- 55分
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
AbsaOSS/knowledge-base のほかの issue
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
AbsaOSS/knowledge-base#118 ·
メンテナーはふだん 1 日以内に返信
-
feat: expose knowledge-base documentation through an MCP server対応中かも @oto-macenauer-absa が 13 日前に担当しました。 オープンenhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
AbsaOSS/knowledge-base#117 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 52/100
AbsaOSS/knowledge-base#114 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
AbsaOSS/knowledge-base#113 ·
メンテナーはふだん 1 日以内に返信
-
Dynamic responsive masthead menu from documentation manifests対応中かも @oto-macenauer-absa が 17 日前に担当しました。 オープンenhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
AbsaOSS/knowledge-base#111 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
AbsaOSS/knowledge-base の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
sallowayma-git/IELTS-practice#248 ·
メンテナーはふだん 1 日以内に返信
-
a11y data import fails with "missing --authors parameter" (npm drops flags in `bin/configure.js`)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Emanuele-web04/remodex#203 ·
メンテナーはふだん 1 日以内に返信
-
needs-human work-class: mechanical
難易度 2/5 半日 初心者へのやさしさ 84/100
melodic-software/claude-code-plugins#7994 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
keyxmakerx/Chronicle#1532 ·
メンテナーはふだん 1 日以内に返信