Skip to content

[akamai] Fix Pipeline for Populating Http Message Headers#18205

Merged
mohitjha-elastic merged 4 commits intoelastic:mainfrom
mohitjha-elastic:akamai-3.1.1
Apr 8, 2026
Merged

[akamai] Fix Pipeline for Populating Http Message Headers#18205
mohitjha-elastic merged 4 commits intoelastic:mainfrom
mohitjha-elastic:akamai-3.1.1

Conversation

@mohitjha-elastic
Copy link
Copy Markdown
Collaborator

@mohitjha-elastic mohitjha-elastic commented Apr 2, 2026

Proposed commit message

akamai: fix pipeline for populating http message headers.

The Ingest pipeline failed when responseHeaders or requestHeaders could not be parsed 
as Name: value lines, including Akamai’s {p} placeholder and RFC 7230 obs-fold continuations
(e.g. folded Content-Security-Policy). Non-parseable string values are dropped with a remove 
processor when the field contains no colon, so the KV step is not run on placeholders.
Obs-fold sequences (\r\n followed by space or tab) are normalized to a single space with 
gsub before KV, which matches the spec’s treatment of folded linear whitespace.

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.
  • I have verified that any added dashboard complies with Kibana's Dashboard good practices

How to test this PR locally

  • Clone integrations repo.
  • Install the elastic package locally.
  • Start the elastic stack using the elastic package.
  • Move to integrations/packages/akamai directory.
  • Run the following command to run tests.

elastic-package test -v

@mohitjha-elastic mohitjha-elastic self-assigned this Apr 2, 2026
@mohitjha-elastic mohitjha-elastic requested a review from a team as a code owner April 2, 2026 13:16
@mohitjha-elastic mohitjha-elastic added Integration:akamai Akamai (Community supported) bugfix Pull request that fixes a bug issue Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations] Team:SDE-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] labels Apr 2, 2026
@elasticmachine
Copy link
Copy Markdown

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

@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

elastic-vault-github-plugin-prod bot commented Apr 2, 2026

🚀 Benchmarks report

To see the full report comment with /test benchmark fullreport

Copy link
Copy Markdown
Contributor

@chrisberkhout chrisberkhout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put some comments about issues in the current implementation, but I think it would be better to switch to a different implementation that keeps the header values the same by placing some markers to support key-value splitting, rather than removing tricky content from the actual values. There's an implementation of that here:

- gsub:
if: ctx.json?.event?.Headers == null
description: "Fix field separator to support KVP extraction"
field: _tmp.HeadersText
ignore_missing: true
pattern: '],\[Key: '
replacement: ',##'
- kv:
if: ctx.json?.event?.Headers == null
description: "Extract headers as key value pairs."
field: _tmp.HeadersText
ignore_missing: true
ignore_failure: true
field_split: ',##'
value_split: ', values: '
target_field: json.event.Headers
trim_key: ' '
trim_value: ' '
strip_brackets: true

Comment thread packages/akamai/data_stream/siem/elasticsearch/ingest_pipeline/default.yml Outdated
Comment thread packages/akamai/data_stream/siem/elasticsearch/ingest_pipeline/default.yml Outdated
Comment thread packages/akamai/data_stream/siem/elasticsearch/ingest_pipeline/default.yml Outdated
Comment thread packages/akamai/data_stream/siem/elasticsearch/ingest_pipeline/default.yml Outdated
1. Switch to gsub and kv only style.
2. Remove the script.
@mohitjha-elastic
Copy link
Copy Markdown
Collaborator Author

Thanks @chrisberkhout
I’ve switched to the gsub + kv–only style for obs-fold handling, without a follow-up script.

Non-parseable placeholders (e.g. {p}) are dropped with a remove processor when the string contains no :``, replacing the earlier painless blocks.
This keeps the pipeline to ingest processors only for the folding path (no marker round-trip script) while still avoiding KV failures on folded CSP-style headers.

Please review the updated pipeline logic and let me know what you think.

@elasticmachine
Copy link
Copy Markdown

💚 Build Succeeded

History

cc @mohitjha-elastic

Copy link
Copy Markdown
Contributor

@chrisberkhout chrisberkhout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the suggested improvements!

I originally misunderstood the gsub. Replacing \r\n[\t ]+ with a single space gives us the original value by removing the obsolete line folding ( "obs-fold") defined in RFC 7230. That normalization doesn't change the semantic value, it just converts from the folded presentation into the canonical single-line form. So that's what we want.

@mohitjha-elastic mohitjha-elastic merged commit b8726d6 into elastic:main Apr 8, 2026
14 checks passed
@mohitjha-elastic mohitjha-elastic deleted the akamai-3.1.1 branch April 8, 2026 06:07
@elastic-vault-github-plugin-prod
Copy link
Copy Markdown

Package akamai - 3.1.1 containing this change is available at https://epr.elastic.co/package/akamai/3.1.1/

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

Labels

bugfix Pull request that fixes a bug issue Integration:akamai Akamai (Community supported) Team:SDE-Crest Crest developers on the Security Integrations team [elastic/sit-crest-contractors] Team:Security-Service Integrations Security Service Integrations team [elastic/security-service-integrations]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants