-
Notifications
You must be signed in to change notification settings - Fork 279
14144 s3 endpoint field in cluster configuration missing input validation #14557
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
base: master
Are you sure you want to change the base?
14144 s3 endpoint field in cluster configuration missing input validation #14557
Conversation
Note that the issue is currently targeting 2.13, and 2.12 priorities need to come first |
}; | ||
}, | ||
|
||
computed: { | ||
...mapGetters({ features: 'features/get' }), | ||
|
||
s3ConfigComponent() { |
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.
this logic should be encapsulated inside the S3Config
component and it's valid state can be emit
ed out
- logic specific to inside a component stays inside the component
- the interface between parent and child components is clear, rather than parent reaching into child and using internal properties
@@ -12,6 +16,7 @@ export default { | |||
Checkbox, | |||
SelectOrCreateAuthSecret, | |||
}, | |||
mixins: [CreateEditView, FormValidation], |
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.
the CreateEditView mixin is intended for root resources create/edit/view components rather than a sub component
}; | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<SelectOrCreateAuthSecret | ||
v-model:value="config.cloudCredentialName" | ||
:mode="mode" | ||
:disable="isView" |
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.
:disable="isView"
on this and below shouldn't be needed with :mode="mode"
shell/utils/validators/setting.js
Outdated
return false; // Or throw new Error('Input is not a string'); | ||
} | ||
|
||
return value.toLowerCase().startsWith('https://') || value.toLowerCase().startsWith('http://'); |
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.
generally it's better to reduce duplication
const lowerCaseValue = value.toLowerCase();
return lowerCaseValue.startsWith('https://') || lowerCaseValue.startsWith('http://');
Hi @richard-cox |
Summary
The core requirement was to prevent users from entering "http://" or "https://" at the beginning of the S3 endpoint URL in a form, and consequently, disable the main "Save" button of the cluster creation/edit form. Additionally, a tooltip should appear next to the endpoint field to inform the user about this specific error.
Fixes #14144
Occurred changes and/or fixed issues
Check if value typed on endpoint form is http:// or https://, in case of positive, return an error and disable the save button.
The save button was kept enable in view mode, the fix was to disable it in case the mode is view.
Technical notes summary
Areas or cases that should be tested
Rancher new cluster`s provisioning with etcd/s3 endpoint information
Browser: Opera 119.0.5497.88
Steps to reproduce:
Scenario 1)
Scenario 2)
Screenshot/Video
Screencast.From.2025-06-23.14-06-54.webm
Checklist