Skip to content

Inherit insecureSkipTLSVerify from BSL config for CLI downloads#9768

Open
Joeavaikath wants to merge 2 commits into
velero-io:mainfrom
Joeavaikath:inherit-bsl-insecure-skip-tls-verify
Open

Inherit insecureSkipTLSVerify from BSL config for CLI downloads#9768
Joeavaikath wants to merge 2 commits into
velero-io:mainfrom
Joeavaikath:inherit-bsl-insecure-skip-tls-verify

Conversation

@Joeavaikath

@Joeavaikath Joeavaikath commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

Summary

When a BackupStorageLocation has spec.config.insecureSkipTLSVerify set to "true", the Velero CLI now inherits this setting for download requests. Previously, users had to manually pass --insecure-skip-tls-verify on every CLI command (velero backup logs, velero backup download, velero backup describe, velero restore logs, velero restore describe), even though the BSL already declared the endpoint as untrusted.

This follows the same pattern used for caCert/caCertRef inheritance — the CLI already reads CA certificates from the BSL via pkg/cmd/util/cacert/bsl_cacert.go and passes them to the download HTTP client automatically. This change adds the same treatment for insecureSkipTLSVerify.

Changes

  • New: pkg/cmd/util/cacert/bsl_insecure_tls.goGetInsecureSkipTLSVerifyFromBSL, FromBackup, FromRestore functions mirroring the existing cacert pattern
  • New: pkg/cmd/util/cacert/bsl_insecure_tls_test.go — 15 table-driven test cases (true/false/case-insensitive/nil-config/missing-key/not-found scenarios)
  • Updated: pkg/builder/backup_storage_location_builder.go — added Config(map[string]string) builder method for tests
  • Updated: CLI commands (backup/logs.go, backup/download.go, restore/logs.go, backup/describe.go, restore/describe.go) — each now reads the BSL value and merges with the CLI flag

Behavior

  • Merge logic: effectiveSkipTLS = cliFlag || bslConfigValue
  • The --insecure-skip-tls-verify CLI flag still works and overrides the BSL value
  • Errors reading the BSL config are non-fatal warnings (consistent with cacert error handling)
  • For describe commands, the merge happens per-backup/restore since each may use a different BSL

Does your change fix a particular issue?

Fixes #(issue)

Please indicate you've done the following:

When a BackupStorageLocation has spec.config.insecureSkipTLSVerify set
to "true", the CLI now inherits this for download requests (backup logs,
backup download, backup describe, restore logs, restore describe). This
follows the same pattern used for caCert inheritance. The CLI flag
--insecure-skip-tls-verify still works and overrides the BSL value.

Signed-off-by: Joseph <jvaikath@redhat.com>
Signed-off-by: Joseph <jvaikath@redhat.com>
@codecov

codecov Bot commented Apr 30, 2026

Copy link
Copy Markdown

@kaovilai kaovilai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

didn't include this in prior cacert-from-bsl cli work because insecure flag was easy enough. plus its insecure depends on local system executing. if host machine had trusted the cert, it may not be insecure on the host, only in the k8s server.

@blackpiglet blackpiglet self-requested a review May 2, 2026 03:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants