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

fix: custom endpoint validation and default [IDE-131] #524

Merged
merged 1 commit into from
May 7, 2024

Conversation

teodora-sandu
Copy link
Contributor

@teodora-sandu teodora-sandu commented Apr 29, 2024

Description

Improves the validation so that only http(s)://api. APIs are configured in the custom endpoint field.

Tested manually by running the extension with the latest CLI.

Checklist

  • Tests added and all succeed
  • Linted
  • CHANGELOG.md updated
  • README.md updated, if user-facing

Screenshots / GIFs

Screenshot 2024-05-01 at 09 42 50 Screenshot 2024-05-01 at 09 42 42 Screenshot 2024-05-01 at 09 42 38 ![Screenshot 2024-05-01 at 16 58 50](https://github.com/snyk/snyk-intellij-plugin/assets/81559517/dfff26d0-9cf4-4b70-8d6e-b75e2266d069)

@teodora-sandu teodora-sandu force-pushed the fix/custom-endpoint-validation branch from 0579b47 to d65947b Compare May 1, 2024 08:40
@teodora-sandu teodora-sandu marked this pull request as ready for review May 1, 2024 08:43
@teodora-sandu teodora-sandu requested a review from a team as a code owner May 1, 2024 08:43
@teodora-sandu teodora-sandu force-pushed the fix/custom-endpoint-validation branch 2 times, most recently from 9de4748 to 8ed09fe Compare May 1, 2024 09:05
@@ -100,8 +100,7 @@ internal fun resolveCustomEndpoint(endpointUrl: String?): String {

fun URI.isSnykTenant() =
isSnykDomain()
&& ((host.lowercase().startsWith("app.") && path.lowercase().endsWith("/api"))
|| (host.lowercase() == "snyk.io" && path.lowercase().endsWith("/api"))
&& ((host.lowercase() == "snyk.io" && path.lowercase().endsWith("/api"))
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 ticket mentions that we should not use app.snyk.io/api but nothing about snyk.io/api. This is a legacy way of calling APIs, as far as I know, which works today with api.snyk.io too. I think we could improve the validation some more so snyk.io/api is not allowed but it's not something we were asked to do and I don't know for sure that this wouldn't break something else so I'd rather leave it out

@teodora-sandu teodora-sandu force-pushed the fix/custom-endpoint-validation branch from 8ed09fe to 672388c Compare May 1, 2024 09:14
@cat2608 cat2608 changed the title fix: custom endpoint validation and default fix: custom endpoint validation and default [IDE-131] May 2, 2024
Copy link
Contributor

@cat2608 cat2608 left a comment

Choose a reason for hiding this comment

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

Tested it locally and the field is working fine :)
Thank you!

@Arvi3d Arvi3d closed this May 6, 2024
@Arvi3d Arvi3d reopened this May 6, 2024
@teodora-sandu teodora-sandu merged commit 7ee477f into master May 7, 2024
16 checks passed
@teodora-sandu teodora-sandu deleted the fix/custom-endpoint-validation branch May 7, 2024 09:34
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