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

[APPS-47043] Allow user to provide a specific port and host for containerized environment #1004

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sfc-gh-klin
Copy link
Contributor

@sfc-gh-klin sfc-gh-klin commented Feb 7, 2025

To give some background, customers who use the VS Code extension for Snowflake in a remote environment cannot easily SSO via SAML because of the user's local machine and the remote machine boundary. When the Identity Provider redirected eventually to the listening server with the token in the url, the listening server is in the remote machine and the user's local machine fails to communicate to the remote server to pass the token along.

The previous solution in the VS Code extension was to let the user copy-paste that redirect address and give it to the extension.

SSO support in virtualized environments.

But it's a little clunky and users would like to just have it happen automatically. This would entail adding a configuration option in the extension + the configuration in the Node Connector to enable selection of a specific port and address. Then the customers' networking admins can hook up the port and host between their local and their remote and it will happen smoothly.

It is similar to this change in the python connector, but thru the configuration rather than environment variable.
snowflakedb/snowflake-connector-python#932

What do you think of this approach?

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 types in index.d.ts file (if necessary)
  • 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-klin sfc-gh-klin requested a review from a team as a code owner February 7, 2025 00:37
Copy link

github-actions bot commented Feb 7, 2025


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


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


Kelly Huntlin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

index.d.ts Outdated
/**
* Custom socket port to use for the local SAML server. Useful for SSO in containerized environments.
*/
localSamlServerPort?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you consider unifying these two parameters and specify one name e.g. samlRedirectUri? It would be great in term of consistency with our configuration variable oauthRedirectUri which we're planning to introduce when adding support for Soteria

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, I have done this. It requires a bit more effort in parsing the address that comes in, so I have added unit tests for a URLUtil method.

server.listen(0, 0);
// Preserving previous behavior. If user does not provide a custom port or address,
// it will use a random port and fallback to localhost
// https://github.com/nodejs/node/blob/main/lib/net.js#L1311
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we change the comment to be related only to the current state and inform about defaults when custom parameters not provided

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, changing the comment style.

Copy link

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 96.87500% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.93%. Comparing base (09433c0) to head (7c6107d).

Files with missing lines Patch % Lines
lib/authentication/auth_web.js 88.88% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1004      +/-   ##
==========================================
+ Coverage   88.89%   88.93%   +0.04%     
==========================================
  Files          72       72              
  Lines        7003     7034      +31     
==========================================
+ Hits         6225     6256      +31     
  Misses        778      778              

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

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.

3 participants