Skip to content

feature request: Add a read-only option for the graphql endpoint #2289

@neopunisher

Description

@neopunisher

Describe the problem you're trying to solve

Sometimes you may want to grant a toolbar extension a read-only version of your data (allow graphql queries but not mutations) That way you dont need to worry about them calling a mutation to zap or anything because the chrome extensions are allowed to break CORS and have access to cookies

Describe the solution you'd like

Add a query-string parameter readOnly to /api/graphql that defaults false. It can be picked up by middleware and return a http 403 with an error message of operation not allowed if a mutation operation is detected when readOnly=true

Describe alternatives you've considered

  • We could make an entirely new endpoint like /api/graphql-ro but I didn't like the idea of having a whole new route just for the readonly version.
  • Im not sure how I could do it in the host permission of the extension because it doesn't allow me to restrict the arguments sent
  • Do nothing - I wasn't a fan because I would like people to be able to trust the tool isn't going to be able to steal sats after some update without some alert of permissions changes

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    authfeaturenew product features that weren't there beforepriority:low0.5x

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions