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

icinga2: Check errors in HTTP status and JSON #208

Merged
merged 1 commit into from
Jun 3, 2024

Conversation

oxzi
Copy link
Member

@oxzi oxzi commented May 31, 2024

The Icinga 2 Event Stream connection did not validate the HTTP status code returned by the server. Consequently, HTTP errors were not identified and their error messages were incorrectly interpreted as valid messages. This occurred in two places: firstly, with regard to the HTTP status code, and secondly, in relation to the error field, which may be present within a JSON struct.

This modification introduces a brief HTTP status validation method that adheres to the specifications outlined in the Icinga 2 API documentation and advanced error checks in UnmarshalEventStreamResponse.

@oxzi oxzi requested a review from yhabteab May 31, 2024 13:42
@cla-bot cla-bot bot added the cla/signed CLA is signed by all contributors of a PR label May 31, 2024
@oxzi oxzi marked this pull request as ready for review May 31, 2024 13:42
internal/icinga2/api_responses.go Outdated Show resolved Hide resolved
internal/icinga2/client_api.go Outdated Show resolved Hide resolved
@oxzi oxzi force-pushed the icinga2-check-http-resp-status branch from 0d3e2ea to 95151a2 Compare May 31, 2024 14:56
@oxzi oxzi requested a review from yhabteab May 31, 2024 14:56
@oxzi oxzi force-pushed the icinga2-check-http-resp-status branch from 95151a2 to 3ebd96d Compare May 31, 2024 15:31
@oxzi oxzi force-pushed the icinga2-check-http-resp-status branch from 3ebd96d to c6e75cf Compare June 3, 2024 08:03
@oxzi oxzi requested a review from yhabteab June 3, 2024 08:03
yhabteab
yhabteab previously approved these changes Jun 3, 2024
Copy link
Member

@yhabteab yhabteab left a comment

Choose a reason for hiding this comment

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

LFTM!

The Icinga 2 Event Stream connection did not validate the HTTP status
code returned by the server. Consequently, HTTP errors were not
identified and their error messages were incorrectly interpreted as
valid messages. This occurred in two places: firstly, with regard to the
HTTP status code, and secondly, in relation to the error field, which
may be present within a JSON struct.

This modification introduces a brief HTTP status validation method that
adheres to the specifications outlined in the Icinga 2 API documentation
and advanced error checks in UnmarshalEventStreamResponse.
@julianbrost julianbrost merged commit b1d7704 into main Jun 3, 2024
12 checks passed
@julianbrost julianbrost deleted the icinga2-check-http-resp-status branch June 3, 2024 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed CLA is signed by all contributors of a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants