Title: [Medium][security] Trusted Types advertised but never wired into DOM-write sinks · Issue #171 · bQuery/bQuery · GitHub
Open Graph Title: [Medium][security] Trusted Types advertised but never wired into DOM-write sinks · Issue #171 · bQuery/bQuery
X Title: [Medium][security] Trusted Types advertised but never wired into DOM-write sinks · Issue #171 · bQuery/bQuery
Description: Severity: 🟡 Medium (false security property + breaks under enforced Trusted Types) Location src/security/trusted-types.ts:63-69, src/security/sanitize.ts:19-33 (JSDoc claims "Uses Trusted Types when available for CSP compliance"); sinks ...
Open Graph Description: Severity: 🟡 Medium (false security property + breaks under enforced Trusted Types) Location src/security/trusted-types.ts:63-69, src/security/sanitize.ts:19-33 (JSDoc claims "Uses Trusted Types whe...
X Description: Severity: 🟡 Medium (false security property + breaks under enforced Trusted Types) Location src/security/trusted-types.ts:63-69, src/security/sanitize.ts:19-33 (JSDoc claims "Uses Trusted Type...
Opengraph URL: https://github.com/bQuery/bQuery/issues/171
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[Medium][security] Trusted Types advertised but never wired into DOM-write sinks","articleBody":"## Severity: 🟡 Medium (false security property + breaks under enforced Trusted Types)\n\n## Location\n[`src/security/trusted-types.ts:63-69`](../blob/main/src/security/trusted-types.ts#L63-L69), [`src/security/sanitize.ts:19-33`](../blob/main/src/security/sanitize.ts#L19-L33) (JSDoc claims \"Uses Trusted Types when available for CSP compliance\"); sinks in [`src/core/dom.ts`](../blob/main/src/core/dom.ts), [`src/view/directives/html.ts:15`](../blob/main/src/view/directives/html.ts#L15), [`src/view/directives/lightweight.ts:42`](../blob/main/src/view/directives/lightweight.ts#L42).\n\n## Description\n`sanitizeHtml` returns a plain **branded string**; `createTrustedHtml`/`getTrustedTypesPolicy` exist but (verified by grep) are **never called by any DOM-write path** — only re-exported. Consequences:\n\n- Under an enforced `require-trusted-types-for 'script'` CSP, every `element.innerHTML = \u003cstring\u003e` / `insertAdjacentHTML(\u003cstring\u003e)` in `dom.ts`/`element.ts`/`collection.ts`/directives **throws**, breaking the framework (fail-closed but non-functional).\n- The documented \"Trusted Types / CSP compliance\" property is absent, which can mislead integrators into assuming a protection layer they do not have.\n\n## Suggested fix\nRoute sink writes through the policy (`createTrustedHtml`) when Trusted Types is supported, falling back to the string path otherwise — so `sanitizeHtml` output actually satisfies an enforced TT policy. Otherwise, correct the documentation to state that TT is not wired into the sinks.\n\n---\n_Filed as part of a full-codebase security \u0026 correctness audit._\n","author":{"url":"https://github.com/JosunLP","@type":"Person","name":"JosunLP"},"datePublished":"2026-07-05T17:03:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/171/bQuery/issues/171"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2a98eea9-7e4b-7055-3bff-03b4a87293ea |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 931A:2EECA8:6B02D6:8FCA07:6A4DA93D |
| html-safe-nonce | a713a0c590a3d5748773c6aa46a9d7e58e13fe408fa6a17bc49b0c83b4677e2e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzFBOjJFRUNBODo2QjAyRDY6OEZDQTA3OjZBNERBOTNEIiwidmlzaXRvcl9pZCI6IjQ4MzgxMTU4ODQzMDcxNjM0NTMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 92d0087c3f3e1e2c0d8d46ed87f2982ba17cb29ff061cc549919a68e86bf999b |
| hovercard-subject-tag | issue:4813694596 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/bQuery/bQuery/171/issue_layout |
| twitter:image | https://opengraph.githubassets.com/cb43fae8ac5fe482a669ad1f906bf44ccbdde69bff87cc7dd6a56edc094adf9e/bQuery/bQuery/issues/171 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/cb43fae8ac5fe482a669ad1f906bf44ccbdde69bff87cc7dd6a56edc094adf9e/bQuery/bQuery/issues/171 |
| og:image:alt | Severity: 🟡 Medium (false security property + breaks under enforced Trusted Types) Location src/security/trusted-types.ts:63-69, src/security/sanitize.ts:19-33 (JSDoc claims "Uses Trusted Types whe... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | JosunLP |
| hostname | github.com |
| expected-hostname | github.com |
| None | 06b8a6144231bf3a234f1c2e9993861e07ce98a905912b114aa386c2d7e84b33 |
| turbo-cache-control | no-preview |
| go-import | github.com/bQuery/bQuery git https://github.com/bQuery/bQuery.git |
| octolytics-dimension-user_id | 256381806 |
| octolytics-dimension-user_login | bQuery |
| octolytics-dimension-repository_id | 1139284244 |
| octolytics-dimension-repository_nwo | bQuery/bQuery |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1139284244 |
| octolytics-dimension-repository_network_root_nwo | bQuery/bQuery |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 47723578ce6819210724ef064c858fce6d3115a3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width