Skip to content
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

Fix HTTP POST 2, now json-escaping all strings replaced by the jinja2 template #898

Merged
merged 5 commits into from
Jul 4, 2022

Conversation

ddurham2
Copy link
Contributor

@ddurham2 ddurham2 commented Jul 1, 2022

Description

For HTTP POST 2, now json-escaping all strings replaced by the jinja2 template in the json which otherwise leads to a syntax error in the json which will not deserialize properly. See #896 for more details on what was happening.

Will it break anything? Before the fix, if a matched event's value contained a newline (or any other control chars that json escapes) and if that value was included in the jinja2 template, the json of the post body could not be generated, because it would internally attempt to deserialize a now-invalid json string.

If anyone else in the field had encountered this problem, they may have worked around it by including already-escaped values before sending into elastic search (which would affect any other downstream processors of the event, needing to know to undo that hack to the value). This fix should address the internal-processing problem in elastalert once and for all, but users would need to read the changelog and stop doing their work-around as they upgrade.

Checklist

  • I have reviewed the contributing guidelines.
  • I have included unit tests for my changes or additions.
  • I have successfully run make test-docker with my changes.
  • I have manually tested all relevant modes of the change in this PR.
  • I have updated the documentation.
  • I have updated the changelog.

Questions or Comments

No changes needed to docs necessary.

… template in the json which otherwise leads to a syntax error in the json which will not deserialize properly
@ddurham2 ddurham2 changed the title For HTTP POST 2, now json-escaping all strings replaced by the jinja2 template Fix HTTP POST 2, now json-escaping all strings replaced by the jinja2 template Jul 1, 2022
@jertel
Copy link
Owner

jertel commented Jul 4, 2022

Looks good, thanks again!

@jertel jertel merged commit c9dc481 into jertel:master Jul 4, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants