Skip to content
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

SNOW-1825607 Initial OCSP deprecation plan steps #973

Merged
merged 18 commits into from
Dec 5, 2024

Conversation

sfc-gh-ext-simba-jy
Copy link
Collaborator

@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy commented Nov 25, 2024

Description

Please explain the changes you made here.

  • FAIL_OPEN log changed (message + log level)?
  • FAIL_OPEN passing request along if responder URL is missing?
  • FAIL_CLOSED - no NPE if responder URL is missing? Please check the message below about this.
    Updated: the driver will log the debug message and return callback with null if the OCSP status is FAIL_OPEN. If the status is FAIL_CLOSED, the driver will log the error message and return callback with the error.
  • Retries and timeouts confirmed (both to responder and cache server)?
  • disableOCSPChecks introduced?
    • Deprecated insecureMode?
    • disableOCSPChecks has precedence?

Checklist

  • Format code according to the existing code style (run npm run lint:check -- CHANGED_FILES and fix problems in changed code)
  • Create tests which fail without the change (if possible)
  • Make all tests (unit and integration) pass (npm run test:unit and npm run test:integration)
  • Extend the README / documentation and ensure is properly displayed (if necessary)
  • Provide JIRA issue id (if possible) or GitHub issue id in commit message

@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy requested a review from a team as a code owner November 25, 2024 19:23
@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy changed the title testing SNOW-1825607 Nov 25, 2024
@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy marked this pull request as draft November 25, 2024 19:24
@sfc-gh-ext-simba-jy
Copy link
Collaborator Author

sfc-gh-ext-simba-jy commented Nov 26, 2024

It seems like the node.js driver does not have the use case that the responder URL does not exist according to the code:

let parsedUrl = require('url').parse(process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL);
. As we have the default OCSP_RESPONSE_CACHE_SERVER_URL and there will be no error for the responder URL, this will not throw the error like JDBC.

@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy marked this pull request as ready for review November 26, 2024 00:20
@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy changed the title SNOW-1825607 SNOW-1825607 Initialal OCSP deprecation plan steps Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.94%. Comparing base (b74508b) to head (a3d8d8e).

Files with missing lines Patch % Lines
lib/agent/check.js 42.85% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #973      +/-   ##
==========================================
- Coverage   88.96%   88.94%   -0.03%     
==========================================
  Files          70       70              
  Lines        6825     6830       +5     
==========================================
+ Hits         6072     6075       +3     
- Misses        753      755       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

lib/agent/socket_util.js Show resolved Hide resolved
lib/agent/socket_util.js Outdated Show resolved Hide resolved
lib/core.js Outdated Show resolved Hide resolved
lib/core.js Outdated Show resolved Hide resolved
test/unit/ocsp/test_unit_ocsp_mode.js Show resolved Hide resolved
test/unit/snowflake_config_test.js Show resolved Hide resolved
@sfc-gh-pfus
Copy link
Collaborator

It seems like the node.js driver does not have the use case that the responder URL does not exist according to the code:

let parsedUrl = require('url').parse(process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL);

. As we have the default OCSP_RESPONSE_CACHE_SERVER_URL and there will be no error for the responder URL, this will not throw the error like JDBC.

What you mentioned is not a responder URL - it is a cache server URL. Responder URL is provided in each certificate.

@sfc-gh-dszmolka sfc-gh-dszmolka changed the title SNOW-1825607 Initialal OCSP deprecation plan steps SNOW-1825607 Initial OCSP deprecation plan steps Nov 26, 2024
@sfc-gh-dszmolka
Copy link
Collaborator

sfc-gh-dszmolka commented Nov 26, 2024

It seems like the node.js driver does not have the use case that the responder URL does not exist according to the code:

let parsedUrl = require('url').parse(process.env.SF_OCSP_RESPONSE_CACHE_SERVER_URL);

. As we have the default OCSP_RESPONSE_CACHE_SERVER_URL and there will be no error for the responder URL, this will not throw the error like JDBC.

OCSP Responder url != OCSP Cache URL. The (default) OCSP Cache URL is always the same, by default, ocsp.snowflakecomputing.com (gracefully ignoring privatelink situations here)

However OCSP Responder URL is not from Snowflake. It is always hardcoded into the particular certificate, which is under verification. See this random cert as an example: https://crt.sh/?sha256=9c3f2fd11c57d7c649ad5a0932c0f0d29756f6a0a1c74c43e1e89a62d64cd320

            Authority Information Access: 
                CA Issuers - URI:http://i.pki.goog/r4.crt

It does not have OCSP endpoint. The driver today will complain if it encounters such certs which doesn't have the OCSP endpoint, because the driver expects the cert to have it. See this issue what exactly happens: #932

As a comparison, here's a cert which does have OCSP endpoint: https://crt.sh/?id=12092745633
Observe:

            Authority Information Access: 
>>>>            OCSP - URI:http://ocsp.r2m03.amazontrust.com
                CA Issuers - URI:http://crt.r2m03.amazontrust.com/r2m03.cer

(this section is missing from the first cert)

The goal here, is for the driver if encountering a cert without the said OCSP endpoint, then it should just log the debug-level message and gracefully continue as if the verification was successful.
Implementing this change will also fix 932.

edit: I see Piotr also pointed the same out while I was typing this message :)

index.d.ts Outdated Show resolved Hide resolved
@sfc-gh-pmotacki
Copy link
Collaborator

sfc-gh-pmotacki commented Dec 3, 2024

Hi @sfc-gh-ext-simba-jy. Because we are planning to release the BCR in the next version, we have an option to remove the old parameter entirely, not only to set it deprecated. Could you make changes to the PR?

@sfc-gh-ext-simba-jy
Copy link
Collaborator Author

@sfc-gh-pmotacki, I removed the old option (insecureConnect). Please have a look.

Copy link
Collaborator

@sfc-gh-pmotacki sfc-gh-pmotacki left a comment

Choose a reason for hiding this comment

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

LGTM

@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy merged commit a714851 into master Dec 5, 2024
56 of 57 checks passed
@sfc-gh-ext-simba-jy sfc-gh-ext-simba-jy deleted the SNOW-1825607 branch December 5, 2024 17:29
@github-actions github-actions bot locked and limited conversation to collaborators Dec 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants