Repository navigation
feature request: Add a read-only option for the graphql endpoint #3036
Replies: 2 comments
|
I was thinking if we could limit it based on HTTP method. So if But I guess that wouldn't help with the extension since you can't limit based on HTTP method. But I'm also not sure if adding a param would help? The documentation for match patterns sounds like you can't match params, only paths. Anyway, we have plans to rethink how we authorize requests (more explicit, granular and easier to verify). We will consider this ticket as part of it. |
That wouldn't be optimum because then the query size would be limited by the url length. It would also break my current implementation https://github.com/neopunisher/hn-stacker-ext/blob/main/background.js#L77 that
Once the extension is published the urls in the manifest cannot be changed so if you use |
Uh oh!
There was an error while loading. Please reload this page.
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
readOnlyto/api/graphqlthat defaultsfalse. It can be picked up by middleware and return a http403with an error message ofoperation not allowedif a mutation operation is detected whenreadOnly=trueDescribe alternatives you've considered
/api/graphql-robut I didn't like the idea of having a whole new route just for the readonly version.Additional context
All reactions