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

kubernetes fix: do not fail where metadata.name is missing #7055

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

eyalatox
Copy link

@eyalatox eyalatox commented Mar 17, 2025

User description

Description

in cases the name field in not present in the metadata section an exception is thrown

Fixes # (issue)

fix case of uncaught exception, passing the policy instead

Checklist:

  • I have performed a self-review of my own code

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Modifies the DefaultNamespace check in the kubernetes_security_checks module to handle cases where the metadata.name field is missing. Improves the robustness of the security validation process for Kubernetes resources.

TopicDetails
Code refactoring Refactors how the 'name' field is accessed and used in conditional statements
Modified files (1)
  • checkov/kubernetes/checks/resource/k8s/DefaultNamespace.py
Latest Contributors(2)
UserCommitDate
gruebelchore-fix-flake8-issue...October 11, 2022
YaaraVernerRun-k8s-graph-from-run...December 05, 2021
Exception handling Adds a check for the existence of the 'name' field in metadata to prevent exceptions
Modified files (1)
  • checkov/kubernetes/checks/resource/k8s/DefaultNamespace.py
Latest Contributors(2)
UserCommitDate
gruebelchore-fix-flake8-issue...October 11, 2022
YaaraVernerRun-k8s-graph-from-run...December 05, 2021
This pull request is reviewed by Baz. Join @eyalatox and the rest of your team on (Baz).

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.

1 participant