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

Mutation annotation needs sanitization #730

Closed
cmwylie19 opened this issue Apr 10, 2024 · 1 comment · Fixed by #731
Closed

Mutation annotation needs sanitization #730

cmwylie19 opened this issue Apr 10, 2024 · 1 comment · Fixed by #731

Comments

@cmwylie19
Copy link
Collaborator

cmwylie19 commented Apr 10, 2024

Environment

Mutation annotation needs sanitization

The Namespace "pepr-demo" is invalid: metadata.annotations: Invalid value: "b9ea57fe-e4f9-55b1-9bdc-0dc6eeb49aa0.pepr.dev/hello pepr": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')

Steps to reproduce

Define the capability name with a space

export const HelloPepr = new Capability({
  name: "hello pepr",
  description: "A simple example capability to show how things work.",
  namespaces: ["pepr-demo", "pepr-demo-2"],
});

Create a mutation

k apply -f -<<EOF
apiVersion: v1
kind: Namespace
metadata:
  name: pepr-demo
  labels:
    keep-me: please
    remove-me: please
EOF
The Namespace "pepr-demo" is invalid: metadata.annotations: Invalid value: "b9ea57fe-e4f9-55b1-9bdc-0dc6eeb49aa0.pepr.dev/hello pepr": name part must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character (e.g. 'MyName',  or 'my.name',  or '123-abc', regex used for validation is '([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]')

Expected result

Mutation annotation to be kubernetes safe

Actual Result

Visual Proof (screenshots, videos, text, etc)

Severity/Priority

Additional Context

Add any other context or screenshots about the technical debt here.

@cmwylie19 cmwylie19 added good first issue Good for newcomers and removed good first issue Good for newcomers labels Apr 10, 2024
@cmwylie19
Copy link
Collaborator Author

removed issue to go ahead and get a quick fix in

@cmwylie19 cmwylie19 mentioned this issue Apr 10, 2024
5 tasks
cmwylie19 added a commit that referenced this issue Apr 22, 2024
## Description

Sanitizes the name that goes into the annotation 

## Related Issue

Fixes #730 
<!-- or -->
Relates to #

## Type of change

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [ ] [Contributor Guide
Steps](https://docs.pepr.dev/main/contribute/contributor-guide/#submitting-a-pull-request)
followed

---------

Signed-off-by: Case Wylie <cmwylie19@defenseunicorns.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant