Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -331,11 +331,12 @@
"automerge": false
},
{
"description": "provider-aws-iam depends on provider-family-aws, which ships the ProviderConfig CRD every family member uses, and the two must be pinned to the same release (see provider-aws-iam.yaml), so they move in one PR. Grouping does not force equal versions; scripts/tests/test-crossplane-aws-family-version-parity.sh fails a PR that pins them apart.",
"description": "provider-aws-iam and provider-aws-sesv2 depend on provider-family-aws, which ships the ProviderConfig CRD every family member uses, and all of them must be pinned to the same release (see provider-aws-iam.yaml), so they move in one PR. Grouping does not force equal versions; scripts/tests/test-crossplane-aws-family-version-parity.sh fails a PR that pins them apart.",
"matchManagers": ["crossplane"],
"matchPackageNames": [
"xpkg.upbound.io/upbound/provider-family-aws",
"xpkg.upbound.io/upbound/provider-aws-iam"
"xpkg.upbound.io/upbound/provider-aws-iam",
"xpkg.upbound.io/upbound/provider-aws-sesv2"
],
"groupName": "crossplane aws providers"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ spec:
- apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ^crossplane:provider:upbound-provider-family-aws-[0-9a-f]+:system$
- apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ^crossplane:provider:upbound-provider-aws-sesv2-[0-9a-f]+:system$
- apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ^crossplane:provider:provider-upjet-github-[0-9a-f]+:system$
Expand Down
18 changes: 18 additions & 0 deletions k8s/providers/hetzner/apps/aws/role.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
# (policy-eks-ci-smoke-boundary.yaml) and the role it constrains
# (role-eks-ci.yaml) are platform-owned. The artifact keeps only the OIDC
# provider, which is what it legitimately owns.
#
# Company Email's SES domain identity and its MAIL FROM domain (platform#5481)
# grant no AWS permission to anyone, so the tenant may own them. The IAM user,
# policy and access key of the SMTP sending identity stay platform-owned for the
# same reason as the boundary above, so no IAM user kind is granted here.
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
Expand All @@ -40,3 +45,16 @@ rules:
- update
- patch
- delete
- apiGroups:
- sesv2.aws.m.upbound.io
resources:
- emailidentities
- emailidentitymailfromattributes
verbs:
- get
- list
- watch
- create
- update
- patch
- delete
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ spec:
# AWS identity APIs used by provider-aws-iam. The provider calls STS
# GetCallerIdentity before reconciling IAM resources, then uses the
# global IAM endpoint for the managed OIDC provider and role.
# email.eu-central-1.amazonaws.com — the SES v2 API used by
# provider-aws-sesv2 for company Email's sending identity, in the
# account's existing region (platform#5481).
# api.ui.com — the UniFi Cloud Connector endpoint used by
# provider-upjet-unifi for every managed-resource request.
- toFQDNs:
Expand All @@ -49,6 +52,7 @@ spec:
- matchName: "d3qrbvrml4iuq4.cloudfront.net"
- matchName: "sts.eu-central-1.amazonaws.com"
- matchName: "iam.amazonaws.com"
- matchName: "email.eu-central-1.amazonaws.com"
- matchName: "api.ui.com"
toPorts:
- ports:
Expand Down Expand Up @@ -77,5 +81,6 @@ spec:
- matchName: "d3qrbvrml4iuq4.cloudfront.net"
- matchName: "sts.eu-central-1.amazonaws.com"
- matchName: "iam.amazonaws.com"
- matchName: "email.eu-central-1.amazonaws.com"
- matchName: "api.ui.com"
- matchPattern: "*.cluster.local"
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ data:
"type": "single-instance-app",
"reason": "platform#3812: provider revision names rotate; a singleton remains off the serving path and prevents duplicate AWS writes"
},
{
"application_pattern": "^crossplane-system:Deployment:upbound-provider-aws-sesv2-[0-9a-f]{12}\\z",
"category": "Availability",
"type": "single-instance-app",
"reason": "platform#3812: provider revision names rotate; a singleton remains off the serving path and prevents duplicate AWS writes"
},
{
"application": "velero:Deployment:velero",
"category": "Availability",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@ spec:
UNIFI_PROVIDER_PATTERN='^crossplane-system:Deployment:provider-upjet-unifi-[0-9a-f]{12}\z'
AWS_IAM_PROVIDER_PATTERN='^crossplane-system:Deployment:provider-aws-iam-[0-9a-f]{12}\z'
AWS_FAMILY_PROVIDER_PATTERN='^crossplane-system:Deployment:upbound-provider-family-aws-[0-9a-f]{12}\z'
AWS_SESV2_PROVIDER_PATTERN='^crossplane-system:Deployment:upbound-provider-aws-sesv2-[0-9a-f]{12}\z'
jq -e --arg instance_manager_pattern "$LONGHORN_INSTANCE_MANAGER_PATTERN" \
--arg github_provider_pattern "$GITHUB_PROVIDER_PATTERN" \
--arg unifi_provider_pattern "$UNIFI_PROVIDER_PATTERN" \
--arg aws_iam_provider_pattern "$AWS_IAM_PROVIDER_PATTERN" \
--arg aws_family_provider_pattern "$AWS_FAMILY_PROVIDER_PATTERN" '
--arg aws_family_provider_pattern "$AWS_FAMILY_PROVIDER_PATTERN" \
--arg aws_sesv2_provider_pattern "$AWS_SESV2_PROVIDER_PATTERN" '
type == "array" and
all(.[];
((has("application") and (has("application_pattern") | not) and
Expand All @@ -116,13 +118,15 @@ spec:
(.application_pattern == $aws_iam_provider_pattern and
(.reason | startswith("platform#3812: "))) or
(.application_pattern == $aws_family_provider_pattern and
(.reason | startswith("platform#3812: "))) or
(.application_pattern == $aws_sesv2_provider_pattern and
(.reason | startswith("platform#3812: ")))))) and
.category == "Availability" and
(.type as $type |
["single-instance-app", "single-node-app", "single-az-app", "spot-only-app", "unreplicated-database"] |
index($type) != null)
) and
([.[] | select(has("application_pattern"))] | length <= 5) and
([.[] | select(has("application_pattern"))] | length <= 6) and
([.[] | [(.application // .application_pattern), .category, .type] | @tsv] | length) ==
([.[] | [(.application // .application_pattern), .category, .type] | @tsv] | unique | length)
' "$ACCEPTANCES_FILE" >/dev/null || {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Bounded resources for the AWS SES v2 provider runtime pod (the same bounds as
# the IAM provider; AWS_REGION is the region SES resources default to).
apiVersion: pkg.crossplane.io/v1beta1
kind: DeploymentRuntimeConfig
metadata:
name: provider-aws-sesv2
spec:
deploymentTemplate:
spec:
selector: {}
template:
spec:
# validate-pod-security's require-seccomp-profile asserts the POD-level
# path, and Crossplane's package manager creates this Deployment
# directly, so the container-level value below does not satisfy it and
# the create is denied by the fail-closed webhook. add-security-context
# cannot fill the gap either: its match/exclude carry pod selectors, so
# Kyverno generates no pod-controller rules for it and it never sees a
# Deployment. The DRC therefore has to state this itself.
#
# The package manager applies its pod-level defaults only when the DRC
# provides no securityContext at all, so this block has to restate
# them verbatim (runAsNonRoot/runAsUser/runAsGroup = Crossplane's
# documented 2000) — adding seccompProfile alone would drop the uid
# the provider images run as.
securityContext:
runAsNonRoot: true
runAsUser: 2000
runAsGroup: 2000
seccompProfile:
type: RuntimeDefault
containers:
- name: package-runtime
# The provider validates credentials through STS before each
# reconciliation. Pin that call to the account's region, where
# the SES resources also live, so the runtime and its exact-host
# egress policy stay aligned instead of falling back to us-east-1.
env:
- name: AWS_REGION
value: eu-central-1
- name: AWS_STS_REGIONAL_ENDPOINTS
value: regional
# Kubescape C-0017 (immutable container filesystem) + the hardening
# set Kyverno injects at admission (Kubescape scans this stored spec,
# not the live pod). The upjet runtime writes Terraform workspaces to
# /tmp/<uuid>, so a writable /tmp emptyDir keeps the read-only root
# from breaking reconciliation of the SES resources.
# runAsUser/runAsGroup left to Crossplane's package-manager default
# (2000).
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault
seLinuxOptions: {}
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
memory: 512Mi
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir: {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ resources:
- provider.yaml
- provider-family-aws.yaml
- provider-aws-iam.yaml
- provider-aws-sesv2.yaml
- provider-upjet-unifi.yaml
- deployment-runtime-config.yaml
- deployment-runtime-config-family-aws.yaml
- deployment-runtime-config-aws-iam.yaml
- deployment-runtime-config-aws-sesv2.yaml
- deployment-runtime-config-upjet-unifi.yaml
- managed-resource-activation-policy.yaml
- managed-resource-activation-policy-arc.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
# (aws#4 security hardening: roles the CI principal creates must carry a
# boundary, so it cannot mint-and-pass an unbounded role). Broad
# Policy/RolePolicyAttachment use stays deliberately off.
#
# Company Email's outbound relay (platform#5481) adds the SES v2 domain
# identity and its MAIL FROM domain, plus the IAM user, policy attachment and
# access key of its send-only SMTP identity. The tenant may write only the two
# SES kinds; the IAM user kinds stay platform-owned, as the EKS CI role does.
# They are activated here, a revision before anything uses them, so no later
# apply waits on a CRD that does not exist yet.
---
apiVersion: apiextensions.crossplane.io/v1alpha1
kind: ManagedResourceActivationPolicy
Expand All @@ -16,3 +23,8 @@ spec:
- openidconnectproviders.iam.aws.m.upbound.io
- policies.iam.aws.m.upbound.io
- roles.iam.aws.m.upbound.io
- users.iam.aws.m.upbound.io
- userpolicyattachments.iam.aws.m.upbound.io
- accesskeys.iam.aws.m.upbound.io
- emailidentities.sesv2.aws.m.upbound.io
- emailidentitymailfromattributes.sesv2.aws.m.upbound.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# provider-aws-sesv2 — the SES v2 family member for company Email's outbound
# relay (platform#5481). It reconciles the sending domain identity and its MAIL
# FROM domain. Canonically named after its package, so Crossplane's dependency
# resolution finds it. Its package version must match provider-family-aws (see
# provider-family-aws.yaml). Resource-bounded via
# deployment-runtime-config-aws-sesv2.yaml.
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upbound-provider-aws-sesv2
spec:
package: xpkg.upbound.io/upbound/provider-aws-sesv2:v2.9.4
runtimeConfigRef:
name: provider-aws-sesv2
3 changes: 2 additions & 1 deletion scripts/check-upbound-package-signatures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,11 @@ expected_repository() {
case "$1" in
provider-aws-iam) echo "${UPBOUND_PREFIX}provider-aws-iam" ;;
upbound-provider-family-aws) echo "${UPBOUND_PREFIX}provider-family-aws" ;;
upbound-provider-aws-sesv2) echo "${UPBOUND_PREFIX}provider-aws-sesv2" ;;
*) return 1 ;;
esac
}
for name in provider-aws-iam upbound-provider-family-aws; do
for name in provider-aws-iam upbound-provider-family-aws upbound-provider-aws-sesv2; do
repository="$(expected_repository "$name")"
yq ea -r "select(.apiVersion == \"pkg.crossplane.io/v1\" and .kind == \"Provider\" and .metadata.name == \"$name\") | .spec.package" \
"$rendered" >"$scratch/named.txt"
Expand Down
2 changes: 2 additions & 0 deletions scripts/tests/crossplane-egress-policy-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ rules:
{'matchName': 'd3qrbvrml4iuq4.cloudfront.net'},
{'matchName': 'sts.eu-central-1.amazonaws.com'},
{'matchName': 'iam.amazonaws.com'},
{'matchName': 'email.eu-central-1.amazonaws.com'},
{'matchName': 'api.ui.com'}
],
'toPorts': [{'ports': [
Expand All @@ -87,6 +88,7 @@ rules:
{'matchName': 'd3qrbvrml4iuq4.cloudfront.net'},
{'matchName': 'sts.eu-central-1.amazonaws.com'},
{'matchName': 'iam.amazonaws.com'},
{'matchName': 'email.eu-central-1.amazonaws.com'},
{'matchName': 'api.ui.com'},
{'matchPattern': '*.cluster.local'}
]}
Expand Down
27 changes: 21 additions & 6 deletions scripts/tests/test-check-upbound-package-signatures.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ spec:
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: upbound-provider-aws-sesv2
spec:
package: xpkg.upbound.io/upbound/provider-aws-sesv2:v2.6.1
---
apiVersion: pkg.crossplane.io/v1
kind: Provider
metadata:
name: provider-upjet-github
spec:
Expand Down Expand Up @@ -61,6 +68,10 @@ sed "s|package: xpkg.upbound.io\/upbound\/provider-aws-iam:v2.6.1|package: ghcr.
"$scratch/rendered.yaml" >"$scratch/repointed.yaml"
# A privileged provider that is no longer rendered at all.
yq ea 'select(.metadata.name != "provider-aws-iam")' "$scratch/rendered.yaml" >"$scratch/missing.yaml"
# The SES provider holds the same AWS credential, so it is guarded by name too.
sed "s|package: xpkg.upbound.io\/upbound\/provider-aws-sesv2:v2.6.1|package: ghcr.io\/evil\/provider-aws-sesv2:v2.6.1|" \
"$scratch/rendered.yaml" >"$scratch/repointed-sesv2.yaml"
yq ea 'select(.metadata.name != "upbound-provider-aws-sesv2")' "$scratch/rendered.yaml" >"$scratch/missing-sesv2.yaml"

# Fake cosign: `cosign verify --certificate-oidc-issuer I --certificate-identity ID REF`.
# COSIGN_MODE picks the behaviour; every call is logged so the test can see
Expand Down Expand Up @@ -129,13 +140,13 @@ expect() {
echo "ok: $name"
}

expect 'both signed Upbound packages verify' 0 \
'2 Upbound package signatures verified' "$scratch/rendered.yaml"
if [[ "$(cat "$scratch/events.log")" != $'verify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify' ]]; then
expect 'every signed Upbound package verifies' 0 \
'3 Upbound package signatures verified' "$scratch/rendered.yaml"
if [[ "$(cat "$scratch/events.log")" != $'verify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify\nsleep:30\nverify' ]]; then
echo 'FAIL: every consecutive verifier call must be separated, including controls and package boundaries' >&2
failures=$((failures + 1))
fi
if grep -qv '^xpkg\.upbound\.io/upbound/provider-\(family-aws\|aws-iam\):v2\.6\.1$' "$scratch/calls.log"; then
if grep -qv '^xpkg\.upbound\.io/upbound/provider-\(family-aws\|aws-iam\|aws-sesv2\):v2\.6\.1$' "$scratch/calls.log"; then
echo 'FAIL: a non-Upbound or non-Provider reference was sent to cosign:' >&2
sed 's/^/ /' "$scratch/calls.log" >&2
failures=$((failures + 1))
Expand All @@ -147,7 +158,7 @@ expect 'a verifier that accepts any identity is caught' 1 \
expect 'an outage during the negative control is not read as a refusal' 1 \
'stopped verifying after the negative control' "$scratch/rendered.yaml" outage-after-first
expect 'a registry enforcing burst limits verifies with paced requests' 0 \
'2 Upbound package signatures verified' "$scratch/rendered.yaml" burst
'3 Upbound package signatures verified' "$scratch/rendered.yaml" burst
expect 'an HTTP 429 is not reported as an unsigned package' 1 \
'FAIL: could not verify' "$scratch/rendered.yaml" registry-rate-limit
if grep -qF 'is not signed' "$scratch/out.log"; then
Expand All @@ -163,14 +174,18 @@ fi
expect 'a failed wait before the negative control stops the whole gate' 1 \
'verification pacing wait failed' "$scratch/rendered.yaml" control-wait-fails
if [[ "$(wc -l <"$scratch/calls.log" | tr -d ' ')" -ne 1 ]] ||
grep -qF '2 Upbound package signatures verified' "$scratch/out.log"; then
grep -qF '3 Upbound package signatures verified' "$scratch/out.log"; then
echo 'FAIL: a missing negative control was accepted after a failed wait' >&2
failures=$((failures + 1))
fi
expect 'a privileged provider repointed to another registry is refused' 1 \
'Provider provider-aws-iam must use xpkg.upbound.io/upbound/provider-aws-iam' "$scratch/repointed.yaml"
expect 'a privileged provider that is not rendered is refused' 1 \
'expected exactly one rendered Provider named provider-aws-iam' "$scratch/missing.yaml"
expect 'the SES provider repointed to another registry is refused' 1 \
'Provider upbound-provider-aws-sesv2 must use xpkg.upbound.io/upbound/provider-aws-sesv2' "$scratch/repointed-sesv2.yaml"
expect 'the SES provider that is not rendered is refused' 1 \
'expected exactly one rendered Provider named upbound-provider-aws-sesv2' "$scratch/missing-sesv2.yaml"
expect 'a lookalike registry or organisation is not Upbound' 1 \
'must use xpkg.upbound.io/upbound/provider-' "$scratch/lookalikes.yaml"

Expand Down
9 changes: 6 additions & 3 deletions scripts/tests/test-coroot-risk-acceptance-reconciler.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ acceptances_file="${work_root}/risks.json"
yq e -r '.data."risks.json"' "${acceptances_manifest}" >"${acceptances_file}"

jq -e '
type == "array" and length == 37 and
type == "array" and length == 38 and
all(.[] | select(has("application"));
(.application | type == "string") and
(.application | split(":") | length == 3) and
.category == "Availability" and
(.type | IN("single-instance-app", "unreplicated-database")) and
(.reason | startswith("platform#3812: "))
) and
([.[] | select(has("application_pattern"))] | length == 5) and
([.[] | select(has("application_pattern"))] | length == 6) and
any(.[]; .application_pattern? == "^longhorn-system:InstanceManager:instance-manager-[0-9a-f]{32}\\z" and
.category == "Availability" and .type == "single-instance-app" and
(.reason | startswith("platform#4117: "))) and
Expand All @@ -63,10 +63,13 @@ jq -e '
any(.[]; .application_pattern? == "^crossplane-system:Deployment:upbound-provider-family-aws-[0-9a-f]{12}\\z" and
.category == "Availability" and .type == "single-instance-app" and
(.reason | startswith("platform#3812: "))) and
any(.[]; .application_pattern? == "^crossplane-system:Deployment:upbound-provider-aws-sesv2-[0-9a-f]{12}\\z" and
.category == "Availability" and .type == "single-instance-app" and
(.reason | startswith("platform#3812: "))) and
([.[] | [(.application // .application_pattern), .category, .type] | @tsv] | length) ==
([.[] | [(.application // .application_pattern), .category, .type] | @tsv] | unique | length)
' "${acceptances_file}" >/dev/null ||
fail 'the availability acceptance allowlist must contain exact entries and five narrow generated-name patterns'
fail 'the availability acceptance allowlist must contain exact entries and six narrow generated-name patterns'

expected_applications=(
'actual-budget:Deployment:actual-budget-actualbudget'
Expand Down
Loading
Loading