Skip to content

Invalid Scheduled Scan name #2706

@adrianmarcu18

Description

@adrianmarcu18

🐞 Bug report

Describe the bug

Auto-discovery cannot create scheduled scans for containers whose names violate the metadata.name naming convention. This should be taken into account as in the container image name there are additional characters allowed, such as "_". I think this should be taken into account and discard/replace characters that are not allowed by metadata.name while creating the scheduled scan name.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Install auto-discovery and activate container scans
  2. Deploy a pod with a container which has in its image name an invalid character such as "_", which is an allowed character for the container image name
  3. Check autodiscovery logs and see that it will fail to create the scheduled scan:

Failed to create scheduled scan, metadata.name: Invalid value: a lowercase RFC 1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(\.a-z0-9?)*')"}

While is good to not have such names in container image names, it can still happen.

Expected behavior

The expected behaviour is for the autodiscovery controller to detect such names and fix them before creating the scan.

System (please complete the following information):

  • secureCodeBox 4.9.0
  • OS: Ubuntu
  • Kubernetes Version: Server Version: version.Info{Major:"1", Minor:"29", GitVersion:"v1.29.5", GitCommit:"59755ff595fa4526236b0cc03aa2242d941a5171", GitTreeState:"clean", BuildDate:"2024-05-22T15:00:52Z", GoVersion:"go1.21.9", Compiler:"gc", Platform:"linux/amd64"}
  • Docker Version: N\A
  • Browser: N\A

Screenshots / Logs

Additional context

Metadata

Metadata

Assignees

Labels

bugBugshelp wantedExtra attention is needed

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions