Skip to content

Conversation

@adreed-msft
Copy link
Member

Description

Feature / Bug Fix:

Posed as an alternative to #3277, in this case we disable certificate validation entirely when requested. This technically comes with the additional benefit of avoiding any fly-swatting, at the detriment of potentially letting danger in the door.

Related Links:

Type of Change

  • Bug fix
  • New feature
  • Documentation update required
  • Code quality improvement
  • Other (describe):

How Has This Been Tested?

manually tested against mitm proxy

Copilot AI review requested due to automatic review settings November 5, 2025 22:06
@adreed-msft adreed-msft changed the title Adreed/mitm cert2 Allow disabling cert validation entirely Nov 5, 2025
Copy link
Contributor

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

This PR adds support for an --allow-insecure-certs flag to enable debugging with MITM proxies. The flag is hidden and intended only for debugging purposes, allowing TLS certificate verification to be skipped when enabled.

Key Changes

  • Introduces a global common.AllowInsecureCerts boolean flag
  • Adds --allow-insecure-certs command-line flag (hidden)
  • Configures TLSClientConfig.InsecureSkipVerify across all HTTP clients in the application

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
cmd/constants.go Defines the AllowInsecureCertificatesFlag constant
cmd/root.go Adds the hidden --allow-insecure-certs flag and applies it to the GitHub version check HTTP transport
common/oauthTokenManager.go Declares the AllowInsecureCerts global variable and applies it to OAuth HTTP client
ste/mgr-JobPartMgr.go Applies AllowInsecureCerts to the main AzCopy HTTP client
ste/performanceAdvisor.go Applies AllowInsecureCerts to the Azure VM metadata service HTTP client

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +350 to +354
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: common.AllowInsecureCerts,
},
},
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The Azure Instance Metadata Service uses HTTP (not HTTPS), so configuring TLS settings for this client is unnecessary. The TLSClientConfig will have no effect on HTTP requests. Consider removing the TLS configuration for this specific client or adding a comment explaining why it's present despite using HTTP.

Suggested change
Transport: &http.Transport{
TLSClientConfig: &tls.Config{
InsecureSkipVerify: common.AllowInsecureCerts,
},
},
Transport: &http.Transport{},

Copilot uses AI. Check for mistakes.
HardlinksFlag = "hardlinks"

// root command flags
AllowInsecureCertificatesFlag = "allow-insecure-certs"
Copy link
Member

Choose a reason for hiding this comment

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

design question - would this be better as an environment variable over a CLI param?

@gapra-msft
Copy link
Member

If this is trying to fix the same thing that the other PR is, I'd almost prefer just to have the customer use the Go environment variable.

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.

4 participants