-
Notifications
You must be signed in to change notification settings - Fork 172
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-760534 Added URLValidator and URLEncoder #1297
SNOW-760534 Added URLValidator and URLEncoder #1297
Conversation
static final SFLogger logger = SFLoggerFactory.getLogger(URLUtil.class); | ||
public static boolean isValidURL(String url) { | ||
try { | ||
new URL(url).toURI(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check .NET PR. URL still valid if it start with "file://" and it can do command injectsion. We need reg expresion for http and https prefix same as .NET.
@@ -0,0 +1,30 @@ | |||
/* | |||
* Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test for file: URL. It should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Overview
SNOW-760534
Snowflake JDBC Driver does not validate SSO URL before executing it. Added a URLValidator utility to address that.
Also added URL Encoder to be used by OCSP Code to URL Encode the base64 encoded OCSP Request before sending it out on the wire.
External contributors - please answer these questions before submitting a pull request. Thanks!
Please answer these questions before submitting your pull requests. Thanks!
What GitHub issue is this PR addressing? Make sure that there is an accompanying issue to your PR.
Fixes #NNNN
Fill out the following pre-review checklist:
Please describe how your code solves the related issue.
Please write a short description of how your code change solves the related issue.
Pre-review checklist