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

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

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

graebm
Copy link
Contributor

@graebm graebm commented Sep 5, 2024

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
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@graebm graebm merged commit e930f1a into main Sep 6, 2024
30 checks passed
@graebm graebm deleted the stderr-bug branch September 6, 2024 16:24
graebm added a commit to awslabs/aws-crt-java that referenced this pull request Sep 6, 2024
**Issue:**
If the external process logged to stderr during a normal successful run, the credentials would fail to parse

**Description of changes:**
Update submodules, latest version of aws-c-auth contains the fix, see: awslabs/aws-c-auth#250
```
aws-c-cal          v0.7.3 -> v0.7.4
aws-c-auth         v0.7.25 -> v0.7.29
```
graebm added a commit that referenced this pull request Oct 14, 2024
**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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants