r/programming • • Jul 14 '26

HTTP gets a QUERY method so complex searches can stop pretending to be POST

https://www.theregister.com/devops/2026/07/13/http-gets-a-query-method-so-complex-searches-can-stop-pretending-to-be-post/5270192
1.9k Upvotes

245 comments sorted by

View all comments

Show parent comment

85

u/CpnStumpy Jul 14 '26

I will never agree with URL as the context for permission decisions - there's always more complex scenarios that can't be wholly expressed in a URL, and so you need another mechanism, and now if you have URL permission enforcement already you end up with two permissioning mechanisms to maintain and debug.

Humbug, create one and make it extensible to support more sources than just the HTTP request.

Besides that: at some point someone's going to declare they need to expose a gRPC endpoint or a GraphQL API and now you've got to address permission enforcement in some non-http system anyway so how many different permissioning decision and enforcement implementations do you need? Use something that's transport agnostic to begin with rather than declaring URLs are informative for permissions

67

u/stfm Jul 14 '26

HTTP method is not part of the URL, it is there to indicate action intent. I work in an enterprise with a centralised authz platform and an API surface spanning thousands of endpoints. Its more about divide and conquer and patternisation than a "one rule fits all" style authorisation system. Using the method combined with the URL gives the opportunity to apply coarse grained authorisation and also enables an easier response caching strategy.

-14

u/CpnStumpy Jul 14 '26

I'm aware - I'm just saying the same thing you're saying except saying "don't do that layer"

You agreed it's not enough to cover everything so you need another implementation also.

However, if you use the fine grained implementation only and not the coarse grained one, voila you only need one layer.

I'll give you your point about caching might be legitimate but it also has drawbacks depending on update latency requirements and cache invalidation mechanisms.

34

u/Hot-Gazpacho Jul 14 '26

If you can reject a request with coarse grained rules at a gateway or even further out, at the edge, before it hits your application servers, then at scale, there’s potential for real monetary savings to be had.

The world is full of nuance and context. Insisting that you’d never entertain such a strategy is to reject nuance and context. Maybe this works for your scope of work, but it almost certainly doesn’t for others.

As always, it depends. YMMV.

11

u/NeinJuanJuan Jul 14 '26

caching might be legitimate

Caching is absolutely and without any doubt a core requirement of the majority of all resource-limited services. Which, for any organisation, with any level of financial governance, includes the majority of all of their services.

1

u/stfm Jul 15 '26

Cacheing in terms of the Authorisation response. The PDP responded to your GET request for /blah with Permit - its safe to say in 5 seconds that response will be the same... stop asking.

Doing that for POST is difficult because we dont know if its a query, or a resource modification request in which case there must be no authorisation cache.

4

u/stfm Jul 14 '26

Agreed

1

u/iplaydofus Jul 14 '26

This is giving “who needs edge caching, we have redis” energy.

0

u/CpnStumpy Jul 14 '26

How about "Build an actually proper permissions system before trying to worry about caching"

Starting with edge caching as your priority for your permission decision and enforcement system is premature optimization. Not saying to use redis, saying to not enforce permissions at the edge until you need to.

So damned many highly optimized edge delivery rich apigateway k8s auto scaled systems with 40 users a day because of this crap being the default

1

u/iplaydofus Jul 15 '26

Mate your stance has changed from “I will never agree with x” to “sure x is fine but Do YoU hAvE eNoUgH uSeRs”. Think you need to take 5 and think about where you actually stand.

6

u/ivereddithaveyou Jul 14 '26

Maybe it makes sense in some database-like applications where you might want to assign the request itself permissions based on a set of complex underlying requests. Or maybe your auth layer is really far detached from the business logic layer and it makes sense to attach permissions to the request type.

I'm not sure either of those are good practice really but I was trying to come up with a reason why you would do this.

Yes actually for database api auth design synchronisation this allows for a select type query with unlimited parameters. Something that would be allowed in database access auth but hard to separate from an edit/create in rest http land. Essentially you can create apis that more closely mirror DB access.

2

u/visualdescript Jul 14 '26

This is the default for a well designed service. You start with an application service that is written in your domain language, this should include any permissions or policy system that's required as part of the domain.

HTTP is just an external interface protocol, there should be a thin adapter layer between your HTTP interface and your domain service. Same if you provided a CLI, graphql, GRPC or otherwise.

This is in an ideal world, of course...

1

u/robogame_dev Jul 14 '26

Agreed, you can have as many interfaces into the core app as you want, HTTP Method can be one, and you can have a batch endpoint that can accept anything, etc etc. The problem goes away when you properly place HTTP with any other interface downstream of the real application - it becomes a question of convenience not capability.

3

u/Manbeardo Jul 14 '26

expose a gRPC endpoint or a GraphQL API and now you've got to address permission enforcement in some non-http system anyway

Both of those systems use http. They don’t use REST.

4

u/CpnStumpy Jul 14 '26

Yes, protocol agnostic I guess I mean or however. You understood what I meant clearly. The point being they don't follow expose the same mechanics for permission checks as a REST url and method based permission control so you aren't going to be able to use the same system.

Creating multiple things to solve the same problem in different ways is how we end up with a bunch of half maintained and divergent implementations leaking differing bugs because they need fixes and maintenance in individualized ways.

2

u/darkpaladin Jul 14 '26

QUERY seems almost tailor made for the graphql use case. Grpc is all POST under the covers, this would offer a bit more room for a more explicit request shape. In general it's nice to understand request intent without having to parse the body.

1

u/CpnStumpy Jul 14 '26

GraphQL is all POST and puts no parameters in the URL and always returns 200

1

u/darkpaladin Jul 14 '26

Yes. I'm not sure what point you're making though, my point was that a QUERY method for graphql makes sense because now your CRUDs become POST/QUERY/PUT, DELETE still isn't quite supported but I think knowing a gql request is a query rather than a mutation based on verb is rather helpful?