Skip to content

Commit af9ba26

Browse files
SNOW-2117147 Added certificates revocation checking with revocation lists (CRLs) (#2518)
1 parent 35c03cc commit af9ba26

File tree

15 files changed

+3687
-22
lines changed

15 files changed

+3687
-22
lines changed

DESCRIPTION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Source code is also available at: https://github.com/snowflakedb/snowflake-conne
88

99
# Release Notes
1010
- v3.18.0(TBD)
11+
- Added support for checking certificates revocation using revocation lists (CRLs)
1112
- Added the `workload_identity_impersonation_path` parameter to support service account impersonation for Workload Identity Federation on GCP and AWS workloads only
1213
- Fixed `get_results_from_sfqid` when using `DictCursor` and executing multiple statements at once
1314
- Added the `oauth_credentials_in_body` parameter supporting an option to send the oauth client credentials in the request body

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ development =
9595
pytest-timeout
9696
pytest-xdist
9797
pytzdata
98+
responses
9899
pandas =
99100
pandas>=2.1.2,<3.0.0
100101
pyarrow

src/snowflake/connector/connection.py

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,43 @@ def _get_private_bytes_from_file(
413413
False,
414414
bool,
415415
),
416+
# CRL (Certificate Revocation List) configuration parameters
417+
# The default setup is specified in CRLConfig class
418+
"cert_revocation_check_mode": (
419+
None,
420+
(type(None), str),
421+
), # CRL revocation check mode: DISABLED, ENABLED, ADVISORY
422+
"allow_certificates_without_crl_url": (
423+
None,
424+
(type(None), bool),
425+
), # Allow certificates without CRL distribution points
426+
"crl_connection_timeout_ms": (
427+
None,
428+
(type(None), int),
429+
), # Connection timeout for CRL downloads in milliseconds
430+
"crl_read_timeout_ms": (
431+
None,
432+
(type(None), int),
433+
), # Read timeout for CRL downloads in milliseconds
434+
"crl_cache_validity_hours": (
435+
None,
436+
(type(None), int),
437+
), # CRL cache validity time in hours
438+
"enable_crl_cache": (None, (type(None), bool)), # Enable CRL caching
439+
"enable_crl_file_cache": (None, (type(None), bool)), # Enable file-based CRL cache
440+
"crl_cache_dir": (None, (type(None), str)), # Directory for CRL file cache
441+
"crl_cache_removal_delay_days": (
442+
None,
443+
(type(None), int),
444+
), # Days to keep expired CRL files before removal
445+
"crl_cache_cleanup_interval_hours": (
446+
None,
447+
(type(None), int),
448+
), # CRL cache cleanup interval in hours
449+
"crl_cache_start_cleanup": (
450+
None,
451+
(type(None), bool),
452+
), # Run CRL cache cleanup in the background
416453
}
417454

418455
APPLICATION_RE = re.compile(r"[\w\d_]+")
@@ -641,6 +678,62 @@ def _ocsp_mode(self) -> OCSPMode:
641678
else:
642679
return OCSPMode.FAIL_CLOSED
643680

681+
# CRL (Certificate Revocation List) configuration properties
682+
@property
683+
def cert_revocation_check_mode(self) -> str | None:
684+
"""Certificate revocation check mode: DISABLED, ENABLED, or ADVISORY."""
685+
return self._cert_revocation_check_mode
686+
687+
@property
688+
def allow_certificates_without_crl_url(self) -> bool | None:
689+
"""Whether to allow certificates without CRL distribution points."""
690+
return self._allow_certificates_without_crl_url
691+
692+
@property
693+
def crl_connection_timeout_ms(self) -> int | None:
694+
"""Connection timeout for CRL downloads in milliseconds."""
695+
return self._crl_connection_timeout_ms
696+
697+
@property
698+
def crl_read_timeout_ms(self) -> int | None:
699+
"""Read timeout for CRL downloads in milliseconds."""
700+
return self._crl_read_timeout_ms
701+
702+
@property
703+
def crl_cache_validity_hours(self) -> int | None:
704+
"""CRL cache validity time in hours."""
705+
return self._crl_cache_validity_hours
706+
707+
@property
708+
def enable_crl_cache(self) -> bool | None:
709+
"""Whether CRL caching is enabled."""
710+
return self._enable_crl_cache
711+
712+
@property
713+
def enable_crl_file_cache(self) -> bool | None:
714+
"""Whether file-based CRL cache is enabled."""
715+
return self._enable_crl_file_cache
716+
717+
@property
718+
def crl_cache_dir(self) -> str | None:
719+
"""Directory for CRL file cache."""
720+
return self._crl_cache_dir
721+
722+
@property
723+
def crl_cache_removal_delay_days(self) -> int | None:
724+
"""Days to keep expired CRL files before removal."""
725+
return self._crl_cache_removal_delay_days
726+
727+
@property
728+
def crl_cache_cleanup_interval_hours(self) -> int | None:
729+
"""CRL cache cleanup interval in hours."""
730+
return self._crl_cache_cleanup_interval_hours
731+
732+
@property
733+
def crl_cache_start_cleanup(self) -> bool | None:
734+
"""Whether to start CRL cache cleanup immediately."""
735+
return self._crl_cache_start_cleanup
736+
644737
@property
645738
def session_id(self) -> int:
646739
return self._session_id

0 commit comments

Comments
 (0)