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(server): remove dots from badge query param to avoid DNS 1123 spec error #15533

Closed

Conversation

KouWakai
Copy link

@KouWakai KouWakai commented Sep 17, 2023

… to avoid DNS 1123 specification validate

Fixes #15507

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • The title of the PR conforms to the Toolchain Guide
  • I've included "Closes [ISSUE #]" or "Fixes [ISSUE #]" in the description to automatically close the associated issue.
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I have signed off all my commits as required by DCO
  • I have written unit and/or e2e tests for my change. PRs without these are unlikely to be merged.
  • My build is green (troubleshooting builds).
  • My new feature complies with the feature status guidelines.
  • I have added a brief description of why this PR is necessary and/or what this PR solves.

@KouWakai KouWakai force-pushed the fix/badges-containing-dots-in-name branch from 5d1c0d5 to 14ff4b3 Compare September 17, 2023 12:49
@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (21672a2) 49.98% compared to head (8bfbdd8) 49.49%.
Report is 260 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

@crenshaw-dev crenshaw-dev changed the title fix:remove dots from the name in query parameter of request for badge… fix(server): remove dots from the name in query parameter of request for badge… Sep 18, 2023
@crenshaw-dev crenshaw-dev changed the title fix(server): remove dots from the name in query parameter of request for badge… fix(server): remove dots from badge query param to avoid DNS 1123 spec error Sep 18, 2023
@byrneo
Copy link

byrneo commented Nov 8, 2023

Hi @crenshaw-dev @KouWakai - just wondering if this fix is ready to be merged?

@nweisenauer-sap
Copy link

Hey @KouWakai , looks like DCO check fails because a commit is not signed-off. Can you please check the instructions here?
I would also love to see this one merged :)
Thanks!

@KouWakai
Copy link
Author

KouWakai commented Dec 10, 2023

Hey @KouWakai , looks like DCO check fails because a commit is not signed-off. Can you please check the instructions here? I would also love to see this one merged :) Thanks!

Sorry for kept you waiting and thanks for the instruction!
I would love to include Signed-off-by line!

@KouWakai KouWakai force-pushed the fix/badges-containing-dots-in-name branch from 14ff4b3 to ee513cf Compare December 10, 2023 01:45
@KouWakai KouWakai requested a review from a team as a code owner December 10, 2023 01:45
@KouWakai
Copy link
Author

@nweisenauer-sap
DCO is okay! Thanks for the remind!

@@ -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 {
Copy link
Member

@gdsoumya gdsoumya Dec 10, 2023

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.

Copy link
Author

@KouWakai KouWakai Dec 10, 2023

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

@KouWakai KouWakai force-pushed the fix/badges-containing-dots-in-name branch from ee513cf to 8bfbdd8 Compare December 11, 2023 03:50
Copy link
Member

@gdsoumya gdsoumya left a comment

Choose a reason for hiding this comment

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

LGTM

@pepe9012
Copy link

pepe9012 commented Feb 8, 2024

@gdsoumya hi, any chance of merging this PR anytime soon? :)

@gdsoumya
Copy link
Member

gdsoumya commented Feb 8, 2024

Tagging @jannfis for review as he worked on this before.

@SamuraiPrinciple
Copy link

Is there any chance this could get merged?

@pasha-codefresh
Copy link
Member

@jannfis could you please also take a look ?

@agaudreault
Copy link
Member

I created #17580 to fix the validation with existing methods. It will fix the namespace validation as well.

@jannfis
Copy link
Member

jannfis commented Mar 20, 2024

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 :)

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.

Badge not found when app name contains a dot
9 participants