This repository has been archived by the owner on Mar 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change: move actual permissions to .status + apply IRAs to consumed p…
…ermissions (#2226) - The actually granted and authorized permissions for every app will now go to AppInstances' `.status.permissions` field and contain **only** those permissions required for this specific AppInstance, **not** for nested Acorns - Permissions are promoted from `.spec` to `.status` along with the staged AppImage when all checks (including ImageRoleAuthorizations) pass - Permissions consumed from nested Services are added after all that and thus we have a new handler for them that only allows the consuming App to run if it's authorized to hold the permissions consumed from the producing service - Those will be merged into the `.status.permissions` field such that this field reflects truly all permissions given to that AppInstance
- Loading branch information
1 parent
0db995b
commit 14748bc
Showing
47 changed files
with
1,182 additions
and
146 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
integration/client/imagerules/testdata/serviceconsumer/Acornfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
services: producer: build: acornfile: "service.acorn" | ||
|
||
jobs: test: { | ||
consumes: "producer" | ||
image: "ghcr.io/acorn-io/images-mirror/busybox:latest" | ||
command: "/test.sh" | ||
files: "/test.sh": """ | ||
#!/bin/sh | ||
set -e -x | ||
[ "$foo" == "envvalue" ] | ||
[ "$(cat /secret-file)" == "filevalue" ] | ||
""" | ||
} | ||
|
||
jobs: kubetest: { | ||
consumes: "producer" | ||
image: "cgr.dev/chainguard/kubectl:latest-dev" | ||
env: NAMESPACE: "@{acorn.project}" | ||
entrypoint: "/run.sh" | ||
files: "/run.sh": """ | ||
#!/bin/sh | ||
set -e -x | ||
[ "${NAMESPACE}" == "@{acorn.project}" ] | ||
kubectl -n ${NAMESPACE} get secret foo 2>&1 | grep "NotFound" | ||
kubectl -n ${NAMESPACE} get secret bar 2>&1 | grep "Forbidden" | ||
""" | ||
} |
39 changes: 39 additions & 0 deletions
39
integration/client/imagerules/testdata/serviceconsumer/service.acorn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
services: default: { | ||
default: true | ||
// You this must be a superset or the exact same permissions | ||
// that you will grant to the consumer | ||
consumer: permissions: rules: [{ | ||
verbs: ["get"] | ||
apiGroups: [""] | ||
resources: ["secrets"] | ||
}] | ||
generated: job: "default-svc" | ||
} | ||
|
||
secrets: asecret: data: { | ||
env: "envvalue" | ||
file: "filevalue" | ||
} | ||
|
||
jobs: "default-svc": { | ||
image: "ghcr.io/acorn-io/images-mirror/busybox:latest" | ||
command: "/run.sh" | ||
files: "/run.sh": """ | ||
#!/bin/sh | ||
cat > /run/secrets/output << EOF | ||
services: default: { | ||
secrets: ["asecret"] | ||
consumer: { | ||
permissions: rules: [{ | ||
verbs:["get"] | ||
apiGroups: [""] | ||
resources: ["secrets"] | ||
resourceNames: ["foo"] | ||
}] | ||
env: foo: "secret://asecret/env" | ||
files: "/secret-file": "secret://asecret/file" | ||
} | ||
} | ||
EOF | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.