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: allow resource.Exec to correctly wait for process completion #383

Merged
merged 3 commits into from
Oct 18, 2022

Conversation

flowchartsman
Copy link
Contributor

@flowchartsman flowchartsman commented Oct 16, 2022

This bug was due to a bug in the vendored client library where StartExec would return early if stderr and stdout were not attached (even if opts.Detatch was false, which is the default. This fix always attaches them and falls back to io.Discard if the user does not provide their own readers.

Related Issue or Design Document

Fixes #372

Checklist

  • I have read the contributing guidelines and signed the CLA.
  • I have referenced an issue containing the design document if my change introduces a new feature.
  • I have read the security policy.
  • I confirm that this pull request does not address a security vulnerability.
    If this pull request addresses a security vulnerability,
    I confirm that I got approval (please contact [email protected]) from the maintainers to push the changes.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added the necessary documentation within the code base (if appropriate).

- This bug was due to a bug in the vendored client library where
  StartExec would return early even if opts.Detatch was true, if stderr
  and stdout were not provided. This fix always attaches them and falls
  back to io.Discard if the user does not provide their own readers.
- See: fsouza/go-dockerclient#838
- Fixes ory#372
@flowchartsman
Copy link
Contributor Author

Looks like my formatter/linter took a couple liberties with an import directive and some octal values. If this chafes, I can redo the PR without them.

@flowchartsman
Copy link
Contributor Author

flowchartsman commented Oct 16, 2022

LOL, if I'd only submitted a few days earlier...
CVE-2022-32149
CVE-2021-38561

@flowchartsman flowchartsman changed the title allow resource.Exec to wait for process completion fix: allow resource.Exec to correctly wait for process completion Oct 16, 2022
@flowchartsman
Copy link
Contributor Author

I think this CI failure is spurious. Nancy doesn't complain when run from the repo with the current recommended invocation:

❯ go list -json -deps ./... | docker run --rm -i sonatypecommunity/nancy:latest sleuth
Checking for updates...
Already up-to-date.
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Summary                      ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━┫
┃ Audited Dependencies    ┃ 23 ┃
┣━━━━━━━━━━━━━━━━━━━━━━━━━╋━━━━┫
┃ Vulnerable Dependencies ┃ 0  ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━┻━━━━┛

I've filed a bug upstream.

@aeneasr aeneasr merged commit 49a59c3 into ory:v3 Oct 18, 2022
@aeneasr
Copy link
Member

aeneasr commented Oct 18, 2022

Awesome, thank you! 🎉 Your contribution makes Ory better :)

@flowchartsman flowchartsman deleted the fix-exec branch October 20, 2022 01:04
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.

Exec should wait for the command to finish before returning
2 participants