Skip to content
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

Cobra Rework + Refactor & Exit Codes #20

Merged
merged 2 commits into from
Nov 7, 2024
Merged

Cobra Rework + Refactor & Exit Codes #20

merged 2 commits into from
Nov 7, 2024

Conversation

Driema
Copy link
Collaborator

@Driema Driema commented Nov 5, 2024

Cobra Rework

Major Changes

  • implemented Cobra commands
  • added entry command gdown with the following subcommands:
    • file (updates/creates a single file)
    • folder (updates/creates a folder recursively)
    • version (displays the appname + version)
  • refactored code
    • optimized obsolete if-checks
    • renaming of certain methods
  • refactored project structure
    • moved code to pkg folder
    • created api folder
    • created cli folder
    • created logic folder
  • added exit codes
  • added flag validation


func httpGetInternal(fullUrl, privateToken, userAgent string) ([]byte, error) {
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},

Check failure

Code scanning / CodeQL

Disabled TLS certificate check High

InsecureSkipVerify should not be used in production code.

Copilot Autofix AI 3 months ago

To fix the problem, we need to ensure that TLS certificate verification is enabled. This involves setting InsecureSkipVerify to false and properly configuring the TLS client to trust the server's certificate. This can be done by using a certificate pool that includes the server's certificate or by relying on the system's root certificate pool.

The best way to fix this without changing existing functionality is to remove the InsecureSkipVerify: true setting and ensure that the TLS client uses a proper certificate pool. This change should be made in the httpGetInternal function in the pkg/api/api.go file.

Suggested changeset 1
pkg/api/api.go

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/pkg/api/api.go b/pkg/api/api.go
--- a/pkg/api/api.go
+++ b/pkg/api/api.go
@@ -121,3 +121,3 @@
 	tr := &http.Transport{
-		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
+		TLSClientConfig: &tls.Config{},
 	}
EOF
@@ -121,3 +121,3 @@
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
TLSClientConfig: &tls.Config{},
}
Copilot is powered by AI and may make mistakes. Always verify output.
Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
@Driema Driema self-assigned this Nov 6, 2024
@Driema Driema changed the title Cobra Rework + Refactor Cobra Rework + Refactor & Exit Codes Nov 6, 2024
@Driema Driema linked an issue Nov 6, 2024 that may be closed by this pull request
3 tasks
@Driema Driema changed the base branch from main to dev November 7, 2024 09:48
@Driema Driema merged commit 815f19f into dev Nov 7, 2024
2 of 3 checks passed
@Driema Driema deleted the feature/cobra-rework branch November 7, 2024 09:51
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.

Exit Codes
1 participant