Skip to content

feat: add check to detect URL annotations with suspicious characters #399

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

nikpivkin
Copy link
Contributor

Signed-off-by: Nikita Pivkin <nikita.pivkin@smartforce.io>
Comment on lines +9 to +28
"valid url": {
"key": "link.argocd.argoproj.io/external-link",
"value": "https://valid-url.com",
"expected": 0,
},
"suspicious characters": {
"key": "link.argocd.argoproj.io/external-link",
"value": "http://example.com/#;\ninjection_point",
"expected": 1,
},
"unsupported annotation": {
"key": "foo",
"value": "http://example.com/#;\ninjection_point",
"expected": 0,
},
"alb oidc": {
"key": "alb.ingress.kubernetes.io/auth-idp-oidc",
"value": `'{"issuer":"https://example.com","authorizationEndpoint":"http://example.com/#;\ninjection_point","tokenEndpoint":"https://token.example.com","userInfoEndpoint":"https://userinfo.example.com","secretName":"my-k8s-secret"}'`,
"expected": 1,
},
Copy link
Member

Choose a reason for hiding this comment

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

note: since we don't have a way to definitively prove an annotation key would have a value of a URL, we are relying here for two specific keys:

  1. "alb.ingress.kubernetes.io/auth-idp-oidc" which is part of the kubernetes well known URL annotations
  2. "link.argocd.argoproj.io/external-link" a commonly used annotation in argoCD.

determining if a key will have a value of a URL is a hard problem. therefore we've started with well-known annotations for now.

WDYT @itaysk?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess that is fine. we could also search for regexp matches across all annotations but I imagine the concern was for performance?

Copy link
Member

Choose a reason for hiding this comment

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

Performance certainly yes but there could be annotations where a URL is expected as a value but the key may not make it obvious as such.

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