Fix for #3295 to ensure custom httpjson input with oauth2 auth and explicit scopes definition works#3297
Fix for #3295 to ensure custom httpjson input with oauth2 auth and explicit scopes definition works#3297efd6 merged 4 commits intoelastic:mainfrom colin-stubbs:main
Conversation
Render of auth.oauth2.scopes fails for custom httpjson input, this will fix the issue
| required: false | ||
| - name: oauth_scopes | ||
| type: yaml | ||
| type: text |
There was a problem hiding this comment.
Can you add a test to ensure that this is working as expected? You can construct an endpoint in the packages/httpjson/_dev/deploy/docker/files/config.yml file and make a test in the packages/httpjson/data_stream/generic/_dev/test/system/ directory to check that the scopes are correctly set.
There was a problem hiding this comment.
Hi @efd6 - I've added the variable as per my commit no. 3 ( 3105bd5 ) ... there's nothing to add to the docker config file, I don't know if the stream container which provides a HTTP interface to test against is capable of echo'ing back the requested scopes as a "scope" value in the response, and my quick look at it suggests it isn't... and "scope" in an Oauth2 token response is optional. This should do the trick in terms of testing render of a list of scopes as would be generated by the Kibana/Fleet webUI to the Fleet API though.
There was a problem hiding this comment.
Hmm, actually, my bad, seems like it can
There was a problem hiding this comment.
Still an optional part of the response though... OAuth2 token endpoint doesn't need to include scopes, the assumption is that if a code comes back from a request that include scopes, then the token is valid for those.
There was a problem hiding this comment.
So what you will need to do is write some rules into the packages/httpjson/_dev/deploy/docker/files/config.yml file. This is the configuration for the stream tool.
There was a problem hiding this comment.
That's lovely, where's the actual doco, or is the paying customer who's bug fixing Elastic's product (yes that means me.) supposed to reverse engineer stream tool too? Right now, the product I'm paying Elastic for - multiple platinum and enterprise level subscription Elastic Cloud deployments - can't do what it says it can do. The tests are clearly non-existent at present and I'm not going to burn a bunch of my time creating tests for Elastic's commercial product that I'm paying for, creating something that doesn't currently exist, based on documentation that doesn't exist.
There was a problem hiding this comment.
I can pick this up if you would like.
There was a problem hiding this comment.
TBH, noting "Contributor"... if you're not getting paid for this I don't feel you should burn your time either... is there no Elastic support team that this can be assigned to?
There was a problem hiding this comment.
I am an Elastic employee, so this is something I'm happy to do. If you'd like me to take this on, I can pick it up.
|
/test |
|
Pinging @elastic/security-external-integrations (Team:Security-External Integrations) |
|
/test |
🌐 Coverage report
|
|
/test |
1 similar comment
|
/test |
|
@efd6 - Finally getting time to check status here, thank you Dan |
|
Just waiting on review. |
Render of auth.oauth2.scopes fails for custom httpjson input, this will fix the issue
What does this PR do?
Render of auth.oauth2.scopes fails for custom httpjson input, this will fix the issue #3295
Checklist
changelog.ymlfile.Author's Checklist
None - custom httpjson input with oauth2 explicit scope requirement simply does not work.
How to test this PR locally
Use Custom HTTPJSON input against any Oauth2 authenticated API where scopes must be explicitly defined, e.g. Microsoft Graph Security API.
Related issues
Screenshots
Example API response when input not accepted because YAML format is not detected,
Example API response when input is accepted because YAML is detected, but due to rendering fail nothing is set, note auth.oauth2.scopes is null.