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: iac usage tracking missing custom org #4262

Merged
merged 1 commit into from Dec 28, 2022

Conversation

rontalx
Copy link
Contributor

@rontalx rontalx commented Dec 27, 2022

What does this PR do?

Fixes an issue in IaC usage tracking where it was not passing the org data to Registry, causing it to count for the default org instead of the custom set org.

How should this be manually tested?

  • Run registry locally.
  • Create another org in the Admin UI.
  • Set the CLI to point to the local registry API.
  • Set the CLI to the custom org you created, either via the env SNYK_CFG_ORG variable or the --org flag.
  • Make a CLI scan to an IaC file.
  • See in the UI that the test-count was increased to the default org instead of the custom one.

With this branch, the correct test-count for the custom org will be increased.

Any background context you want to provide?

  1. This came up in a Customer Support Ticket, when a customer was using the VS-Code plugin with a custom org to scan IaC files, they mentioned that scan counts are increased for wrong organization. I was able to replicate this quickly and worked on a solution.

  2. I've also validated this solution with VSCode and made sure it resolved the original issue.
    To try the solution in VsCode, generate a custom snyk-macos binary from the CLI using the Make file and point the plugin in VSCode to it via the advanced settings.

  3. This did not happen when fetching org-settings as the correct query-string data was passed:
    image

What are the relevant tickets?

Support Ticket:
https://snyk.zendesk.com/agent/tickets/38402

Screenshots

CLI output shows a Custom Org is used as expected (test-org and not ron.tal) βœ…

image

Before Fix πŸ‘Ž

IaC Usage tracking endpoint in Registry detects the wrong org (default org): 73234f0b-a44f-4838-8562-3e0160070570 ❌

image

After Fix πŸ‘

Registry Usage tracking endpoint detects the right org (custom one): 7160edb4-5c66-4fd1-bc84-c1350b240cc1 βœ…

image

@rontalx rontalx force-pushed the fix/iac-usage-with-custom-org branch from 6fdd558 to dd70a12 Compare December 28, 2022 10:26
@rontalx rontalx changed the title fix: testing fix with vs code fix: iac usage tracking missing custom org Dec 28, 2022
@rontalx rontalx force-pushed the fix/iac-usage-with-custom-org branch from dd70a12 to 8e8fddb Compare December 28, 2022 11:17
@rontalx rontalx marked this pull request as ready for review December 28, 2022 11:22
@rontalx rontalx requested a review from a team as a code owner December 28, 2022 11:22
@rontalx rontalx merged commit 3aa723b into master Dec 28, 2022
@rontalx rontalx deleted the fix/iac-usage-with-custom-org branch December 28, 2022 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants