8000 feat: add support for insecure config loading via new CLI flag by appleboy · Pull Request #31 · TBXark/mcp-proxy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: add support for insecure config loading via new CLI flag #31

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 28, 2025

Conversation

appleboy
Copy link
Contributor
  • Add support for loading configuration using an insecure HTTP client with disabled TLS verification
  • Update confstore dependency to version 0.0.5
  • Introduce an --insecure command line flag for optionally allowing insecure HTTP connections during config loading

fix #25

- Add support for loading configuration using an insecure HTTP client with disabled TLS verification
- Update confstore dependency to version 0.0.5
- Introduce an --insecure command line flag for optionally allowing insecure HTTP connections during config loading

fix TBXark#25

Signed-off-by: appleboy <appleboy.tw@gmail.com>
Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @appleboy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request implements a new feature that enables the application to load configuration from potentially insecure HTTP(S) sources. It achieves this by introducing a new command-line flag that, when enabled, instructs the application to bypass TLS certificate verification during the configuration fetching process. This enhancement provides greater flexibility for users operating in diverse network environments.

Highlights

  • New CLI Flag: Introduced an --insecure command-line flag to allow disabling TLS verification when fetching configuration files over HTTP(S). This provides an option for environments where strict TLS might not be required or for development/testing purposes.
  • Insecure HTTP Client Support: The configuration loading logic in config.go was updated to conditionally create and use an http.Client with InsecureSkipVerify set to true when the new --insecure flag is provided. This client is then passed to the confstore library.
  • Dependency Update: The confstore library dependency was updated from v0.0.4 to v0.0.5. This update is necessary to utilize the new confstore.WithHTTPClientOption feature, which allows passing a custom HTTP client for configuration loading.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor
@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the --insecure flag, enabling configuration fetching over HTTPS with disabled TLS verification. I suggest cloning the default transport for the custom HTTP client and adding a warning log when the application runs in insecure mode. A minor improvement to the flag's help text is also suggested.

Comment on lines +136 to +143
if insecure {
httpClient = &http.Client{
Transport: &http.Transport{
// Disable TLS verification for insecure connections
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
},
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Instead of creating a new http.Transport from scratch, consider cloning http.DefaultTransport to preserve its default settings (e.g., timeouts, keep-alives).

	if insecure {
		transport := http.DefaultTransport.(*http.Transport).Clone()
		transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
		httpClient = &http.Client{Transport: transport}
	}

main.go Outdated
Comment on lines 14 to 15
insecure := flag.Bool("insecure", false, "use insecure connection for http requests")
help := flag.Bool("help", false, "print help and exit")
Copy link
Contributor

Choose a reason for hiding this comment

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

high

Log a prominent warning when the application starts with the --insecure flag to highlight the security implications.

	insecure := flag.Bool("insecure", false, "use insecure connection for http requests")
	flag.Parse()
	if *insecure {
		log.Println("WARNING: Insecure mode enabled. TLS certificate verification is disabled for fetching configuration.")
	}

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@TBXark TBXark merged commit 8cde814 into TBXark:master Jun 28, 2025
@appleboy
Copy link
Contributor Author

@TBXark, maybe merged tothe dev branch?

TBXark added a commit that referenced this pull request Jun 28, 2025
@TBXark
Copy link
Owner
TBXark commented Jun 28, 2025

Lol, I forgot to switch.

@appleboy
Copy link
Contributor Author

@TBXark Maybe switch the development flow to GitHub flow (only one master branch, tag version for release).

@TBXark
Copy link
Owner
TBXark commented Jun 28, 2025

Previously, to speed up docker image updates for testing and avoid setting the version each time, I configured it so that every push to the master branch would automatically trigger compilation and updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Option to Skip TLS Verification for Remote Config URL (e.g., InsecureSkipVerify)
2 participants
0