Skip to content

Issues preventing the use of polycentric-core in extension scripts #6

Description

@devNegative-asm

I'm working on a firefox extension meant to integrate with polycentric and I've run into a few issues preventing it from working. Loading with a <script> tag works fine, but there are a couple issues specific to extensions.

  1. A usage of eval in protobufjs violates csp: Use of eval is strongly discouraged protobufjs/protobuf.js#1754. It seems the codepath that hits this eval is entirely unnecessary. This code is extremely suspicious in the first place
  2. cross-fetch doesn't work. I forgot the exact error message, but I believe it had something to do with assigning to fetch (or some other variable), which is treated as readonly in extension scripts.
  3. The function getKeyFromHash from @noble/ed25519 throws an error when calling hashed.slice. Due to globalThis != window in the content script sandbox, calling slice attempts to create an object with incorrect permissions. I haven't checked newer versions of this library, but the issue might be fixed in those.

These are all easily fixed using sed in the generated JS, but firefox extensions require dependencies to not be modified as a submission criterion.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions