Skip to content

Conversation

@sfc-gh-turbaszek
Copy link
Contributor

No description provided.

logger.debug(
"The certificate revocation check was successful. No additional checks will be performed."
)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

CRL glue code in AIO

@sfc-gh-turbaszek sfc-gh-turbaszek force-pushed the turbaszek-crl-cherry-picks branch 5 times, most recently from 1c99adf to f692c62 Compare November 5, 2025 15:01

def validate_crl(self, protocol: ResponseHandler, req: ClientRequest):
# Resolve CA file path from environment variables or use certifi default
cafile_for_ctx = resolve_cafile({"ca_certs": certifi.where()})
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this cover all env vars being used to pass certs location?
In requests.request we have this parameter passed later to conn.ca_certs if specified.

            verify = (
                os.environ.get("REQUESTS_CA_BUNDLE")
                or os.environ.get("CURL_CA_BUNDLE")
                or verify
            )

I see that we use resolve_cafile which parses env vars, but should we support CURL_CA_BUNDLE as well there? Also do we maintain the same hierarchy - is certify.where used when no env vars are provided or other way around?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we add os.environ.get("CURL_CA_BUNDLE") to resolve_cafile implementation to keep the logic in single place?

Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski Nov 6, 2025

Choose a reason for hiding this comment

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

Thats one thing - add in implementation. Having tests for passing certs in such way maybe a JIRA to be created - since we support it by our code but don't test it.

Also the mentioned hierarchy should be tested imo - if certify.where() overrides the env vars or is it the other way around. I have concerns this may differ between async and sync code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The async code tries to duplicate sync version:

    # Ensure CA bundle default if not provided
    if not params.get("ca_certs"):
        params["ca_certs"] = certifi.where()

    cafile_for_ctx = resolve_cafile(params)

Created SNOW-2681235 for CURL_CA_BUNDLE support. For now, I would suggest to keep this out of aio equation.

Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski Nov 12, 2025

Choose a reason for hiding this comment

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

Sure, fyi below is how I was able to understand the urllib3 flow for ca_certs - since we do not have adapters for aiohttp those steps we may want to replicate ourselves.

Specifically the fact, that 2 env vars overwrite the certify.where result.
But if we want to do that in the follow-up Jira I am okay with that.

Priority Source File:Line Usage
1 session.get(verify="/path") sessions.py:777 Request-level override
2 session.verify = "/path" sessions.py:426+777 Session-level default
3 REQUESTS_CA_BUNDLE env sessions.py:769 Only if verify=True/None
4 CURL_CA_BUNDLE env sessions.py:770 Only if verify=True/None
5 certifi.where() no 1 adapters.py:295 Via DEFAULT_CA_BUNDLE_PATH
6 certifi.where() no 2 ssl_wrap_socket.py:176 Direct call fallback
7 SSL_CERT_FILE env ssl_wrap_socket.py:62 Via resolve_cafile()

@sfc-gh-fpawlowski
Copy link
Contributor

Fyi: for our tests most SSL checks will happen in synch init_test_schema fixture - which is autoused for the whole testing session. Just so we are aware we need really good tests for that as async code isn't using it under the hood in tests.

session_manager = Mock()
session_manager.clone = lambda max_retries: "session_manager"

return Auth.base_auth_data(
Copy link
Contributor

Choose a reason for hiding this comment

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

We may be lacking import of this Auth class

@sfc-gh-turbaszek sfc-gh-turbaszek force-pushed the turbaszek-crl-cherry-picks branch from 4da8202 to df35306 Compare November 12, 2025 15:00
Copy link
Contributor

@sfc-gh-fpawlowski sfc-gh-fpawlowski left a comment

Choose a reason for hiding this comment

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

Some nits left in comments, but seems good already to me

@sfc-gh-turbaszek sfc-gh-turbaszek marked this pull request as ready for review November 13, 2025 09:27
@sfc-gh-turbaszek sfc-gh-turbaszek force-pushed the turbaszek-crl-cherry-picks branch from 14d3c6d to 2770866 Compare November 13, 2025 10:20
@sfc-gh-turbaszek sfc-gh-turbaszek force-pushed the turbaszek-crl-cherry-picks branch from b7a0b1b to f4622e5 Compare November 14, 2025 10:13
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.

5 participants