-
Notifications
You must be signed in to change notification settings - Fork 180
feat: add --insecure option and deprecate --allow-self-signed #1132
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
Changes from 18 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
2bbfef3
feat(config): add insecure field to UserConfig
guischguardian a54458f
feat(cli): add --insecure option as an explicit alternative
guischguardian f054492
feat(client): add prominent warning when SSL verification is disabled
guischguardian fcecdb3
feat(cli): handle both --insecure and --allow-self-signed options
guischguardian f3faf06
test: add tests for --insecure option
guischguardian 082e59e
doc: add changelog entry for --insecure option
guischguardian ceab4da
fix(client): check both insecure and allow_self_signed flags
guischguardian 12e9d66
fix(client): correct documentation link in SSL warning message
guischguardian 04c9810
refactor(client): use ui.display_warning instead of logger.warning
guischguardian 19ed2a2
refactor(cli): update --insecure help text to match curl's wording
guischguardian 510fd39
feat(cli): add deprecation warning for --allow-self-signed option
guischguardian c973036
feat(config): add deprecation warning for allow_self_signed config key
guischguardian 2e88c0e
doc: update changelog to mention deprecation of allow_self_signed
guischguardian 0855177
style: apply pre-commit formatting fixes
guischguardian 8b5bcd3
test: add coverage for allow_self_signed config deprecation warning
guischguardian 5f34673
refactor: implement review feedback - simplify SSL verification config
guischguardian 9deb1cf
fix: replace all allow_self_signed usages with insecure
guischguardian 3e667d9
fix: ensure --allow-self-signed works when placed before subcommand
guischguardian 8983a6e
doc: update documentation link for SSL verification
guischguardian File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
changelog.d/20251016_101312_ghislain.casier_add_insecure_option.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| <!-- | ||
| A new scriv changelog fragment. | ||
|
|
||
| Uncomment the section that is right (remove the HTML comment wrapper). | ||
| For top level release notes, leave all the headers commented out. | ||
| --> | ||
|
|
||
| ### Added | ||
|
|
||
| - Added `--insecure` CLI option and `insecure` configuration setting as clearer alternatives to `--allow-self-signed` and `allow_self_signed`. The new option explicitly communicates that SSL verification is completely disabled, making the connection vulnerable to man-in-the-middle attacks. | ||
| - Added prominent warning messages when SSL verification is disabled (via either `--insecure` or `--allow-self-signed`), explaining the security risks and recommending the secure alternative of using the system certificate trust store (available with Python >= 3.10). | ||
|
|
||
| ### Deprecated | ||
|
|
||
| - The `--allow-self-signed` CLI option and `allow_self_signed` configuration setting are now deprecated in favor of `--insecure` and `insecure`. Deprecation warnings are displayed when these options are used, guiding users to the clearer alternative. Both options remain functional for backward compatibility and will be maintained for an extended deprecation period before removal. | ||
|
|
||
| ### Security | ||
|
|
||
| - Improved clarity around SSL verification settings. The `--allow-self-signed` option name was misleading as it suggests certificate validation is still performed, when in reality all SSL verification is disabled. The new `--insecure` option makes this behavior explicit. Both options remain functional for backward compatibility. | ||
|
|
||
| <!-- | ||
| ### Changed | ||
|
|
||
| - A bullet item for the Changed category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Removed | ||
|
|
||
| - A bullet item for the Removed category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Deprecated | ||
|
|
||
| - A bullet item for the Deprecated category. | ||
|
|
||
| --> | ||
| <!-- | ||
| ### Fixed | ||
|
|
||
| - A bullet item for the Fixed category. | ||
|
|
||
| --> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -87,7 +87,7 @@ class UserConfig(FilteredConfig): | |
| instance: Optional[str] = None | ||
| exit_zero: bool = False | ||
| verbose: bool = False | ||
| allow_self_signed: bool = False | ||
| insecure: bool = False | ||
guischguardian marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| max_commits_for_hook: int = 50 | ||
| secret: SecretConfig = field(default_factory=SecretConfig) | ||
| debug: bool = False | ||
|
|
@@ -198,6 +198,7 @@ def _load_config_dict( | |
| if dash_keys: | ||
| _warn_about_dash_keys(config_path, dash_keys) | ||
| _fix_ignore_known_secrets(dct) | ||
| _fix_allow_self_signed(dct, config_path) | ||
| elif config_version == 1: | ||
| deprecation_messages.append( | ||
| f"{config_path} uses a deprecated configuration file format." | ||
|
|
@@ -226,6 +227,16 @@ def _fix_ignore_known_secrets(data: Dict[str, Any]) -> None: | |
| secret_dct[_IGNORE_KNOWN_SECRETS_KEY] = value | ||
|
|
||
|
|
||
| def _fix_allow_self_signed(data: Dict[str, Any], config_path: Path) -> None: | ||
| """Convert allow_self_signed to insecure and display a deprecation warning.""" | ||
| if insecure := data.pop("allow_self_signed", None): | ||
| ui.display_warning( | ||
| f"{config_path}: The 'allow_self_signed' option is deprecated. " | ||
| "Use 'insecure: true' instead." | ||
| ) | ||
| data["insecure"] = insecure | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Self-Signed Override Ignores User ConfigThe |
||
|
|
||
| def _warn_about_dash_keys(config_path: Path, dash_keys: Set[str]) -> None: | ||
| for old_key in sorted(dash_keys): | ||
| new_key = old_key.replace("-", "_") | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Bug: Insecure Parameter Mismatch
The
clifunction's signature now expectsinsecure, but the--allow-self-signedoption is still active. When used, Click attempts to pass anallow_self_signedparameter, causing aTypeErrorsince the function no longer accepts it.