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

Fixed mishandling of scheme prefixes in route specifications #2617

Merged
merged 3 commits into from
Oct 4, 2023

Conversation

andreas-kupries
Copy link
Contributor

fix #2606

@andreas-kupries andreas-kupries added kind/bug Something isn't working area/api API related requests and bugs labels Sep 29, 2023
@andreas-kupries andreas-kupries added this to the v1.11.0 milestone Sep 29, 2023
@andreas-kupries andreas-kupries self-assigned this Sep 29, 2023
@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Attention: 6 lines in your changes are missing coverage. Please review.

Files Coverage Δ
internal/api/v1/application/create.go 62.93% <70.00%> (+0.25%) ⬆️
internal/api/v1/application/update.go 70.81% <62.50%> (-0.48%) ⬇️

... and 28 files with indirect coverage changes

📢 Thoughts on this report? Let us know!.

@andreas-kupries andreas-kupries marked this pull request as ready for review September 29, 2023 13:49
@andreas-kupries andreas-kupries requested a review from a team as a code owner September 29, 2023 13:49
@mmartin24
Copy link
Contributor

Tested on branch and seems to work:

Before:

➜  epinio git:(main) epinio app update sampleapp --route https://badname.domain.com                      

🚢  Update application
Namespace: workspace
Application: sampleapp
Routes: 
1: https://badname.domain.com

❌  error updating the app: an error occurred while rolling back the release. original upgrade error: failed to create resource: Ingress.extensions "rsampleapp-httpsbadnam-d861250b733bc7690138f948c3029ad4d789031c" is invalid: [spec.rules[0].host: Invalid value: "https:": 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]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), spec.tls[0].hosts[0]: Invalid value: "https:": 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]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')]: no Ingress with the name "rsampleapp-sampleapp19-b1f16f232b2c3898f2e814b7545f669f23dad8aa" found

After fix:

  • Simple update with https://... works:
➜  epinio git:(2606-route-schema-prefix-fix) epinio app update sampleapp --route https://badname.domain.com

🚢  Update application
Namespace: workspace
Application: sampleapp
Routes: 
1: https://badname.domain.com
  • Simple update without https:// still works:
➜  epinio git:(2606-route-schema-prefix-fix) epinio app update sampleapp --route simple-name.domain.com

🚢  Update application
Namespace: workspace
Application: sampleapp
Routes: 
1: simple-name.domain.com

✔️  Successfully updated application
  • Update with incorrect https works also:
➜  epinio git:(2606-route-schema-prefix-fix) epinio app update sampleapp --route httpsbad://badname.domain.com

🚢  Update application
Namespace: workspace
Application: sampleapp
Routes: 
1: httpsbad://badname.domain.com

✔️  Successfully updated application
  • Update with non- allowed (such as capitals) characters still is prevented:
➜  epinio git:(2606-route-schema-prefix-fix) epinio app update sampleapp --route httpsbad://BADNAME.domain.com

🚢  Update application
Namespace: workspace
Application: sampleapp
Routes: 
1: httpsbad://BADNAME.domain.com

❌  error updating the app: an error occurred while rolling back the release. original upgrade error: failed to create resource: Ingress.extensions "rsampleapp-domaincom-6f78cc0bd051685a46e7be9a10c54ad289757840" is invalid: [spec.rules[0].host: Invalid value: "BADNAME.domain.com": 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]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'), spec.tls[0].hosts[0]: Invalid value: "BADNAME.domain.com": 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]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*')]: no Ingress with the name "rsampleapp-badnamedoma-356aa62d0bbb324d80293cef143b71c095548eb5" found

Copy link
Member

@enrichman enrichman left a comment

Choose a reason for hiding this comment

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

I'm not completely confident about not checking errors.

internal/api/v1/application/create.go Outdated Show resolved Hide resolved
internal/api/v1/application/update.go Outdated Show resolved Hide resolved
@andreas-kupries andreas-kupries merged commit ffe3806 into main Oct 4, 2023
15 checks passed
@andreas-kupries andreas-kupries deleted the 2606-route-schema-prefix-fix branch October 4, 2023 12:56
@mmartin24
Copy link
Contributor

Rechecked in v1.11.0-rc1 and working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api API related requests and bugs kind/bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

App broke after trying update the route with invalid value
3 participants