[ 
https://issues.apache.org/jira/browse/SOLR-13835?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16949629#comment-16949629
 ] 

Chris M. Hostetter commented on SOLR-13835:
-------------------------------------------

Jan: Maybe i'm missing something, but IIUC in the context of how simple those 
blocks were when the code was initially added, it was reasonable for the first 
block to fall through to the second:

Back when the code was introduced in SOLR-7757:
 * If authResp.status == PROMPT: do some logging specific to the authResp, and 
add some HTTP response headers specified by the auth plugin
 * If authResp.status != OK: sendError(authResp.status)
 ** ie: it didn't matter if the authResp.status was PROMPT, or FORBIDDEN, or 
anything else ... it wasn't ok so send an error with

...it's only as a result of changes introduced since then (with the addition of 
audit logging to each of the conditionals) that we now have a bug in the form 
of multiple Audit Events when authResp is PROMPT.

IIUC: from the perspective of the external client the behavior is still 
entirely correct either way, it's only if/how an AuditLogger plugin is used and 
what it expects that seems to be at risk.

(particularly since the AuthorizationPlugin API seems open enough (ie: there is 
no fixed enum of  authResponse.statusCode values)  that a custom plugin could 
return a lot of diff non-200/202 error codes that the AuditLogger would all 
report as "UNAUTHORIZED")

> HttpSolrCall produces incorrect extra AuditEvent on 
> AuthorizationResponse.PROMPT
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-13835
>                 URL: https://issues.apache.org/jira/browse/SOLR-13835
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: Authentication, Authorization
>            Reporter: Chris M. Hostetter
>            Priority: Major
>
> spinning this out of SOLR-13741...
> {quote}
> Wrt the REJECTED + UNAUTHORIZED events I see the same as you, and I believe 
> there is a code bug, not a test bug. In HttpSolrCall#471 in the 
> {{authorize()}} call, if authResponse == PROMPT, it will actually match both 
> blocks and emit two audit events: 
> [https://github.com/apache/lucene-solr/blob/26ede632e6259eb9d16861a3c0f782c9c8999762/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java#L475:L493]
>  
> {code:java}
> if (authResponse.statusCode == AuthorizationResponse.PROMPT.statusCode) {...}
> if (!(authResponse.statusCode == HttpStatus.SC_ACCEPTED) && 
> !(authResponse.statusCode == HttpStatus.SC_OK)) {...}
> {code}
> When code==401, it is also true that code!=200. Intuitively there should be 
> both a sendErrora and return RETURN before line #484 in the first if block?
> {quote}
> This causes any and all {{REJECTED}} AuditEvent messages to be accompanied by 
> a coresponding {{UNAUTHORIZED}} AuditEvent.  
> It's not yet clear if, from the perspective of the external client, there are 
> any other bugs in behavior (TBD)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to