Skip to content

Conversation

@efd6
Copy link
Contributor

@efd6 efd6 commented Nov 4, 2025

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

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works. Where relevant, I have used the stresstest.sh script to run them under stress conditions and race detector to verify their stability.
  • I have added an entry in ./changelog/fragments using the changelog tool.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Logs

@efd6 efd6 self-assigned this Nov 4, 2025
@efd6 efd6 added enhancement Filebeat Filebeat Team:Security-Service Integrations Security Service Integrations Team backport-8.19 Automated backport to the 8.19 branch backport-9.2 Automated backport to the 9.2 branch labels Nov 4, 2025
@botelastic botelastic bot added needs_team Indicates that the issue/PR needs a Team:* label and removed needs_team Indicates that the issue/PR needs a Team:* label labels Nov 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@github-actions
Copy link
Contributor

github-actions bot commented Nov 4, 2025

@efd6 efd6 force-pushed the 15056-cel-httpjson branch from 53a35c0 to 20f9be4 Compare November 4, 2025 03:37
@efd6 efd6 marked this pull request as ready for review November 4, 2025 05:30
@efd6 efd6 requested review from a team as code owners November 4, 2025 05:30
@elasticmachine
Copy link
Collaborator

Pinging @elastic/security-service-integrations (Team:Security-Service Integrations)

@efd6 efd6 requested review from ShourieG, orestisfl and rdner November 4, 2025 05:30
@pierrehilbert pierrehilbert added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Nov 4, 2025
@elasticmachine
Copy link
Collaborator

Pinging @elastic/elastic-agent-data-plane (Team:Elastic-Agent-Data-Plane)

}

func pemPKCS8PrivateKey(pemdata []byte) (any, error) {
func pemPKCS8PrivateKey(pemdata []byte) (crypto.Signer, error) {
Copy link
Contributor

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.

Copy link
Contributor

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 ?

Copy link
Contributor Author

@efd6 efd6 Nov 5, 2025

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)). Here key eventually 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.

Copy link
Contributor

@ShourieG ShourieG left a 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-9.2 Automated backport to the 9.2 branch enhancement Filebeat Filebeat Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team Team:Security-Service Integrations Security Service Integrations Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

x-pack/filebeat/input/{cel,httpjson}: add support for DPoP OAuth for Okta

4 participants