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: default endpoint [IDE-377] #466

Merged
merged 11 commits into from
Jun 10, 2024
Merged

Conversation

teodora-sandu
Copy link
Contributor

@teodora-sandu teodora-sandu commented Jun 4, 2024

Description

Changes the default auth host used when a custom endpoint is not provided so it's https://app.snyk.io instead of https://snyk.io and improves the computation logic for the URLs needed by the backend.

Re-enables the integration tests too so they run in the pipeline. They would have caught this bug before if they were enabled.

It's best to review this commit by commit.

Checklist

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

Screenshots / GIFs

Because of https://snyksec.atlassian.net/browse/IDE-354 it's important to restart VSCode when changing the organisation because the feature flag doesn't get updated in-between scans.

  • without feature flag (stable LS)

    • without custom endpoint
      Screenshot 2024-06-05 at 17 21 43

    • with prod custom endpoint
      Screenshot 2024-06-05 at 17 23 01

    • with dev custom endpoint
      Screenshot 2024-06-05 at 17 23 26

  • without feature flag (newest LS)

    • without custom endpoint
      Screenshot 2024-06-05 at 17 12 41

    • with prod custom endpoint
      Screenshot 2024-06-05 at 17 14 20

    • with dev custom endpoint
      Screenshot 2024-06-05 at 17 14 49

  • with feature flag

    • without custom endpoint
      Screenshot 2024-06-05 at 17 17 24

    • with prod custom endpoint
      Screenshot 2024-06-05 at 17 16 21

    • with dev custom endpoint
      Screenshot 2024-06-05 at 17 15 38

@teodora-sandu teodora-sandu changed the title chore: enable integration tests in pipeline fix: default endpoint [IDE-377] Jun 4, 2024
@teodora-sandu teodora-sandu force-pushed the chore/run-integration-tests branch 2 times, most recently from 8683425 to d0abf1e Compare June 4, 2024 16:58
@@ -498,10 +486,6 @@ export class Configuration implements IConfiguration {

private getConfigName = (setting: string) => setting.replace(`${CONFIGURATION_IDENTIFIER}.`, '');

private static isSingleTenant(url: URL): boolean {
Copy link
Contributor Author

@teodora-sandu teodora-sandu Jun 4, 2024

Choose a reason for hiding this comment

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

This check is only for when the custom endpoint is provided, which is now only going to be api.*.snyk.io because of the validation we added in the Settings page. So it's irrelevant

Copy link
Contributor

Choose a reason for hiding this comment

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

Just realized: this may be why fedramp is having problems right now - we need snykgov.io as valid domain :). But yeah, I think I need to look deeper into the code - settings and how it flows together.

Comment on lines 43 to 46

- name: Run integration tests
run: npm run test:integration

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the integration tests in vscode never have worked. When I said that we should re-enable them, I thought we were talking about LS? Anyhoo, if you get them running, no harm done :D

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did say snyk-ls in my message on Slack but meant vscode-extension 🤦 But I added some new tests to VSCode that I would like to run in the pipeline so this is still useful if there's no harm done

url.host = `deeproxy.${url.host}`;
}
url.pathname = url.pathname.replace('api', '');
url.host = url.host.replace('api', 'deeproxy');
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should be a bit more supportive here - e.g. automatically transform "old" app.snyk.io endpoints into the new correct format to ease migration to the new rules. At least in IntelliJ, the new format & validation has been causing problems for some ppl. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could be missing something but in this case the customEndpoint will be exactly what's provided in the UI, which is validated anyway and can only be the new format (api.snyk.io). And so I don't think there's any situation in which the old format will be 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.

This function actually was not used anymore so I removed it from the code but the same answer could apply to #466 (comment) I think. Let me know what you think!

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, what about people already having configured a custom endpoint? They would see a validation error without having changed anything. This may already happen, now, but I'd love to improve the UX.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I agree, in hindsight, that the validation is very inconvenient for customers who have the old endpoint configured. In https://snyksec.atlassian.net/browse/IDE-126 we said we want to enforce the new endpoint to be used, is there some other way we can enforce it while not breaking existing customer's setup?

@teodora-sandu teodora-sandu force-pushed the chore/run-integration-tests branch 15 times, most recently from 0cdb15a to cf57970 Compare June 5, 2024 15:59
@teodora-sandu teodora-sandu marked this pull request as ready for review June 6, 2024 12:19
@teodora-sandu teodora-sandu requested a review from a team as a code owner June 6, 2024 12:19
@teodora-sandu teodora-sandu force-pushed the chore/run-integration-tests branch 7 times, most recently from 41cd6b4 to dfa5b98 Compare June 10, 2024 12:02
@teodora-sandu teodora-sandu force-pushed the chore/run-integration-tests branch from dfa5b98 to 0e1916e Compare June 10, 2024 12:47
@teodora-sandu teodora-sandu merged commit 157a8b2 into main Jun 10, 2024
7 checks passed
@teodora-sandu teodora-sandu deleted the chore/run-integration-tests branch June 10, 2024 13:32
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.

2 participants