Skip to content

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Jun 26, 2025

  • fix: allow injection of trustless config
  • test: ensure injected config works as expected

Title

fix: allow injection of trustless config

Description

Allows injection of config that is considered untrusted, but only overrides settings that are allowed to be overridden.

We do not allow injection of URLs if the config is considered untrusted.

See discussion at ipfs/helia#824 for more details

Notes & open questions

This PR also removes the dependency on lz-string, reducing initial javascript loaded by about 10kb, but increases size of the ipfs-sw-cfg content by about 200 bytes. This should result in a net reduction in bandwidth usage.

  • bandwidth used was +10kb for every new subdomain + 10kb for uncached root domain js.
  • bandwidth used is now reduced by 10kb-200bytes for every new subdomain after redirect dance, -10kb for any uncached root domain js

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

Copy link
Member Author

@SgtPooki SgtPooki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self review

@SgtPooki SgtPooki merged commit 470dab7 into main Jun 29, 2025
17 checks passed
@SgtPooki SgtPooki deleted the fix/allow-injection-of-safe-config branch June 29, 2025 14:04
@SgtPooki SgtPooki linked an issue Jun 29, 2025 that may be closed by this pull request
@2color
Copy link
Member

2color commented Aug 21, 2025

@SgtPooki Any chance you can document how to inject config, e.g. disabling fallback on recursive gateways?

This came up in a discussion with @dennis-tra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: invalid config results in user stuck on loading screen
2 participants