Skip to content

fix(bundle): gate name.Insecure behind --remote-skip-tls (CWE-319) - #3200

Open
divyansh42 wants to merge 1 commit into
tektoncd:mainfrom
divyansh42:fix/SRVKP-13805-bundle-insecure-registry
Open

fix(bundle): gate name.Insecure behind --remote-skip-tls (CWE-319)#3200
divyansh42 wants to merge 1 commit into
tektoncd:mainfrom
divyansh42:fix/SRVKP-13805-bundle-insecure-registry

Conversation

@divyansh42

@divyansh42 divyansh42 commented Sep 7, 2026

Copy link
Copy Markdown
Member

Changes

tkn bundle push and tkn bundle list unconditionally passed name.Insecure to every name.ParseReference call, enabling plain-HTTP registry connections without user consent (CWE-319 / ASVS V9.1.1). This creates a MitM risk on untrusted networks.

This PR fixes the issue by:

  • Adding RemoteOptions.NameOptions() []name.Option in pkg/bundle/flags.go — returns []name.Option{name.Insecure} only when --remote-skip-tls is explicitly set, nil otherwise. Validation mode is left to the caller; bundle push/list prepend name.StrictValidation explicitly to preserve existing strict-reference behaviour. task start is unchanged.
  • Replacing the hardcoded name.Insecure arguments in push.go (PreRunE + parseArgsAndFlags) and list.go (PreRunE) with NameOptions() calls.
  • Fixing a secondary bug: ToOptions() was mutating http.DefaultTransport in-place. Now uses .Clone() so the global transport is never modified. Uses r.skipTLS instead of literal true for InsecureSkipVerify.
  • Updating the --remote-skip-tls flag description to clarify it also enables plain-HTTP connections, not just cert-check bypass.
  • Regenerating docs and man pages for bundle push and bundle list.

Fixes: https://redhat.atlassian.net/browse/SRVKP-13805

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

  • Includes tests (if functionality changed/added)
  • Run the code checkers with make check
  • Regenerate the manpages, docs and go formatting with make generated
  • Commit messages follow commit message best practices

See the contribution guide
for more details.

Release Notes

action required: tkn bundle push/list no longer allow plain-HTTP registry connections by default. Pass --remote-skip-tls to opt in to insecure (HTTP) registry access.

@tekton-robot tekton-robot added the release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. label Sep 7, 2026
@tekton-robot tekton-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 7, 2026
Comment thread pkg/bundle/flags.go Fixed
@divyansh42
divyansh42 force-pushed the fix/SRVKP-13805-bundle-insecure-registry branch from 224f13f to 77d7238 Compare September 7, 2026 07:46
@tekton-robot tekton-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 7, 2026
@divyansh42
divyansh42 force-pushed the fix/SRVKP-13805-bundle-insecure-registry branch from 9f89200 to d532a47 Compare September 7, 2026 08:08
@divyansh42
divyansh42 requested a balanced review from Copilot September 7, 2026 08:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Plain HTTP remains implicitly enabled for local/private registries, task image parsing regresses, and security-focused tests are missing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Hardens registry handling by gating insecure connections behind --remote-skip-tls.

Changes:

  • Adds centralized registry-name options and clones the default transport.
  • Updates bundle and task reference parsing.
  • Clarifies generated flag documentation.
File summaries
File Description
pkg/bundle/flags.go Adds registry parsing options and transport cloning.
pkg/cmd/bundle/push.go Applies secure parsing to bundle pushes.
pkg/cmd/bundle/list.go Applies secure parsing to bundle listing.
pkg/cmd/task/start.go Applies remote options to OCI task bundles.
docs/cmd/tkn_bundle_push.md Updates push flag documentation.
docs/cmd/tkn_bundle_list.md Updates list flag documentation.
docs/cmd/tkn_task_start.md Updates task-start flag documentation.
docs/man/man1/tkn-bundle-push.1 Updates generated push man page.
docs/man/man1/tkn-bundle-list.1 Updates generated list man page.
docs/man/man1/tkn-task-start.1 Updates generated task-start man page.
Review details

Suppressed comments (1)

pkg/bundle/flags.go:60

  • The new security boundary has no accompanying test changes. Please add coverage for both flag states using non-local and RFC1918/loopback references, asserting the resulting scheme/connection policy; the existing loopback registry tests cannot prove the advertised secure default because go-containerregistry automatically treats loopback as HTTP.
func (r *RemoteOptions) NameOptions() []name.Option {
	opts := []name.Option{name.StrictValidation}
	if r.skipTLS {
		opts = append(opts, name.Insecure)
	}
	return opts
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/bundle/flags.go Outdated
Comment thread pkg/cmd/task/start.go Outdated
@divyansh42
divyansh42 force-pushed the fix/SRVKP-13805-bundle-insecure-registry branch 2 times, most recently from ee9b185 to f92d3c0 Compare September 7, 2026 08:37
@divyansh42
divyansh42 requested a balanced review from Copilot September 7, 2026 08:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Cleartext remains enabled by default for local/private registries, while task image TLS bypass now forces HTTP.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 10/10 changed files
  • Comments generated: 2
  • Review effort level: Balanced

Comment thread pkg/bundle/flags.go
Comment thread pkg/cmd/task/start.go Outdated
@divyansh42

Copy link
Copy Markdown
Member Author

/hold

@tekton-robot tekton-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 7, 2026
@divyansh42
divyansh42 marked this pull request as draft September 7, 2026 09:57
@tekton-robot tekton-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 7, 2026
@divyansh42
divyansh42 force-pushed the fix/SRVKP-13805-bundle-insecure-registry branch from f92d3c0 to c91ca91 Compare September 7, 2026 12:56
@divyansh42
divyansh42 marked this pull request as ready for review September 7, 2026 13:02
@tekton-robot tekton-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 7, 2026
tkn bundle push and tkn bundle list unconditionally passed name.Insecure
to name.ParseReference, enabling plain-HTTP registry connections without
user consent (CWE-319 / ASVS V9.1.1).

Add RemoteOptions.NameOptions() in pkg/bundle/flags.go that returns
[]name.Option{name.Insecure} only when --remote-skip-tls is explicitly
set, and nil otherwise. Validation mode is left to the caller; bundle
push/list prepend name.StrictValidation explicitly to preserve existing
strict-reference behaviour. task start is unchanged.

Also fix a secondary issue in ToOptions(): http.DefaultTransport was
mutated in-place via a type-assertion pointer. Use .Clone() instead to
avoid permanently poisoning the global transport. Set InsecureSkipVerify
to r.skipTLS (variable) rather than a literal true.

Update --remote-skip-tls flag description to clarify it also enables
plain-HTTP connections, not just cert-check bypass. Regenerate docs
and man pages for bundle push and bundle list.

Fixes: SRVKP-13805

Signed-off-by: Divyanshu Agrawal <diagrawa@redhat.com>
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@divyansh42
divyansh42 force-pushed the fix/SRVKP-13805-bundle-insecure-registry branch from c91ca91 to bfc97ca Compare September 7, 2026 13:04
@divyansh42

Copy link
Copy Markdown
Member Author

/retest

@divyansh42

Copy link
Copy Markdown
Member Author

/hold cancel

@tekton-robot tekton-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 7, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. release-note-action-required Denotes a PR that introduces potentially breaking changes that require user action. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants