Skip to content

feat(general): Add BC_CA_BUNDLE environment variable support for custom CA certificates - #7419

Merged
bo156 merged 2 commits into
mainfrom
feature/bc-ca-bundle-support
Jan 25, 2026
Merged

feat(general): Add BC_CA_BUNDLE environment variable support for custom CA certificates#7419
bo156 merged 2 commits into
mainfrom
feature/bc-ca-bundle-support

Conversation

@guyg-palo

Copy link
Copy Markdown
Contributor

Description

This PR adds support for the BC_CA_BUNDLE environment variable in the GitGetter._clone() function. When set, it configures GIT_SSL_CAINFO to use the specified CA bundle file, enabling git clone operations to work with on-prem GitLab/GitHub instances that use self-signed or custom CA certificates.

Changes

  • Modified _clone() in checkov/common/goget/github/get_git.py to check for BC_CA_BUNDLE env var
  • When BC_CA_BUNDLE is set, GIT_SSL_CAINFO is configured with its value
  • PROXY_URL settings take precedence over BC_CA_BUNDLE
  • Added 3 unit tests for the new functionality

Usage

export BC_CA_BUNDLE=/path/to/ca-bundle.crt
checkov -d . --download-external-modules true

Testing

  • ✅ All 20 unit tests passed
  • ✅ Successfully tested with self-signed certificate GitLab instance
  • ✅ Verified the SSL certificate error is resolved when BC_CA_BUNDLE is set

Checklist

  • Tests added
  • Documentation in commit message
  • Tested with real on-prem GitLab instance with self-signed certificate

@guyg-palo guyg-palo changed the title feat: Add BC_CA_BUNDLE environment variable support for custom CA certificates feat(general): Add BC_CA_BUNDLE environment variable support for custom CA certificates Jan 19, 2026
…tificates

This change adds support for the BC_CA_BUNDLE environment variable in the
GitGetter._clone() function. When set, it configures GIT_SSL_CAINFO to use
the specified CA bundle file, enabling git clone operations to work with
on-prem GitLab/GitHub instances that use self-signed or custom CA certificates.

Changes:
- Modified _clone() to check for BC_CA_BUNDLE env var
- When BC_CA_BUNDLE is set, GIT_SSL_CAINFO is configured with its value
- PROXY_URL settings take precedence over BC_CA_BUNDLE
- Added unit tests for the new functionality

Usage:
  export BC_CA_BUNDLE=/path/to/ca-bundle.crt
  checkov -d . --download-external-modules true
…riables

Updated the code to use env_vars_config from checkov.common.util.env_vars_config
instead of directly calling os.getenv(). This follows the project's pattern for
handling environment variables.

Changes:
- Import env_vars_config instead of os
- Use env_vars_config.BC_CA_BUNDLE instead of os.getenv('BC_CA_BUNDLE')
- Use env_vars_config.PROXY_* instead of os.getenv('PROXY_*')
- Updated tests to mock env_vars_config instead of os.environ
@bo156
bo156 force-pushed the feature/bc-ca-bundle-support branch from b4abfba to 84860e0 Compare January 25, 2026 12:48
@bo156
bo156 merged commit ec7a5e8 into main Jan 25, 2026
43 checks passed
@bo156
bo156 deleted the feature/bc-ca-bundle-support branch January 25, 2026 13:01
Saarett pushed a commit that referenced this pull request Jan 25, 2026
…om CA certificates (#7419)

* feat: Add BC_CA_BUNDLE environment variable support for custom CA certificates

This change adds support for the BC_CA_BUNDLE environment variable in the
GitGetter._clone() function. When set, it configures GIT_SSL_CAINFO to use
the specified CA bundle file, enabling git clone operations to work with
on-prem GitLab/GitHub instances that use self-signed or custom CA certificates.

Changes:
- Modified _clone() to check for BC_CA_BUNDLE env var
- When BC_CA_BUNDLE is set, GIT_SSL_CAINFO is configured with its value
- PROXY_URL settings take precedence over BC_CA_BUNDLE
- Added unit tests for the new functionality

Usage:
  export BC_CA_BUNDLE=/path/to/ca-bundle.crt
  checkov -d . --download-external-modules true

* refactor: Use env_vars_config instead of os.getenv for environment variables

Updated the code to use env_vars_config from checkov.common.util.env_vars_config
instead of directly calling os.getenv(). This follows the project's pattern for
handling environment variables.

Changes:
- Import env_vars_config instead of os
- Use env_vars_config.BC_CA_BUNDLE instead of os.getenv('BC_CA_BUNDLE')
- Use env_vars_config.PROXY_* instead of os.getenv('PROXY_*')
- Updated tests to mock env_vars_config instead of os.environ
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.

3 participants