Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Suselz
Copy link
Member

@Suselz Suselz commented Oct 24, 2025

Description

Currently, all namespace "deckhouses" are excluded from admission-policy-engine checks.

This is because there is no convenient tool for setting specific exceptions to checks for specific services.

In this PR, I'm added these mechanism: a new SecurityPolicyException custom resource that allows administrators to define fine-grained exceptions to security policies. Pods can reference exceptions via the security.deckhouse.io/security-policy-exception label, enabling selective exemptions without excluding entire namespaces.

The implementation includes:

  • New SecurityPolicyException CRD with support for exceptions across all security policy parameters (securityContext, network, volumes, etc.)
  • Updated constraint templates to check for exceptions before enforcing policies
  • Bump Gatekeeper up to v3.20.1 for support rego v1 in constraint templates
  • Handling label security.deckhouse.io/enable-security-policy-check to enable security checking for system namespaces
  • Gatekeeper configuration updated to sync SecurityPolicyException resources
  • Comprehensive test coverage for exception scenarios across all constraint templates

Why do we need it, and what problem does it solve?

Security improvements: This change enables more granular security policy management by allowing specific exceptions for individual services or pods, rather than blanket exclusions of entire namespaces. This improves security posture by minimizing the scope of exceptions while maintaining operational flexibility.

Checklist

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

Changelog entries

section: admission-policy-engine
type: feature 
summary: Added SecurityPolicyException CRD for fine-grained security policy exceptions
impact_level: low

@Suselz Suselz added this to the v1.74.0 milestone Oct 24, 2025
@Suselz Suselz self-assigned this Oct 24, 2025
@Suselz Suselz added the area/security Pull requests that update security modules label Oct 24, 2025
@github-actions github-actions bot added the area/api-change Pull requests that api changing label Oct 24, 2025
Suselz added 23 commits November 5, 2025 21:25
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
Signed-off-by: suselz <[email protected]>
@Suselz Suselz force-pushed the securityPolicyException branch from 07e6b6a to c19e236 Compare November 5, 2025 16:25
Signed-off-by: suselz <[email protected]>
@github-actions github-actions bot added the go Pull requests that update Go code label Nov 6, 2025
@Suselz Suselz added the e2e/run/yandex-cloud Run e2e tests in Yandex Cloud label Nov 7, 2025
@deckhouse-BOaTswain
Copy link
Collaborator

deckhouse-BOaTswain commented Nov 7, 2025

🟢 e2e: Yandex.Cloud for deckhouse:securityPolicyException succeeded in 35m38s.

Workflow details

Yandex.Cloud-WithoutNAT-Containerd-1.30 - Connection string: ssh [email protected]

🟢 e2e: Yandex.Cloud, Containerd, Kubernetes 1.30 succeeded in 34m22s.

@github-actions github-actions bot removed the e2e/run/yandex-cloud Run e2e tests in Yandex Cloud label Nov 7, 2025
@Suselz Suselz changed the title [global] Exclusion from PSS checks based on securityPolicyExceptions [admission-policy-engine] Exclusion from PSS checks based on securityPolicyExceptions Nov 7, 2025
@Suselz Suselz marked this pull request as ready for review November 7, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/api-change Pull requests that api changing area/security Pull requests that update security modules go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants