-
Notifications
You must be signed in to change notification settings - Fork 45
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
Conversation
- 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>
There was a problem hiding this 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 anhttp.Client
withInsecureSkipVerify
set totrue
when the new--insecure
flag is provided. This client is then passed to theconfstore
library. - Dependency Update: The
confstore
library dependency was updated fromv0.0.4
tov0.0.5
. This update is necessary to utilize the newconfstore.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
-
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. ↩
There was a problem hiding this 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.
if insecure { | ||
httpClient = &http.Client{ | ||
Transport: &http.Transport{ | ||
// Disable TLS verification for insecure connections | ||
TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, | ||
}, | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
insecure := flag.Bool("insecure", false, "use insecure connection for http requests") | ||
help := flag.Bool("help", false, "print help and exit") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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, maybe merged tothe dev branch? |
Lol, I forgot to switch. |
@TBXark Maybe switch the development flow to GitHub flow (only one master branch, tag version for release). |
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. |
fix #25