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

[DDO-3911] improve chart name validation #701

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

jack-r-warren
Copy link
Contributor

@jack-r-warren jack-r-warren commented Oct 31, 2024

Sherlock checks that the chart name isn't empty, but it doesn't impose validation on it not having special characters. This is a problem when security scanners target Sherlock's API, because "garbage in garbage out" means Sherlock ingests and stores the garbage.

This PR changes the validation to not just check emptiness but also that it matches the same kind of regex we use to validate environment names.

It is possible for deployment of this change to fail if there's already garbage in the database. I've checked and prod doesn't suffer from this. Dev does so I'll clean up manually.

delete from charts where name not similar to '[a-z0-9]([-a-z0-9]*[a-z0-9])?';

Testing

We have a ton of testing for all sorts of valid chart names; everything in TestData gets automatically created. I added a test that checks invalid characters and it now properly passes with this fix in place.

Risk

Low. No impact to prod. Any issues would halt rollout.

@jack-r-warren jack-r-warren requested a review from a team as a code owner October 31, 2024 19:23
Copy link

Copy link

No API changes detected

Copy link

Published image from eb35acd (merge 16a8d81):

us-central1-docker.pkg.dev/dsp-artifact-registry/sherlock/sherlock:v1.6.11-16a8d81
us-central1-docker.pkg.dev/dsp-devops-super-prod/sherlock/sherlock:v1.6.11-16a8d81

@jack-r-warren jack-r-warren merged commit 3c033c9 into main Nov 1, 2024
19 checks passed
@jack-r-warren jack-r-warren deleted the DDO-3911-fix-chart-name-bug branch November 1, 2024 15:57
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