Skip to content

Commit

Permalink
UI: validate console URL schema
Browse files Browse the repository at this point in the history
Ensure the console URL is configured with a schema matching the regular
expression `^[a-z]+:\/\/`. Otherwise disable the console button.
This allows all sorts of URL schemas, even non-standard ones, but also
ensures that a sane URL is entered.

Signed-off-by: Moritz Röhrich <moritz.rohrich@suse.com>
  • Loading branch information
m-ildefons committed Jul 2, 2024
1 parent 84e88c8 commit 5b89aca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/harvester/models/harvester/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ export default class HciNode extends HarvesterResource {

get consoleUrl() {
const url = this.metadata?.annotations?.[HCI_ANNOTATIONS.HOST_CONSOLE_URL];
const validator = /^[a-z]+:\/\//;

if (!url) {
if ((!url) || (url.match(validator) === null)) {
return false;
}

Expand Down

0 comments on commit 5b89aca

Please sign in to comment.