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

Remove constraints on secret name #1541

Merged
merged 1 commit into from
Jul 5, 2023

Conversation

rhatdan
Copy link
Member

@rhatdan rhatdan commented Jun 30, 2023

No description provided.

@rhatdan
Copy link
Member Author

rhatdan commented Jun 30, 2023

@ashley-cui @vrothberg PTAL

@ashley-cui
Copy link
Member

I think we still need a restriction on not allowing / and =, and space/tab or other non-path safe or non env var safe since secrets are mounted in the ctr via path or env var

@rhatdan
Copy link
Member Author

rhatdan commented Jul 1, 2023

@ashley-cui @vrothberg @nalind PTAL

require.Error(t, err)
_, err = manager.Store("a.", []byte("mydata"), drivertype, storeOpts)
_, err = manager.Store("file/path", []byte("mydata"), drivertype, storeOpts)
Copy link
Member

Choose a reason for hiding this comment

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

Non-blocking nit: this test should be turned into a table-driven one.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, probably worth doing the work after all in this PR. We should also test for an error on an empty string and test > 253.

if !secretNameRegexp.MatchString(name) || len(name) > 253 || strings.HasSuffix(name, "-") || strings.HasSuffix(name, ".") {
return fmt.Errorf("only 253 [a-zA-Z0-9-_.] characters allowed, and the start and end character must be [a-zA-Z0-9]: %s: %w", name, errInvalidSecretName)
if len(name) == 0 || !secretNameRegexp.MatchString(name) {
return fmt.Errorf("secret name %q can not include '=' or '/' and must be at least one character: %w", name, errInvalidSecretName)
Copy link
Member

Choose a reason for hiding this comment

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

Can we also mention the null character?

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.

LGTM

@vrothberg
Copy link
Member

CI barks

Run codespell -L ro,hastable,shouldnot
./pkg/secrets/secrets.go:325: betwee ==> between
Error: Process completed with exit code 65.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
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.

LGTM

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jul 4, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhatdan, vrothberg

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

@rhatdan
Copy link
Member Author

rhatdan commented Jul 4, 2023

@flouthoc @giuseppe @lsm5 PTAL

@lsm5
Copy link
Member

lsm5 commented Jul 4, 2023

LGTM at best I can tell. I'll defer to others for final merge.

@rhatdan rhatdan added the lgtm label Jul 5, 2023
@openshift-merge-robot openshift-merge-robot merged commit 206a737 into containers:main Jul 5, 2023
7 checks passed
Copy link
Collaborator

@flouthoc flouthoc left a comment

Choose a reason for hiding this comment

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

Late to review but LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants