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

feat(api): add slug parser in the api requests #6705

Merged
merged 23 commits into from
Oct 23, 2024

Conversation

djabarovgeorge
Copy link
Contributor

@djabarovgeorge djabarovgeorge commented Oct 16, 2024

What changed? Why was the change needed?

The PR is not ready please do not review

Screenshots

Expand for optional sections

Related enterprise PR

EE-PR

Special notes for your reviewer

Copy link

linear bot commented Oct 16, 2024

Copy link

netlify bot commented Oct 16, 2024

Deploy Preview for novu-stg-vite-dashboard-poc ready!

Name Link
🔨 Latest commit 5d27235
🔍 Latest deploy log https://app.netlify.com/sites/novu-stg-vite-dashboard-poc/deploys/6718be6e63efe600081a9eb6
😎 Deploy Preview https://deploy-preview-6705--novu-stg-vite-dashboard-poc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

pkg-pr-new bot commented Oct 16, 2024

Open in Stackblitz

@novu/client

pnpm add https://pkg.pr.new/novuhq/novu/@novu/client@6705

@novu/framework

pnpm add https://pkg.pr.new/novuhq/novu/@novu/framework@6705

@novu/headless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/headless@6705

@novu/js

pnpm add https://pkg.pr.new/novuhq/novu/@novu/js@6705

@novu/nextjs

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nextjs@6705

@novu/nest

pnpm add https://pkg.pr.new/novuhq/novu/@novu/nest@6705

@novu/node

pnpm add https://pkg.pr.new/novuhq/novu/@novu/node@6705

@novu/notification-center

pnpm add https://pkg.pr.new/novuhq/novu/@novu/notification-center@6705

novu

pnpm add https://pkg.pr.new/novuhq/novu@6705

@novu/providers

pnpm add https://pkg.pr.new/novuhq/novu/@novu/providers@6705

@novu/react

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react@6705

@novu/react-native

pnpm add https://pkg.pr.new/novuhq/novu/@novu/react-native@6705

@novu/shared

pnpm add https://pkg.pr.new/novuhq/novu/@novu/shared@6705

@novu/stateless

pnpm add https://pkg.pr.new/novuhq/novu/@novu/stateless@6705

commit: 5d27235

try {
decodedValue = decodeBase62(encodedValue);
} catch (error) {
return value;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if not base 62

@@ -57,6 +57,7 @@
"@types/newrelic": "^9.14.0",
"@upstash/ratelimit": "^0.4.4",
"axios": "^1.6.8",
"base-x": "^5.0.0",
Copy link
Contributor

@rifont rifont Oct 16, 2024

Choose a reason for hiding this comment

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

issue: Can we write our own base62 encoder from scratch? The pipe logic is effectively using unvalidated data. I'm concerned that any vulnerabilities (intentionally or maliciously) added to the base-x package could expose us‏ to an attack vector

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you think if will have fixed version 5.0.0? Will it solve the concern for us? Then, we could upgrade the version if needed and only to a stable and secure version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a know security issue with the package?

Copy link
Contributor

Choose a reason for hiding this comment

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

The truth is that a custom implementation with two functions, encodeBase62, decodeBase62 would be much much simpler, no need for pipes, no need to worry about potential issues.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

⚠ issue: Can we write our own base62 encoder from scratch? The pipe logic is effectively using unvalidated data. I'm concerned that any vulnerabilities (intentionally or maliciously) added to the base-x package could expose us‏ to an attack vector

i had a hard time implementing the code from scratch, i added up comping the code from base-x so we won't get any vulnerabilities by mistake.

Is there a know security issue with the package?

not at the moment.

The truth is that a custom implementation with two functions, encodeBase62, decodeBase62 would be much much simpler, no need for pipes, no need to worry about potential issues.

i implemented encodeBase62, decodeBase62 based on base-x, pipes are actually a nice touch of nest js making the boundaries of controller and use case responsibility cleaner

…er-in-the-api-requests

# Conflicts:
#	.source
#	apps/api/src/app/workflows-v2/usecases/delete-workflow/delete-workflow.command.ts
#	apps/api/src/app/workflows-v2/usecases/delete-workflow/delete-workflow.usecase.ts
#	apps/api/src/app/workflows-v2/usecases/get-workflow-by-ids/get-workflow-by-ids.command.ts
#	apps/api/src/app/workflows-v2/usecases/get-workflow-by-ids/get-workflow-by-ids.usecase.ts
#	apps/api/src/app/workflows-v2/usecases/get-workflow/get-workflow.command.ts
#	apps/api/src/app/workflows-v2/usecases/get-workflow/get-workflow.usecase.ts
#	apps/api/src/app/workflows-v2/usecases/upsert-workflow/upsert-workflow.command.ts
#	apps/api/src/app/workflows-v2/usecases/upsert-workflow/upsert-workflow.usecase.ts
#	apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
#	apps/api/src/app/workflows-v2/workflow.controller.ts
…er-in-the-api-requests

# Conflicts:
#	apps/api/package.json
#	apps/api/src/app/step-schemas/e2e/get-step-schema.e2e.ts
#	apps/api/src/app/workflows-v2/mappers/notification-template-mapper.ts
#	apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
#	apps/api/src/app/workflows-v2/workflow.controller.ts
#	packages/shared/src/dto/workflows/workflow-response-dto.ts
tatarco and others added 3 commits October 23, 2024 08:59
…er-in-the-api-requests

# Conflicts:
#	apps/api/src/app/workflows-v2/mappers/notification-template-mapper.ts
#	apps/api/src/app/workflows-v2/workflow.controller.e2e.ts
#	packages/shared/src/dto/workflows/workflow-commons-fields.ts
#	packages/shared/src/dto/workflows/workflow-response-dto.ts
…pi-requests' into nv-4494-add-slug-parser-in-the-api-requests
@djabarovgeorge djabarovgeorge merged commit 0e27b89 into next Oct 23, 2024
36 checks passed
@djabarovgeorge djabarovgeorge deleted the nv-4494-add-slug-parser-in-the-api-requests branch October 23, 2024 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants