sarkaramrit1993 commented on PR #4916:
URL: https://github.com/apache/solr/pull/4916#issuecomment-7060887172

   I've pushed three more permission fixes to the branch. I found them by 
running every endpoint against v1 on the same configs.
   
   - **Misspelled permission fields were dropped** 
([fix](https://github.com/apache/solr/pull/4916/commits/0a347971e2c771f4aa5846e510bee069b675eeda)).
 `POST /permissions` with `"collections": ["c1"]` returned 200 and stored a 
`read` permission with no `collection`, so it matched every collection. v1 
`set-permission` [rejects the same 
body](https://github.com/apache/solr/blob/acdee50e7b9a1d1418b4145a5396d0f83bc7912a/solr/core/src/java/org/apache/solr/security/AutorizationEditOperation.java#L70-L71).
 Unknown fields now reach that check and get the same 400 (`Unknown key, 
collections`). An `index` in a create body is ignored, since `set-permission` 
would treat it as an overwrite. The generated OpenAPI spec and SolrJ classes 
don't change.
   - **Permissions without a stored `index` couldn't be edited** 
([fix](https://github.com/apache/solr/pull/4916/commits/a283e89b638131e8b62cd2a7a6b18d2aecd8b367)).
 On the bundled `security.json`, GET showed no `index` and PUT or DELETE 
returned 404 until the first write. v2 now numbers them by position the way v1 
does, without writing on read. This also fixes the Admin UI calling 
`/permissions/undefined`. It was blocker 2 in [my October 
review](https://github.com/apache/solr/pull/4916#pullrequestreview-5477474529), 
and I should have fixed it in the earlier batch.
   - **A path index below 1 now returns 404** 
([fix](https://github.com/apache/solr/pull/4916/commits/27523fcf16d41bba45eee58fb2cc7de96dc8efb7)).
 v1 [treats any non-numeric stored `index` as 
`-1`](https://github.com/apache/solr/blob/acdee50e7b9a1d1418b4145a5396d0f83bc7912a/solr/core/src/java/org/apache/solr/security/AutorizationEditOperation.java#L184-L187),
 so `PUT /permissions/-1` could reach entries GET never listed there.
   
   Eric, thanks for your point that the logic should live in v2, with v1 
adapting. These fixes still lean on v1 for validation, like the rest of 
`Permissions`, so behaviour matches v1 for now. The positional numbering is a 
short copy of v1's rule, and it goes away once v2 moves to the stable ids from 
[#5320](https://github.com/apache/solr/pull/5320).
   
   I also merged `main` into the branch.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to