fix(bio-links): strip plaintext secrets and move gated link passcode verification to backend

Abierto
#27 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
47/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nextjs, postgresql, typescript

Línea de trabajo

Read apps/api/src/bio-links/bio-links.service.ts and apps/api/src/bio-links/bio-links.controller.ts, then trace how apps/web/app/l/[slug]/page.tsx passes data to apps/web/components/bio-links/PublicLinkCard.tsx. Check the public endpoint response and the gated link flow. Done means public data excludes private tokens, passcodes, and unverified destinations, with the destination returned only after server-side verification.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

backend bug frontend web
Problem Description
  1. Plaintext metaAccessToken leaked on public Bio-Links endpoint:
    In apps/api/src/bio-links/bio-links.service.ts (getPublicBioPage), the full bioPage record is returned directly from Prisma, including pixelConfig.metaAccessToken in plaintext.

  2. Gated link passcode and destination url exposed to client:
    getPublicBioPage also returns link.passcode (and link.url) for gated links (isGated: true).
    In apps/web/app/l/[slug]/page.tsx, this payload is passed into client components, serializing both pixelConfig.metaAccessToken and link.passcode into the public page's RSC/client payload.
    In apps/web/components/bio-links/PublicLinkCard.tsx, passcode validation is performed client-side (const expectedPasscode = (link.passcode || '').trim().toLowerCase()), allowing any visitor to inspect the network/RSC payload and bypass the gate or extract the secret token.


Expected Behavior
  1. GET /bio-links/public/:slug (getPublicBioPage) must never expose pixelConfig.metaAccessToken or any gated link's passcode (or unverified url) in the public response.
  2. Passcode-gated links must be verified server-side; the destination url should only be returned after the backend confirms the submitted passcode is valid.

Where to Look
  • apps/api/src/bio-links/bio-links.service.ts (getPublicBioPage)
  • apps/api/src/bio-links/bio-links.controller.ts
  • apps/web/app/l/[slug]/page.tsx
  • apps/web/components/bio-links/PublicLinkCard.tsx

Solution / Implementation Guide
  1. Backend (bio-links.service.ts & bio-links.controller.ts):

    • In getPublicBioPage(slug):
      • Sanitize pixelConfig so metaAccessToken (and any other private keys) is omitted from the returned object, keeping only public pixel IDs.
      • For links where isGated === true, omit passcode and mask/omit url (and fileUrl if applicable) in the public payload.
    • Add a public verification endpoint (e.g. POST /bio-links/public/:slug/unlock) accepting { linkId, passcode } (or email for email-gated links):
      • Validate the passcode server-side against the database record.
      • Return { unlocked: true, url } on match, or 401/403 with an error message on mismatch.
  2. Frontend (PublicLinkCard.tsx):

    • Remove the client-side link.passcode comparison.
    • On passcode submit, call the new POST /bio-links/public/:slug/unlock endpoint and use the returned url to open the link once unlocked.
Lenguaje dominante
TypeScript
Estrellas
2
Forks
1
Merge medio
6 min
PR fusionados (30 d)
27

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de sumamakhan761/tryinstance

Todos los issues de sumamakhan761/tryinstance

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.