Inline event handlers in sub-app HTML survive the build: dead under CSP, and a dark-mode leak without it
Les mainteneurs répondent en général sous 1 jour
@oto-macenauer-absa y travaille déjà.
Depuis le 14/8/2026.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 50/100
- Type d'issue
- Bug
- Clarté
- Plutôt claire
- Activité
- Calme
- Stack technique
- html, javascript
- Domaine
- build-system, documentation
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- JavaScript
- Étoiles
- 0
- Forks
- 0
- Merge moyen
- 55 min
- PR mergées (30 j)
- 10
Préparer son environnement
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de AbsaOSS/knowledge-base
-
enhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 30/100
AbsaOSS/knowledge-base#118 ·
Les mainteneurs répondent en général sous 1 jour
-
feat: expose knowledge-base documentation through an MCP serverPeut-être pris @oto-macenauer-absa l’a pris il y a 11 jours. Ouverteenhancement
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
AbsaOSS/knowledge-base#117 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
AbsaOSS/knowledge-base#114 · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
AbsaOSS/knowledge-base#113 ·
Les mainteneurs répondent en général sous 1 jour
-
Dynamic responsive masthead menu from documentation manifestsPeut-être pris @oto-macenauer-absa l’a pris il y a 15 jours. Ouverteenhancement
Difficulté 4/5 3-5 jours Accessibilité débutants 48/100
AbsaOSS/knowledge-base#111 · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de AbsaOSS/knowledge-base
Issues similaires
-
documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
andromarces/agent-loops#886 ·
Les mainteneurs répondent en général sous 1 jour
-
bug effort:low model:light plan planner:gpt-6-1-sol tests
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
B: visual
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
FreeTubeApp/FreeTube#9929 ·
Les mainteneurs répondent en général sous 1 jour
-
🐛 Bug: `--clear-screen` not very useful (at least not for dealing with large test/error output)Ouvertestatus: in triage type: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 62/100
mochajs/mocha#6428 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Fixed-position outer <svg> lands outside a clip after scroll; fixed HTML boxes are re-anchoredOuverte🔧 in development
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100