chore(security): hardening de la demo (max-instances, /refresh con token, docs)#33
Merged
Conversation
…ken, docs) - /api/sales/refresh: si Refresh:Token está configurado, exige el header X-Refresh-Token (comparación de tiempo constante); si no, abierto (default demo). El frontend ya no lo llama. Evita que cualquiera dispare la re-ingesta contra la fuente real. - scripts/deploy-cloudrun.sh + DEPLOY.md: --max-instances 3 en ambos servicios (acota coste/DoS de los servicios públicos). - DEPLOY.md: sección 'Security notes' (API pública con datos ficticios, token de refresh, Secret Manager + --set-secrets para SAP/Shopify, errores saneados). - Tests (76 -> 78): /refresh con token rechaza sin header y acepta con header. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resultado de la auditoría de seguridad. La demo (datos ficticios, API pública) no tenía fugas de datos; los riesgos eran de exposición pública + abuso/coste. Este PR los acota.
Cambios
POST /api/sales/refreshprotegible: si se configuraRefresh:Token, exige el headerX-Refresh-Token(comparación de tiempo constante); si no se configura, queda abierto (default demo). El frontend ya no llama a/refresh. → evita que cualquiera dispare la re-ingesta contra la fuente real (coste/rate-limit si fuera SAP/Shopify).--max-instances 3en ambos servicios Cloud Run (scripts/deploy-cloudrun.sh+DEPLOY.md) → acota coste/DoS de los servicios públicos. (Ya había alerta de billing.)DEPLOY.md→ sección "Security notes": API pública con datos ficticios, uso del token de refresh, Secret Manager +--set-secretspara los secretos de SAP/Shopify (en vez de--set-env-varsen claro), y recordatorio de errores saneados / SQLite parametrizado / HTTPS.No incluido (deliberado)
Verificación
dotnet test✅ 78/78 (incluye 2 nuevos del token de refresh).🤖 Generated with Claude Code