[Bug] Hashicorp KMIP events#19143
Conversation
ReviewersBuildkite won't run for external contributors automatically; you need to add a comment:
NOTE: https://github.com/elastic/integrations/blob/main/.buildkite/pull-requests.json contains all those details. |
…ts to better map the current model
|
Current status: Data normalized and does not generate a crash anymore when searched. Next step: normalize KMIP operation and status to dedicated fields |
|
Pinging @elastic/integration-experience (Team:Integration-Experience) |
…a/elastic-integrations into fix/hashicorp_kmip_event
|
Hello, respectfully pinging @elastic/integration-experience to consider this PR. |
|
👀 I have started reviewing the PR |
|
👀 I have started reviewing the PR |
Resolve thread elastic#19143 (comment)
Resolves thread elastic#19143 (comment)
|
Hello, respectfully pinging @andrewkroh and @elastic/integration-experience to consider this PR |
| - dissect: | ||
| tag: split_source_address_if_contains_port | ||
| field: hashicorp_vault.audit.request.remote_address | ||
| pattern: "%{hashicorp_vault.audit.request.remote_address}:%{hashicorp_vault.audit.request.remote_port}" |
There was a problem hiding this comment.
Severity: 🟡 Medium confidence: medium path: packages/hashicorp_vault/data_stream/audit/elasticsearch/ingest_pipeline/default.yml:681
The new remote_address dissect splits on the first colon, so it mangles IPv6 addresses; anchor the split (or use grok) so only a trailing host:port is separated.
Details
The dissect pattern %{...remote_address}:%{...remote_port} runs whenever remote_address contains a colon and splits on the FIRST colon. Vault emits bare IPv6 client addresses for HTTP audit events (e.g. 2001:db8::1) and bracketed IPv6 host:port for KMIP (e.g. [2001:db8::1]:36776), both of which contain multiple colons. In those cases dissect puts a fragment like 2001 into remote_address and db8::1 into remote_port. The following convert of remote_port to long (guarded by instanceof String) then throws a NumberFormatException, and/or the convert of remote_address to source.ip fails, routing the event to the pipeline on_failure handler. Since the pre-PR pipeline converted remote_address straight to source.ip without splitting, this is a regression for IPv6 clients.
Recommendation:
Use an anchored grok that understands IPv6 brackets and a bare address, instead of a first-colon dissect:
- grok:
tag: split_source_address_if_contains_port
field: hashicorp_vault.audit.request.remote_address
patterns:
- '^\[%{IP:hashicorp_vault.audit.request.remote_address}\]:%{POSINT:hashicorp_vault.audit.request.remote_port}$'
- '^%{IPV4:hashicorp_vault.audit.request.remote_address}:%{POSINT:hashicorp_vault.audit.request.remote_port}$'
- '^%{IP:hashicorp_vault.audit.request.remote_address}$'
ignore_missing: trueThis only strips a trailing port when one is actually present and leaves IPv6 literals intact, so the downstream convert/set for source.ip and source.port continue to work.
🤖 AI-Generated Review | Vera Review Bot | 📚 Knowledge base: integration-skills
⚠️ Automated review — verify suggestions before applying.
Review summaryIssues found across the latest commits 11ad485…f6306d0 (86 commits) — 1 medium
🤖 AI-Generated Review | Vera Review Bot | 📚 Knowledge base: integration-skills
|
Proposed commit message
The PR aims to add support for KMIP events to the HashiCorp Vault integration.
KMIP events are currently handled directly into a flattened field in Elasticsearch. Unfortunately, the recursive structure of the object triggers a JSON exception upon search, making the Elasticsearch query crash.
To fix this issue, I go through the KMIP request and the KMIP response objects to remove the nested arrays structure and to obtain a "clean" JSON object. Request and response headers and data are then stored in their respective fields. Events is finally normalised by processing request/response operation and result. Normalisation relies heavily on the Key Management Interoperability Protocol Specification Version 2.0.
Checklist
changelog.ymlfile.Author's Checklist
How to test this PR locally
Related issues
Screenshots