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

ExitState.ServiceOutput is (incorrectly) interpreted as containing format specifier #139

Closed
atc0005 opened this issue Sep 15, 2022 · 1 comment · Fixed by #141
Closed
Assignees
Labels
bug Something isn't working output/plugin plugin output intended for monitoring system ingest
Milestone

Comments

@atc0005
Copy link
Owner

atc0005 commented Sep 15, 2022

As noted in atc0005/check-vmware#725 (comment), the v0.9.1 release contains an unintentional change that attempts to apply formatting to literal content. The regression reappeared in the v0.9.0 release.

As of the v0.8.2 release (correct):

go-nagios/nagios.go

Lines 272 to 277 in 8d5ac27

// One-line output used as the summary or short explanation for the
// specific Nagios state that we are returning. We apply no formatting
// changes to this content, simply emit it as-is. This helps avoid
// potential issues with literal characters being interpreted as
// formatting verbs.
fmt.Print(es.ServiceOutput)

As of the v0.9.1 release (incorrect):

go-nagios/nagios.go

Lines 335 to 340 in 3d6cd8f

// One-line output used as the summary or short explanation for the
// specific Nagios state that we are returning. We apply no formatting
// changes to this content, simply emit it as-is. This helps avoid
// potential issues with literal characters being interpreted as
// formatting verbs.
fmt.Fprintf(&output, es.ServiceOutput)

This produces unexpected results when preformatted ServiceOutput content is subjected to another formatting attempt.

@atc0005 atc0005 added bug Something isn't working output/plugin plugin output intended for monitoring system ingest labels Sep 15, 2022
@atc0005 atc0005 added this to the Next Release milestone Sep 15, 2022
@atc0005 atc0005 self-assigned this Sep 15, 2022
@atc0005
Copy link
Owner Author

atc0005 commented Sep 15, 2022

atc0005 added a commit that referenced this issue Sep 15, 2022
Fix unintentional handling of Service Output from client code as
potentially containing formatt specifier (i.e., formatting
"verbs") by explicitly emitting content as-is.

This fixes a regression introduced by the v0.9.0 release that
was introduced by bulk refactoring work.

refs GH-139
refs GH-58
@atc0005 atc0005 changed the title ExitState.ServiceOutput is (incorrectly) interpreted as containing format specifier ExitState.ServiceOutput is (incorrectly) interpreted as containing format specifier Sep 15, 2022
atc0005 added a commit that referenced this issue Sep 16, 2022
Revert (temporarily) to invalid behavior for Service Output
handling, provide test case to help prevent further regressions
in the future.

refs GH-139
refs GH-58
atc0005 added a commit that referenced this issue Sep 16, 2022
Restore handling of Service Output to the intended "as-is"
or "passthrough" logic so that literal text is not
unintentionally processed as a formatting specifier string.

refs GH-139
refs GH-58
atc0005 added a commit that referenced this issue Sep 16, 2022
Revert (temporarily) to invalid behavior for Service Output
handling, provide test case to help prevent further regressions
in the future.

refs GH-139
refs GH-58
atc0005 added a commit that referenced this issue Sep 16, 2022
Restore handling of Service Output to the intended "as-is"
or "passthrough" logic so that literal text is not
unintentionally processed as a formatting specifier string.

refs GH-139
refs GH-58
atc0005 added a commit that referenced this issue Sep 16, 2022
Restore handling of Service Output to the intended "as-is"
or "passthrough" logic so that literal text is not
unintentionally processed as a formatting specifier string.

refs GH-139
refs GH-58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working output/plugin plugin output intended for monitoring system ingest
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant