Skip to content

Conversation

@radu-todirica
Copy link

Summary
This PR adds support for passing an already signed JWT to the Snowflake AuthTypeJwt authenticator.
If a JWT is provided, it will be used directly for authentication.
If not, the existing flow remains unchanged — the authenticator will generate a new JWT using the provided private key.

Background / Reason for Change
In our project, the private key used for Snowflake authentication is stored in AWS Secrets Manager.
Currently, every lambda function that uses the Snowflake Go driver’s requires retrieving the privateKey from AWS Secrets.
To minimize calls to AWS Secrets Manager, we want the option to sign our own JWT tokens in the authorizer lambda function, where the private key can be kept in an in-memory cache, and pass the already signed jwt from authorizer to the rest of the lambda function instead of sending the privateKey.

Changes in this PR

  • Added a check in the AuthTypeJwt authenticator to use a provided JWT if available.
  • Fallback to the existing implementation of generating a JWT with the private key if no token is passed.
  • No breaking changes — current behavior is preserved when no JWT is supplied.

Benefits

  • Allows caching the private key in our authorizer lambda to avoid repeated AWS Secrets lookups.
  • Reduces latency and AWS Secrets Manager costs.
  • Maintains backward compatibility.

@radu-todirica radu-todirica requested a review from a team as a code owner August 11, 2025 11:50
@github-actions
Copy link

github-actions bot commented Aug 11, 2025

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@radu-todirica
Copy link
Author

I have read the CLA Document and I hereby sign the CLA

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.

1 participant