Skip to content

Conversation

@JakubOnderka
Copy link
Contributor

yajl_gen_string doesn't require null terminated string, so we don't need to call strlen.

This simplifies code for JSON transaction logging.

@airween
Copy link
Member

airween commented Apr 22, 2025

Hi @JakubOnderka,

thanks for this PR!

Have you seen the issue #3310? There the OP mentioned a commit - may be we can consider to add that modification too. What do you think?

@airween airween added the 3.x Related to ModSecurity version 3.x label Apr 22, 2025
@airween airween self-assigned this Apr 22, 2025
@JakubOnderka
Copy link
Contributor Author

Good question. So I added test case that verifies if timestamp is correct in JSON format and it looks good.

Sometimes m_httpVersion variable can be empty and then invalid JSON is generated
@sonarqubecloud
Copy link

@JakubOnderka
Copy link
Contributor Author

@airween I also find out that in some cases, JSON log is invalid because m_httpVersion variable is empty string. So I converted http_version field in JSON audit log to string, so if m_httpVersion will be empty, JSON will still be valid.

Copy link
Member

@airween airween left a comment

Choose a reason for hiding this comment

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

LGTM

@airween
Copy link
Member

airween commented May 11, 2025

Hi @JakubOnderka,

a nice catch again - thank you!

@airween airween merged commit aab4709 into owasp-modsecurity:v3/master May 11, 2025
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Related to ModSecurity version 3.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants