awslabs / aws-c-auth

C99 library implementation of AWS client-side authentication: standard credentials providers and signing.
Apache License 2.0
41 stars 32 forks source link

When sourcing credentials from an external process, ignore stderr #250

Closed graebm closed 2 months ago

graebm commented 2 months ago

Issue: If the external process logged to stderr during a normal successful run, the credentials would fail to parse.

This was happening because the credentials-provider would always combine stderr and stdout by appending 2>&1 to the external command. Then JSON parsing would fail, due to random lines of logging on stderr mixing with valid JSON on stdout.

Description of changes: Instead of redirecting stderr to stdout, redirect it to /dev/null.

It would be better to capture stderr separately, and display it if the external process fails. But aws_process_run() doesn't currently capture stderr, and would require a rework to do so.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 80.36%. Comparing base (3281f86) to head (c19df6f).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #250 +/- ## ======================================= Coverage 80.36% 80.36% ======================================= Files 33 33 Lines 6044 6044 ======================================= Hits 4857 4857 Misses 1187 1187 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.