docs: add Tluma Ask AI widget to Docusaurus site#5638
Conversation
Wires the Tluma widget into the docs site by setting window.tlumaConfig via headTags and loading widget.js through the scripts option.
Up to standards ✅🟢 Issues
|
There was a problem hiding this comment.
Code Review
The integration is clean and straightforward — using Docusaurus's built-in headTags and scripts options is the right approach here, and async: true correctly avoids blocking page load.
Security Concern: Missing Subresource Integrity (SRI)
The main issue is loading an external script without an SRI hash:
scripts: [
{
src: 'https://tluma.ai/widget.js',
async: true,
// Missing: integrity + crossOrigin
},
],Without an integrity attribute, if Tluma's CDN is ever compromised, malicious JavaScript would silently execute on the TUnit docs site with no browser-level protection. The fix:
scripts: [
{
src: 'https://tluma.ai/widget.js',
async: true,
integrity: 'sha384-<hash>', // compute with: openssl dgst -sha384 -binary widget.js | openssl base64 -A
crossOrigin: 'anonymous',
},
],Why this matters: Third-party supply-chain attacks on CDN-hosted scripts are a real and documented attack vector. For a project documentation site this risk is lower than for an e-commerce checkout, but the cost of adding an SRI hash is zero once computed.
Practical caveat: If Tluma ships updates to widget.js frequently without versioned URLs, SRI becomes maintenance overhead (every update breaks the hash). In that case, consider whether Tluma offers a versioned URL like widget@1.2.3.js, or whether the tradeoff is acceptable given the docs-site context.
Minor: Redundant attributes: {}
headTags: [
{
tagName: 'script',
attributes: {}, // empty — can be omitted entirely
innerHTML: `window.tlumaConfig = { ... }`,
},
],Docusaurus's HeadTag type makes attributes optional; the empty object is harmless but unnecessary noise.
Overall
The approach is idiomatic for Docusaurus and the configuration options look sensible (autoOpen: false, async: true). The SRI concern is worth addressing — whether by adding a hash or by explicitly acknowledging the trust decision — before merging.
Code ReviewThe integration is clean and straightforward — using Docusaurus's built-in Security Concern: Missing Subresource Integrity (SRI)The main issue is loading an external script without an SRI hash: scripts: [
{
src: 'https://tluma.ai/widget.js',
async: true,
// Missing: integrity + crossOrigin
},
],Without an scripts: [
{
src: 'https://tluma.ai/widget.js',
async: true,
integrity: 'sha384-<hash>', // compute with: openssl dgst -sha384 -binary widget.js | openssl base64 -A
crossOrigin: 'anonymous',
},
],Why this matters: Third-party supply-chain attacks on CDN-hosted scripts are a real and documented attack vector. For a project documentation site the risk is lower than for an e-commerce checkout, but the cost of adding an SRI hash is zero once computed. Practical caveat: If Tluma ships updates to Minor: Redundant
|
Updated [TUnit](https://github.com/thomhurst/TUnit) from 1.37.10 to 1.39.0. <details> <summary>Release notes</summary> _Sourced from [TUnit's releases](https://github.com/thomhurst/TUnit/releases)._ ## 1.39.0 <!-- Release notes generated using configuration in .github/release.yml at v1.39.0 --> ## What's Changed ### Other Changes * perf(mocks): shrink MethodSetup + cache stateless matchers by @thomhurst in thomhurst/TUnit#5669 * fix(mocks): handle base classes with explicit interface impls (#5673) by @thomhurst in thomhurst/TUnit#5674 * fix(mocks): implement indexer in generated mock (#5676) by @thomhurst in thomhurst/TUnit#5683 * fix(mocks): disambiguate IEquatable<T>.Equals from object.Equals (#5675) by @thomhurst in thomhurst/TUnit#5680 * fix(mocks): escape C# keyword identifiers at all emit sites (#5679) by @thomhurst in thomhurst/TUnit#5684 * fix(mocks): emit [SetsRequiredMembers] on generated mock ctor (#5678) by @thomhurst in thomhurst/TUnit#5682 * fix(mocks): skip MockBridge for class targets with static-abstract interfaces (#5677) by @thomhurst in thomhurst/TUnit#5681 * chore(mocks): regenerate source generator snapshots by @thomhurst in thomhurst/TUnit#5691 * perf(engine): collapse async state-machine layers on hot test path (#5687) by @thomhurst in thomhurst/TUnit#5690 * perf(engine): reduce lock contention in scheduling and hook caches (#5686) by @thomhurst in thomhurst/TUnit#5693 * fix(assertions): prevent implicit-to-string op from NREing on null (#5692) by @thomhurst in thomhurst/TUnit#5696 * perf(engine/core): reduce per-test allocations (#5688) by @thomhurst in thomhurst/TUnit#5694 * perf(engine): reduce message-bus contention on test start (#5685) by @thomhurst in thomhurst/TUnit#5695 ### Dependencies * chore(deps): update tunit to 1.37.36 by @thomhurst in thomhurst/TUnit#5667 * chore(deps): update verify to 31.16.2 by @thomhurst in thomhurst/TUnit#5699 **Full Changelog**: thomhurst/TUnit@v1.37.36...v1.39.0 ## 1.37.36 <!-- Release notes generated using configuration in .github/release.yml at v1.37.36 --> ## What's Changed ### Other Changes * fix(telemetry): remove duplicate HTTP client spans by @thomhurst in thomhurst/TUnit#5668 **Full Changelog**: thomhurst/TUnit@v1.37.35...v1.37.36 ## 1.37.35 <!-- Release notes generated using configuration in .github/release.yml at v1.37.35 --> ## What's Changed ### Other Changes * Add TUnit.TestProject.Library to the TUnit.Dev.slnx solution file by @Zodt in thomhurst/TUnit#5655 * fix(aspire): preserve user-supplied OTLP endpoint (#4818) by @thomhurst in thomhurst/TUnit#5665 * feat(aspire): emit client spans for HTTP by @thomhurst in thomhurst/TUnit#5666 ### Dependencies * chore(deps): update dependency dotnet-sdk to v10.0.203 by @thomhurst in thomhurst/TUnit#5656 * chore(deps): update microsoft.aspnetcore to 10.0.7 by @thomhurst in thomhurst/TUnit#5657 * chore(deps): update tunit to 1.37.24 by @thomhurst in thomhurst/TUnit#5659 * chore(deps): update microsoft.extensions to 10.0.7 by @thomhurst in thomhurst/TUnit#5658 * chore(deps): update aspire to 13.2.3 by @thomhurst in thomhurst/TUnit#5661 * chore(deps): update dependency microsoft.net.test.sdk to 18.5.0 by @thomhurst in thomhurst/TUnit#5664 ## New Contributors * @Zodt made their first contribution in thomhurst/TUnit#5655 **Full Changelog**: thomhurst/TUnit@v1.37.24...v1.37.35 ## 1.37.24 <!-- Release notes generated using configuration in .github/release.yml at v1.37.24 --> ## What's Changed ### Other Changes * docs: add Tluma Ask AI widget to Docusaurus site by @thomhurst in thomhurst/TUnit#5638 * Revert "chore(deps): update dependency docusaurus-plugin-llms to ^0.4.0 (#5637)" by @thomhurst in thomhurst/TUnit#5640 * fix(asp-net): forward disposal in FlowSuppressingHostedService (#5651) by @JohnVerheij in thomhurst/TUnit#5652 ### Dependencies * chore(deps): update dependency docusaurus-plugin-llms to ^0.4.0 by @thomhurst in thomhurst/TUnit#5637 * chore(deps): update tunit to 1.37.10 by @thomhurst in thomhurst/TUnit#5639 * chore(deps): update opentelemetry to 1.15.3 by @thomhurst in thomhurst/TUnit#5645 * chore(deps): update opentelemetry by @thomhurst in thomhurst/TUnit#5647 * chore(deps): update dependency dompurify to v3.4.1 by @thomhurst in thomhurst/TUnit#5648 * chore(deps): update dependency system.commandline to 2.0.7 by @thomhurst in thomhurst/TUnit#5650 * chore(deps): update dependency microsoft.entityframeworkcore to 10.0.7 by @thomhurst in thomhurst/TUnit#5649 * chore(deps): update dependency microsoft.templateengine.authoring.cli to v10.0.203 by @thomhurst in thomhurst/TUnit#5653 * chore(deps): update dependency microsoft.templateengine.authoring.templateverifier to 10.0.203 by @thomhurst in thomhurst/TUnit#5654 **Full Changelog**: thomhurst/TUnit@v1.37.10...v1.37.24 Commits viewable in [compare view](thomhurst/TUnit@v1.37.10...v1.39.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Summary
window.tlumaConfigviaheadTagswith the provided source/theme/brand settingshttps://tluma.ai/widget.jsasynchronously via thescriptsoptionConfigtypes remain validTest plan
cd docs && npm run buildsucceeds with no TypeScript errorscd docs && npm startserves the site locally with the Tluma launcher button visible in the bottom-right cornerthomhurst/tunit