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

Display secret to user in inspect #19011

Merged
merged 1 commit into from
Jun 28, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jun 27, 2023

It is pretty complicated to display the secret on the host, but is not really secured. This patch makes it easier to examine the secret.

Partial fix for #18667

Does this PR introduce a user-facing change?

podman secret inspect has a new options --showsecret which will output the actual secret.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 27, 2023
@github-actions github-actions bot added the kind/api-change Change to remote API; merits scrutiny label Jun 27, 2023
@rhatdan rhatdan force-pushed the secret1 branch 2 times, most recently from 4c62cc5 to 5949e58 Compare June 27, 2023 15:10
@rhatdan rhatdan changed the title Display secret to user in inpspect Display secret to user in inspect Jun 27, 2023
@rhatdan
Copy link
Member Author

rhatdan commented Jun 27, 2023

@ashley-cui PTAL

Copy link
Member

@ashley-cui ashley-cui left a comment

Choose a reason for hiding this comment

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

Again, this is nitpicky on naming, but I feel like there could be a better name - perhaps --show-data or --display-data? I don't think --display is descriptive enough as a flag for something as revealing as dumping the actual contents of the secret, and doesn't make sense for API calls

Otherwise, implementation and code LGTM

@rhatdan
Copy link
Member Author

rhatdan commented Jun 27, 2023

Not a big fan of options with "-" embeded.

How about

--expose
--reveal
--decrypt
--decode

@rhatdan
Copy link
Member Author

rhatdan commented Jun 27, 2023

@kriansa
Copy link

kriansa commented Jun 28, 2023

--reveal is a clearer option IMHO.

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

Code LGTM but I have absolutely no feeling for the naming.

I think that @TomSweeneyRedHat and @edsantiago have good nose for such things.

@edsantiago
Copy link
Member

I've been lurking here, mulling it over in the background, and my medium preference is for --expose.

Reason: that is (to me) the scariest-sounding name. It triggers a strong visceral response, my fingers don't even want to type it. Before I type such a command I would spend time reading the man page and help output. Or I might decide not to do it at all. And I think that, for a risky option like this one, that is a desirable reaction.

@Luap99
Copy link
Member

Luap99 commented Jun 28, 2023

--expose is already used by podman run and means something completely different, it exposes ports. I don't like having options with the same name but different meaning for commands.

I would prefer something that I can understand without reading the man page, i.e. --show-data as suggest by @ashley-cui

@rhatdan
Copy link
Member Author

rhatdan commented Jun 28, 2023

We seem to be painting a shed....
I don't see how --show-data (My lack of liking options with "-" in them.) is better then the ones I suggested (--reveal or --decrypt) would be ones I like.

Since the secret is actually just base64 encoded running with --decode might be the best logically.

@kriansa
Copy link

kriansa commented Jun 28, 2023

Since the secret is actually just base64 encoded running with --decode might be the best logically.

That's a detail of implementation for the built-in file driver. In the future when we have other and possibly remote secret drivers, that would not be so logical.

@vrothberg
Copy link
Member

I agree. A --decrypt may be more accurate for others.

I think it's good practice to highlight the "don't try this at home" aspect of the flag. It's not a secret anymore once it's out :^)

@Luap99
Copy link
Member

Luap99 commented Jun 28, 2023

But doesn't --decrypt imply that secrets are encrypted? In reality they are not (at least today).

It is pretty complicated to display the secret on the host, but is
not really secured. This patch makes it easier to examine the secret.

Partial fix for containers#18667

Signed-off-by: Daniel J Walsh <[email protected]>
@rhatdan
Copy link
Member Author

rhatdan commented Jun 28, 2023

Went with --showsecret

@ashley-cui
Copy link
Member

LGTM

@rhatdan rhatdan added the lgtm Indicates that a PR is ready to be merged. label Jun 28, 2023
@openshift-merge-robot openshift-merge-robot merged commit 455c7c8 into containers:main Jun 28, 2023
@TomSweeneyRedHat
Copy link
Member

LGTM, and I like showsecret too.

@vrothberg
Copy link
Member

Another reminder to stick to the 2 LGTM rule (and not merging our own PRs). Rushing new features in is risky, especially so close to a new release.

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/api-change Change to remote API; merits scrutiny lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants