dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

14144 s3 endpoint field in cluster configuration missing input validation

Open marytlf opened this issue 6 months ago • 1 comments

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)

  • Create new cluster (custom)
  • Tab etcd > Save Backup to s3 (enable) > set values on endpoint field (https://localhost:9000 or http://localhost)

Scenario 2)

  • Create new cluster (custom)
  • Tab etcd > Save Backup to s3 (enable) > set values on endpoint field (localhost:9000)
  • Save

Screenshot/Video

Screencast From 2025-06-23 14-06-54.webm

Checklist

  • [x] The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
  • [x] The PR template has been filled out
  • [x] The PR has been self reviewed
  • [x] The PR has a reviewer assigned
  • [x] The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
  • [] The PR has been reviewed in terms of Accessibility

marytlf avatar Jun 23 '25 17:06 marytlf

Note that the issue is currently targeting 2.13, and 2.12 priorities need to come first

richard-cox avatar Jun 24 '25 07:06 richard-cox

Hi @richard-cox I made the changes you asked, when you have time can you take a look, please? thank you

marytlf avatar Jul 04 '25 17:07 marytlf

@marytlf thanks, it's on the stack

richard-cox avatar Jul 07 '25 07:07 richard-cox

Apologies, i haven't managed to get back to this one, moving to 2.13.0

richard-cox avatar Jul 14 '25 08:07 richard-cox

@marytlf @eva-vashkevich The 'Save Backups to S3' section is now visible only when 'Automatic Backups' are enabled. Is this a wanted change?

image image

torchiaf avatar Aug 08 '25 09:08 torchiaf

Hi @torchiaf I see "Save Backups to S3" only visible when "Automatic backups" are enabled on master too. Can you please elaborate on what you meant?

eva-vashkevich avatar Aug 15 '25 17:08 eva-vashkevich

@richard-cox Naturally, we also weren't clearing our s3 fields if Automatic backups are disabled, so I fixed that too I've improved the regex a bit as well, please let me know if you think it is too restrictive

eva-vashkevich avatar Aug 18 '25 21:08 eva-vashkevich

/backport-bot v2.12.2 release-2.12

eva-vashkevich avatar Aug 19 '25 16:08 eva-vashkevich

Not creating port PR, there was an error running git am -3:

Applying: disable edit when view mode
.git/rebase-apply/patch:255: trailing whitespace.
    
.git/rebase-apply/patch:258: trailing whitespace.
        
.git/rebase-apply/patch:259: trailing whitespace.
        return false; 
.git/rebase-apply/patch:263: trailing whitespace.
    
warning: 4 lines add whitespace errors.
Using index info to reconstruct a base tree...
M	shell/edit/provisioning.cattle.io.cluster/tabs/etcd/S3Config.vue
Falling back to patching base and 3-way merge...
Auto-merging shell/edit/provisioning.cattle.io.cluster/tabs/etcd/S3Config.vue
CONFLICT (content): Merge conflict in shell/edit/provisioning.cattle.io.cluster/tabs/etcd/S3Config.vue
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 disable edit when view mode