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: remove metric and enforce token validation #151

Merged
merged 3 commits into from
Jul 29, 2024

Conversation

Matheus-Aguilar
Copy link
Contributor

What problem is this solving?

Remove metric and enforce new token validation. More info on: https://vtex-dev.atlassian.net/browse/B2BTEAM-1757

Copy link

vtex-io-ci-cd bot commented Jul 25, 2024

Hi! I'm VTEX IO CI/CD Bot and I'll be helping you to publish your app! 🤖

Please select which version do you want to release:

  • Patch (backwards-compatible bug fixes)

  • Minor (backwards-compatible functionality)

  • Major (incompatible API changes)

And then you just need to merge your PR when you are ready! There is no need to create a release commit/tag.

  • No thanks, I would rather do it manually 😞

@Matheus-Aguilar Matheus-Aguilar requested a review from fredppm July 25, 2024 18:46
Copy link

github-actions bot commented Jul 25, 2024

Messages
📖 ❤️ Thanks!
📖

🎉 PR additions = 110, PR deletions = 86

Generated by 🚫 dangerJS against 509b14e

Copy link

authUser.account,
authUser.id
)
if (
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of writing an if here, can't we write an else on the if below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly, because if token.audience !== 'admin' the metric would also be sent.

@@ -2,12 +2,12 @@ import { isUserPartOfBuyerOrg } from '../resolvers/Queries/Users'

export const validateAdminToken = async (
context: Context,
adminUserAuthToken: string
adminUserAuthToken: string,
metricFields: any
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of providing an additional field here, can't we extract this info from context? This should reduce the amount of changes on this PR and cognitive load while reading the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't get the operation field through the context. I think this is relevant to the metric so we need to pass it somehow. Maybe we could only pass this field and build the rest using the context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, in this case lets keep like this.

@enzomerca enzomerca self-requested a review July 26, 2024 19:09
@Matheus-Aguilar Matheus-Aguilar merged commit 549482d into master Jul 29, 2024
13 checks passed
@Matheus-Aguilar Matheus-Aguilar deleted the fix/B2BTEAM-1757-token-validation branch July 29, 2024 13:25
Copy link

vtex-io-ci-cd bot commented Jul 29, 2024

Your PR has been merged! App is being published. 🚀
Version 1.43.1 → 1.43.2

After the publishing process has been completed (check #vtex-io-releases) and doing A/B tests with the new version, you can deploy your release by running:

vtex deploy [email protected]

After that your app will be updated on all accounts.

For more information on the deployment process check the docs. 📖

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