-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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(server): remove dots from badge query param to avoid DNS 1123 spec error #15533
fix(server): remove dots from badge query param to avoid DNS 1123 spec error #15533
Conversation
5d1c0d5
to
14ff4b3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #15533 +/- ##
==========================================
- Coverage 49.98% 49.49% -0.49%
==========================================
Files 266 270 +4
Lines 45626 47489 +1863
==========================================
+ Hits 22804 23507 +703
- Misses 20589 21671 +1082
- Partials 2233 2311 +78 ☔ View full report in Codecov by Sentry. |
Hi @crenshaw-dev @KouWakai - just wondering if this fix is ready to be merged? |
Hey @KouWakai , looks like DCO check fails because a commit is not signed-off. Can you please check the instructions here? |
Sorry for kept you waiting and thanks for the instruction! |
14ff4b3
to
ee513cf
Compare
@nweisenauer-sap |
@@ -96,7 +96,7 @@ func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { | |||
|
|||
//Sample url: http://localhost:8080/api/badge?name=123 | |||
if name, ok := r.URL.Query()["name"]; ok && enabled && !notFound { | |||
if errs := validation.NameIsDNSLabel(strings.ToLower(name[0]), false); len(errs) == 0 { | |||
if errs := validation.NameIsDNSLabel(strings.Replace(strings.ToLower(name[0]), ".", "", -1), false); len(errs) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a comment here to explain why the replace is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review!!
Sure I'm gonna add an explanation for it
to avoid RFC 1123 validate Signed-off-by: KouWakai <[email protected]>
ee513cf
to
8bfbdd8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@gdsoumya hi, any chance of merging this PR anytime soon? :) |
Tagging @jannfis for review as he worked on this before. |
Is there any chance this could get merged? |
@jannfis could you please also take a look ? |
I created #17580 to fix the validation with existing methods. It will fix the namespace validation as well. |
Sorry for the late reply. IMHO, the better solution would be to fix the validation method used. The idea behind using the DNS label validation would be to validate if the name is a valid Kubernetes resource name, because the name refers to an Application resource. Seems I chose the wrong method initially. EDIT: I see @agaudreault did that. Thank you :) |
… to avoid DNS 1123 specification validate
Fixes #15507
Checklist: