Infisical / infisical

♾ Infisical is the open-source secret management platform: Sync secrets across your team/infrastructure, prevent secret leaks, and manage internal PKI
https://infisical.com
Other
15.77k stars 988 forks source link

improvement: Slug Validation Errors #2788

Open McPizza0 opened 4 days ago

McPizza0 commented 4 days ago

Description 📣

This PR adds a universal slug validation function that takes 3 inputs (min, max, field) and will use zod validation combined with slugify to validate inputs. Errors are descriptive and dynamic based on inputs.

CleanShot 2024-11-24 at 18 12 13@2x

slugSchema exists in BOTH frontend and backend, and should be moved to unified utils package when repo moves to monorepo.

All slug related frontend form inputs and api params we're updated to use the new slugSchema

Type ✨

Tests 🛠️

Manually tested on frontend CleanShot 2024-11-24 at 18 14 29@2x

Backend testing blocked: ISSUE WITH API RESPONSE


sheensantoscapadngan commented 2 days ago

hmm... for these ones, I would err on the side of caution by increasing the max to 64 - just in case we have users with slugs greater than 32 in their scripts

image
McPizza0 commented 2 days ago

hmm... for these ones, I would err on the side of caution by increasing the max to 64 - just in case we have users with slugs greater than 32 in their scripts

Yup this one is hard, I added max 64 for now