Skip to content

Commit e83c38c

Browse files
committed
feat: use system certificates
Fixes #1067
1 parent 2d6ff01 commit e83c38c

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Added
2+
3+
- ggshield now uses the system certificates instead of the bundled ones. Note that this only works with Python >= 3.10 (#1067).

ggshield/__main__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,17 @@ def force_utf8_output():
179179
out.reconfigure(encoding="utf-8")
180180

181181

182+
def setup_truststore():
183+
"""Use the system certificates instead of the ones bundled by certifi"""
184+
if sys.version_info < (3, 10):
185+
# truststore requires Python 3.10
186+
return
187+
188+
import truststore
189+
190+
truststore.inject_into_ssl()
191+
192+
182193
def main(args: Optional[List[str]] = None) -> Any:
183194
"""
184195
Wrapper around cli.main() to handle the GITGUARDIAN_CRASH_LOG variable.
@@ -196,6 +207,7 @@ def main(args: Optional[List[str]] = None) -> Any:
196207
ui.set_ui(RichGGShieldUI())
197208

198209
force_utf8_output()
210+
setup_truststore()
199211

200212
show_crash_log = getenv_bool("GITGUARDIAN_CRASH_LOG")
201213
return cli.main(args, prog_name="ggshield", standalone_mode=not show_crash_log)

pdm.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ dependencies = [
4949
"rich~=12.5.1",
5050
"typing-extensions~=4.12.2",
5151
"urllib3~=2.2.2",
52+
"truststore>=0.10.1; python_version >= \"3.10\"",
5253
]
5354

5455
[project.urls]

0 commit comments

Comments
 (0)