checkov
checkov copied to clipboard
kubernetes fix: do not fail where metadata.name is missing
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.
| Topic | Details | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Code refactoring | Refactors how the 'name' field is accessed and used in conditional statementsModified files (1)
Latest Contributors(2)
| |||||||||
| Exception handling | Adds a check for the existence of the 'name' field in metadata to prevent exceptionsModified files (1)
Latest Contributors(2)
|
@eyalatox please add a test that would have previous to your fix thrown an error
Hi @eyalatox, Could you please merge the latest changes from main into this branch?
Closing due to inactivity