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: Set exitcode of secrets-config for command execution errors #4418

Merged
merged 1 commit into from
Mar 9, 2023
Merged

fix: Set exitcode of secrets-config for command execution errors #4418

merged 1 commit into from
Mar 9, 2023

Conversation

bnevis-i
Copy link
Collaborator

@bnevis-i bnevis-i commented Mar 7, 2023

Closes #4337

PR Checklist

Please check if your PR fulfills the following requirements:

  • I am not introducing a breaking change (if you are, flag in conventional commit message with BREAKING CHANGE: describing the break)
  • I am not introducing a new dependency (add notes below if you are)
  • I have added unit tests for the new feature or bug fix (if not, why?)
  • I have fully tested (add details below) this the new feature or bug fix (if not, why?)
  • I have opened a PR for the related docs change (if not, why?)

Testing Instructions

See use cases in #4337 for sample test cases to try to verify issue is fixed.

New Dependency Instructions (If applicable)

Closes #4337

Signed-off-by: Bryon Nevis <bryon.nevis@intel.com>
@sonarcloud
Copy link

sonarcloud bot commented Mar 7, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@bnevis-i bnevis-i requested a review from farshidtz March 7, 2023 22:48
@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Mar 7, 2023

@farshidtz Please review this one-line fix.

Copy link
Member

@farshidtz farshidtz left a comment

Choose a reason for hiding this comment

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

I can't reproduce any of the previous errors because that functionality no longer exists.
I did do some sanity checks and the error codes seem correct.

@farshidtz
Copy link
Member

farshidtz commented Mar 9, 2023

I don't know if this is a bug or feature. I noticed that the -jwtTTL takes both integer and go duration but not sure they both get accepted or if one is ignored.

$ sudo edgexfoundry.secrets-config proxy adduser --user example -useRootToken -jwtTTL 4
{"username":"example","password":"TYMMvc80BGdqYOu55VPIru8z4Ibr/ryytopuzd5nAQ2X"}

$ sudo edgexfoundry.secrets-config proxy adduser --user example -useRootToken -jwtTTL 4h
{"username":"example","password":"Kx2mBBwYRXo9HOC7SUUPrlrYoQowexC/S5k7rie32cNG"}

Given the description below, I expect only Go duration to be supported. Go's time.Duration rejects integer input: https://go.dev/play/p/E9nNy8Sw7pi

  -jwtTTL string
    	JWT created by vault identity provider lasts this long (default "1h")

@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Mar 9, 2023

I don't know if this is a bug or feature. I noticed that the -jwtTTL takes both integer and go duration but not sure they both get accepted or if one is ignored.

$ sudo edgexfoundry.secrets-config proxy adduser --user example -useRootToken -jwtTTL 4
{"username":"example","password":"TYMMvc80BGdqYOu55VPIru8z4Ibr/ryytopuzd5nAQ2X"}

$ sudo edgexfoundry.secrets-config proxy adduser --user example -useRootToken -jwtTTL 4h
{"username":"example","password":"Kx2mBBwYRXo9HOC7SUUPrlrYoQowexC/S5k7rie32cNG"}

Given the description below, I expect only Go duration to be supported. Go's time.Duration rejects integer input: https://go.dev/play/p/E9nNy8Sw7pi

  -jwtTTL string
    	JWT created by vault identity provider lasts this long (default "1h")

proxy tls --incert --inkey would fail in the same way if pointed to nonexistent files.

@bnevis-i bnevis-i merged commit 5942442 into edgexfoundry:main Mar 9, 2023
@bnevis-i bnevis-i deleted the issue-4337 branch March 9, 2023 18:26
@bnevis-i
Copy link
Collaborator Author

bnevis-i commented Mar 9, 2023

@farshidtz

Turns out I pass it directly to vault. https://developer.hashicorp.com/vault/docs/concepts/duration-format

--jwtTTL 5 turns out to be 5 SECONDS!

Will update command line help.

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.

Zero exit code on secrets-config errors
2 participants