Remove the show_child_security_reports_in_mr_widget feature flag to permanently enable displaying security scan results from child pipelines in the merge request security widget.
This has been enabled in production for a month now; and additionally enabled on SM
With this change:
Closes #586210
Hi @rettelbachj
Thanks for your contribution. It looks good to me, but it seems similar to discussion happening in another similar MR. It seems that the approach that you found is more preferrable as it avoids explicitly exposing every possible kubernetes config through runner.
@ratchade @avonbertoldi could you chime in on this?
Sam Roque-Worcel (13ccd525) at 19 Mar 03:04
chore(deps): bump google.golang.org/grpc from 1.79.1 to 1.79.3
... and 1464 more commits
Hi @marcogreg, could you give this a backend maintainer review?? Thanks!
Hi @MarcUllman
Thanks for that. The new code looks good! I'll approve. Thanks for working on this.
@avonbertoldi could you give this a maintainer review?
Add native seccomp_profile_type and app_armor_profile_type fields (with corresponding localhost_profile fields) to [runners.kubernetes.build_container_security_context] and the pod/helper/service/init security context sections in config.toml, so users can configure Seccomp and AppArmor profiles without relying on deprecated annotations or pod spec patches.
The Kubernetes executor currently lacks native support for configuring seccomp profiles and AppArmor profiles through the security context configuration. Users who need these settings face three problematic workarounds:
container.seccomp.security.alpha.kubernetes.io/build = "unconfined" was removed in Kubernetes 1.27. The AppArmor annotation still works but is deprecated in favor of the securityContext.appArmorProfile field (GA in K8s 1.30).FF_USE_ADVANCED_POD_SPEC_CONFIGURATION feature flag, embed JSON/YAML inside TOML, don't integrate with Helm charts, and lack validation. Prior to Runner 18.7.0, patches were silently dropped because the k8s client-go (v0.26) did not include the AppArmorProfile type.Real-world impact: Ubuntu 23.10+ enables kernel.apparmor_restrict_unprivileged_userns=1 by default, which blocks rootless container image building tools (BuildKit, Podman) from mounting /proc inside RUN steps. The only fix is setting appArmorProfile: { type: Unconfined } on the build container — which is impossible through config.toml today.
This also blocks compliance-driven environments (e.g., Azure AKS policy enforcement) that require explicit seccomp profiles on all pods.
Add four new fields to both KubernetesContainerSecurityContext and KubernetesPodSecurityContext config structs:
[runners.kubernetes.build_container_security_context]
seccomp_profile_type = "Unconfined" # RuntimeDefault | Localhost | Unconfined
seccomp_profile_localhost_profile = "" # required when type = Localhost
app_armor_profile_type = "Unconfined" # RuntimeDefault | Localhost | Unconfined
app_armor_profile_localhost_profile = "" # required when type = Localhost
[runners.kubernetes.pod_security_context]
seccomp_profile_type = "RuntimeDefault"
seccomp_profile_localhost_profile = ""
app_armor_profile_type = "RuntimeDefault"
app_armor_profile_localhost_profile = ""
Behavior:
seccomp_profile_type is set, construct api.SeccompProfile{Type: ...} on the returned SecurityContext
app_armor_profile_type is set, construct api.AppArmorProfile{Type: ...} on the returned SecurityContext
Localhost, require the corresponding localhost_profile field; log a warning and skip if missingConfig struct (common/config.go):
KubernetesContainerSecurityContext — add 4 fields with TOML/JSON/env tagsKubernetesPodSecurityContext — add 4 fields with TOML/JSON/env tagsConversion logic (common/config.go):
GetContainerSecurityContext() — set SeccompProfile and AppArmorProfile on returned api.SecurityContext
GetPodSecurityContext() — set SeccompProfile and AppArmorProfile on returned api.PodSecurityContext
toSeccompProfile() and toAppArmorProfile() for validation and conversionDocumentation (docs/executors/kubernetes/index.md or equivalent):
seccomp_profile_type, seccomp_profile_localhost_profile, app_armor_profile_type, app_armor_profile_localhost_profile to the container security context options tableRootless BuildKit image building on Ubuntu 23.10+ nodes:
[[runners]]
executor = "kubernetes"
[runners.kubernetes]
[runners.kubernetes.build_container_security_context]
app_armor_profile_type = "Unconfined"
seccomp_profile_type = "Unconfined"
Azure AKS compliance with RuntimeDefault seccomp:
[[runners]]
executor = "kubernetes"
[runners.kubernetes]
[runners.kubernetes.pod_security_context]
seccomp_profile_type = "RuntimeDefault"
Custom seccomp profile:
[[runners]]
executor = "kubernetes"
[runners.kubernetes]
[runners.kubernetes.build_container_security_context]
seccomp_profile_type = "Localhost"
seccomp_profile_localhost_profile = "profiles/my-profile.json"
Add test cases to existing security context test files following the project's Ginkgo/Gomega patterns:
api.SecurityContext.SeccompProfile.Type is api.SeccompProfileTypeUnconfined
Type and LocalhostProfile are setapi.SecurityContext.AppArmorProfile.Type is api.AppArmorProfileTypeUnconfined
Changelog: added
Kubernetes executor: Add seccomp and AppArmor profile configuration to container and pod security contexts
api.AppArmorProfile type is now available in the codebase.AppArmorProfile field in SecurityContext is GA since Kubernetes 1.30. Setting it against older apiservers may cause pod creation to fail. This should be documented as a minimum version requirement.ProcMount and SELinuxType fields follow the same pattern of string-typed config values converted to k8s API types, so this change is consistent with existing conventions.| Before | After |
|---|---|
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #588510
Sam Roque-Worcel (c86958be) at 17 Mar 00:25
@gitlab-bot retry_pipeline 2388462751
I've kicked of a full pipeline for you as well. Do you mind taking a look at those failures and letting me know if they're just flakes?
Theres a bit of duplication between these two methods, can we avoid that and try and consolidate the code?
Hi @MarcUllman
Sorry about the delay. Overall the MR looks OK and the change seems safe enough, as it adds options for a new feature that we're keen to support.
I've left a couple of comments regarding the style of the code, and will review the tests in more detail next time. Can you please test this code and make sure this works? A screenshot of this setting being enabled and reflected in the security context configuration would be perfect. More info on setup may be here Kubernetes executor | GitLab Docs