Skip to content

Conversation

@tannerjones4075
Copy link

@tannerjones4075 tannerjones4075 commented Apr 17, 2025

What type of PR is this?

Uncomment one (or more) /kind <> lines:

/kind bug

/kind cleanup

/kind design

/kind documentation

/kind failing-test

feature

/kind flaky-test

Any specific area of the project related to this PR?

Uncomment one (or more) /area <> lines:

/area library

cli

tests

/area examples

What this PR does / why we need it:

Added --insecure flag to registry auth basic command

  • Allows authentication to registries using plain HTTP (non-HTTPS) connections
  • Useful for local development and testing with private registries
  • Helps when working with registries that don't have TLS configured
  • Example usage: falcoctl registry auth basic -u username -p password localhost:5000 --insecure
  • This feature makes it easier to work with local and development registries that don't have TLS certificates configured, improving the development workflow and testing capabilities.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:
I tested this by created a local private registry and authenticated to it with the insecure tag and I was able to pull and pull from the registry:

docker run -d -p 5001:5000 --name registry1 registry:2  
./falcoctl registry auth basic --insecure -u testuser -p testpass --config ~/.falcoctl/config.yaml http://localhost:5001

Tanner Jones added 3 commits April 15, 2025 17:05
…S connections

The --insecure flag now provides dual functionality for registry authentication:
1. Allows insecure HTTPS connections by skipping certificate verification
2. Enables plain HTTP connections when HTTPS is not available

This change improves compatibility with both:
- Self-signed/invalid HTTPS certificates
- Legacy registries that only support HTTP

Technical changes:
- Updated URL handling in registry authentication
- Modified GetRegistryFromRef to properly handle HTTP/HTTPS schemes
- Enhanced login flow to support fallback to HTTP when HTTPS fails
- Improved error handling for connection attempts

Breaking changes: None

Signed-off-by: Tanner Jones <tanner@testifysec.com>
Add test cases to verify the behavior of the --insecure flag in registry authentication:
- Test successful HTTP connections when --insecure is used
- Test successful HTTPS connections with self-signed certificates when --insecure is used
- Test failure of HTTPS connections with invalid certificates when --insecure is not used
- Test failure of HTTP connections when --insecure is not used

These tests ensure that the --insecure flag properly handles both:
1. Allowing plain HTTP connections
2. Skipping certificate verification for HTTPS connections

The test suite uses a local test registry with both HTTP and HTTPS (self-signed) endpoints
to verify the authentication behavior in different security contexts.

Signed-off-by: Tanner Jones <tanner@testifysec.com>
Signed-off-by: Tanner Jones <tanner@testifysec.com>
@poiana
Copy link
Contributor

poiana commented Apr 17, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tannerjones4075
Once this PR has been reviewed and has the lgtm label, please assign leogr for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@poiana poiana requested review from alacuku and leogr April 17, 2025 21:52
@poiana poiana added the size/L label Apr 17, 2025
@cpanato
Copy link
Member

cpanato commented Apr 18, 2025

/ok-to-test

@tannerjones4075
Copy link
Author

/ok-to-test

Any movement? I don't see any additional tests being ran.

@leogr
Copy link
Member

leogr commented May 19, 2025

/ok-to-test

Any movement? I don't see any additional tests being ran.

ok-to-test is not actually needed here, sorry. Also, I apologize for the delay in reviewing this PR (we have been busy with the upcoming release). Still, I want to assure you that this PR is under our radar. Thank tyou

@leogr leogr requested a review from Copilot May 21, 2025 08:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds an --insecure flag to the registry auth basic command to allow plain HTTP connections and skip TLS certificate verification.

  • Updates the OCI auth client to support InsecureSkipVerify via a new WithInsecure option.
  • Enhances the basic login flow to detect http:///https:// schemes and apply insecure or fallback behavior.
  • Binds the new flag in the CLI, updates utilities for scheme stripping, and adds tests for various insecure scenarios.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/oci/authn/client.go Added Insecure option and configures transport to skip TLS verify.
internal/utils/validate.go Strips http:///https:// prefixes before extracting registry name.
internal/login/basic/basic.go Implements insecure flag logic: scheme detection, fallback, and errors.
cmd/registry/auth/basic/basic.go Binds --insecure, passes WithInsecure() to client creation.
cmd/registry/auth/basic/basic_test.go Tests covering HTTP/HTTPS success and failure with/without --insecure.
Comments suppressed due to low confidence (4)

cmd/registry/auth/basic/basic.go:29

  • The import oras.land/oras-go/v2/registry/remote/auth is unused in this file and should be removed to keep imports clean.
"oras.land/oras-go/v2/registry/remote/auth",

cmd/registry/auth/basic/basic.go:84

  • [nitpick] The flag description only mentions SSL certs; consider clarifying that --insecure also enables plain HTTP and skips TLS verification for self-signed certificates.
--insecure          allow connections to SSL registry without certs

internal/login/basic/basic.go:61

  • [nitpick] This error message could be more informative by including the registry hostname, e.g., cannot use plain HTTP for %q without --insecure flag.
return fmt.Errorf("cannot use plain HTTP without --insecure flag")

internal/utils/validate.go:26

  • The strings.TrimPrefix calls require importing the strings package. Add import "strings" to avoid a compile error.
ref = strings.TrimPrefix(strings.TrimPrefix(ref, "http://"), "https://")

tannerjones4075 and others added 2 commits May 30, 2025 09:58
remove duplicative r.CheckConnection(ctx)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Tanner Jones <78619684+tannerjones4075@users.noreply.github.com>
…s4075/falcoctl into feature/insecure-flag

Signed-off-by: Tanner Jones <tanner@testifysec.com>
@tannerjones4075 tannerjones4075 force-pushed the feature/insecure-flag branch from 28a2768 to 0f153fe Compare June 3, 2025 17:26
@poiana
Copy link
Contributor

poiana commented Jun 3, 2025

Thanks for your pull request. Before we can look at it, you'll need to add a 'DCO signoff' to your commits.

📝 Please follow instructions in the contributing guide to update your commits with the DCO

Full details of the Developer Certificate of Origin can be found at developercertificate.org.

The list of commits missing DCO signoff:

  • a50792f removed unused package and improve error messaging
Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@poiana
Copy link
Contributor

poiana commented Sep 1, 2025

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@leogr
Copy link
Member

leogr commented Sep 2, 2025

/lifecycle stale

@poiana
Copy link
Contributor

poiana commented Oct 2, 2025

Stale issues rot after 30d of inactivity.

Mark the issue as fresh with /remove-lifecycle rotten.

Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle rotten

@leogr
Copy link
Member

leogr commented Oct 6, 2025

/remove-lifecycle rotten

@poiana
Copy link
Contributor

poiana commented Jan 4, 2026

Issues go stale after 90d of inactivity.

Mark the issue as fresh with /remove-lifecycle stale.

Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Provide feedback via https://github.com/falcosecurity/community.

/lifecycle stale

@leogr
Copy link
Member

leogr commented Jan 7, 2026

/remove-lifecycle stale

@leogr
Copy link
Member

leogr commented Jan 14, 2026

Hi @tannerjones4075,

First of all, thanks for this PR, since the --insecure flag may be a reasonable feature for local development workflows.

However, commits are missing DCO sign-off, which is required for merging. Moreover, since this PR has been open for a while without activity, I'm going to close it for now to keep our backlog tidy. Please don't take this personally. Your contribution is appreciated!

Feel free to reopen this PR (or open a fresh one) if you have time to revisit it. We're happy to help if you have any questions.

Thanks again 🙏

@leogr
Copy link
Member

leogr commented Jan 14, 2026

/close

@poiana poiana closed this Jan 14, 2026
@poiana
Copy link
Contributor

poiana commented Jan 14, 2026

@leogr: Closed this PR.

Details

In response to this:

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@github-project-automation github-project-automation bot moved this from Todo to Done in Falco Roadmap Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants