-
Notifications
You must be signed in to change notification settings - Fork 5k
x-pack/filebeat/input/{cel,httpjson,internal/dpop}: add support for DPoP OAuth for Okta #47441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🤖 GitHub commentsJust comment with:
|
38c7de4 to
20b7225
Compare
20b7225 to
53a35c0
Compare
🔍 Preview links for changed docs |
…PoP OAuth for Okta
53a35c0 to
20f9be4
Compare
|
Pinging @elastic/security-service-integrations (Team:Security-Service Integrations) |
|
Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane) |
| } | ||
|
|
||
| func pemPKCS8PrivateKey(pemdata []byte) (any, error) { | ||
| func pemPKCS8PrivateKey(pemdata []byte) (crypto.Signer, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since crypto.Signer is now an interface, does it translate back to []byte without any specific method calls ? My concern is for the existing call key, err := pemPKCS8PrivateKey([]byte(pemdata)). Here key eventually translates into the oktaJWT string without any explicit casts or method calls.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to do pemPKCS8PrivateKey([]byte(pemdata)).PublicKey() here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no real change in logic here; the addition at the end is just a safer (non-panicky) assertion, but all the documented returned types from x509.ParsePKCS8PrivateKey except *ecdh.PrivateKey satisfy crypto.Signer. (https://go.dev/play/p/5bvwHEbuuIE) But *ecdh.PrivateKey is not supported by github.com/golang-jwt/jwt/v5, so it's not relevant.
My concern is for the existing call
key, err := pemPKCS8PrivateKey([]byte(pemdata)). Herekeyeventually translates into the oktaJWT string without any explicit casts or method calls.
This cannot be a problem if the returned value from x509.ParsePKCS8PrivateKey satisfies crypto.Signer; the box that holds the value either states that it satisfies crypto.Signer or doesn't say anything (proverbs). The key that's returned is passed into signJWT (as a crypto.Signer) and then on to SignedString as an any, so the path that you are concerned about is entirely untouched.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, from my end
Proposed commit message
See title.
Note
This is initially included in the inputs/internal directory. It may be moved in future if it is needed for other packages that cannot see that import path. The API is unstable at this stage, with planned changes (dependent on the json/v2 experiment outcomes).
Note
Claude was used for some code generation in this PR.
Checklist
stresstest.shscript to run them under stress conditions and race detector to verify their stability../changelog/fragmentsusing the changelog tool.Disruptive User Impact
Author's Checklist
How to test this PR locally
Related issues
Use cases
Screenshots
Logs