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

Add namespace checking on rego #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kevindiu
Copy link
Contributor

@kevindiu kevindiu commented Feb 5, 2020

I confirm that this contribution is made under the terms of the license found in the root directory of this repository's source tree and that I have the authority necessary to make this contribution on behalf of its copyright owner.

@kevindiu kevindiu changed the title add namespace checking on rego Add namespace checking on rego Feb 5, 2020
@mcieplak
Copy link
Contributor

mcieplak commented Feb 6, 2020

Hi @kevindiu , thank you for raising the PR!
We actually already have this namespace validation check a little further down in the rego here: https://github.com/yahoo/k8s-athenz-identity/blob/master/k8s/identity-validation.rego.yaml#L59

@kevindiu
Copy link
Contributor Author

Hi @mcieplak,
This PR is actually adding a checking of the namespace field in the claim.

@@ -51,7 +51,7 @@ data:
pod_name = k8s_claims.pod.name

pod_verified = true {
input.service = input.service
pod_ns = k8s_claims.namespace
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is actually equivalent to the what's currently checked below here:
https://github.com/yahoo/k8s-athenz-identity/blob/7689cbdb69b81f214f65e0162e1d3e5901da7462/k8s/identity-validation.rego.yaml#L59
This will compare the pod namespace is equal to what is in the claim.

@@ -51,7 +51,7 @@ data:
pod_name = k8s_claims.pod.name

pod_verified = true {
input.service = input.service
Copy link
Contributor

Choose a reason for hiding this comment

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

This can definitely be removed as it is comparing the same service string with itself. The subsequent line does the comparison of the input.service against the service account name that is needed.

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.

2 participants