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

fix(kubernetes): Change UID validation #6869

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jfagoagas
Copy link
Member

@jfagoagas jfagoagas commented Feb 7, 2025

Description

Change Kubernetes provider validation:

  • Maximum length of 250 chars
  • Regex validation: ^[a-z0-9][A-Za-z0-9_.:\/-]{1,250}$

Now the following K8s cluster names from AWS EKS, AKS and GKE can be added:

  • arn:aws:eks:us-east-1:111122223333:cluster/test-cluster-name-longer-than-63-characters
  • gke_aaaa-dev_europe-test1_dev-aaaa-cluster-name-longer-than-63-characters

Checklist

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@jfagoagas jfagoagas requested a review from a team as a code owner February 7, 2025 15:20
value,
):
raise ModelValidationError(
detail="The value must either be a valid Kubernetes UID (up to 63 characters, "
"starting and ending with a lowercase letter or number, containing only "
"lowercase alphanumeric characters and hyphens) or a valid EKS ARN.",
"lowercase alphanumeric characters and hyphens) or a valid AWS EKS ARN, GCP GKE ID or Azure AKS ID.",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MrCloudSec could you please review the wording here? Thanks!

@jfagoagas jfagoagas changed the title fix(kubernetes): Change validation to just 250 chars fix(kubernetes): Change UID validation Feb 7, 2025
@jfagoagas jfagoagas requested a review from MrCloudSec February 7, 2025 15:41
Copy link

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.45%. Comparing base (ef6af8e) to head (dc2376e).
Report is 41 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6869      +/-   ##
==========================================
+ Coverage   93.40%   93.45%   +0.05%     
==========================================
  Files          70       71       +1     
  Lines        6412     6446      +34     
==========================================
+ Hits         5989     6024      +35     
+ Misses        423      422       -1     
Flag Coverage Δ
api 93.45% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
prowler ∅ <ø> (∅)
api 93.45% <100.00%> (+0.05%) ⬆️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants