fix(security): withhold amounts from REST answers for keys without usage:read
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
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- next.js, react, typescript
Línea de trabajo
Read src/lib/mcp/server.ts:127-144 to understand the existing scope withholding, then inspect src/lib/api/resources.ts and src/lib/api/endpoints.ts for the REST event and alert responses. First, resolve the open choice between options A and B on the issue; the acceptance criteria require both surfaces and docs to follow that decision. Done means the documented scope rule is consistent and tests cover each scope on both surfaces.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Context
Found by the Fable pre-production review on 2026-12-02 (main at cedc1914; every line reference below re-checked on main at cde5aa3b). Source: security and privacy readiness report, new issue 6.
The MCP server and the REST API apply different rules to the same API key:
- MCP withholds money from a key without
usage:read:list_eventsandlist_alertsdrop the fields that can quote an amount (SPEND_SCOPEandALERT_MONEY_FIELDS,src/lib/mcp/server.ts:127-144; rule stated at:36-37).docs/mcp.md:9says such a key "never sees an amount". - REST returns those fields under
events:readandalerts:readalone (src/lib/api/endpoints.ts:102,:112): eventtitleandbody(src/lib/api/resources.ts:234-235), and alertthreshold_labelandobserved_amount_minor(:273,:275).
Impact: low. The holder of an events:read key calls GET /api/v1/events and reads daily summary spend and payment amounts in titles and bodies, which the scope model says that key should not see. Only workspace owners and admins create keys.
| Option | Pros | Cons | Effort | Impact |
|---|---|---|---|---|
Status quo: REST returns amounts under events:read and alerts:read |
No change | docs/mcp.md:9 is false for the same key on REST; the scope model differs by surface |
XS (nothing) | A key scoped away from spend can still read it over REST; no data outside the workspace |
A. REST applies MCP's withholding for keys without usage:read |
One rule on both surfaces; the docs claim becomes true | A REST client using events:read today loses event text it may rely on; needs a changelog note |
S | Spend stays behind usage:read everywhere |
B. Keep REST as is and change docs/mcp.md and docs/api.md to say only MCP withholds |
No behavior change | Two rules for one key; the scope name usage:read no longer means what it says |
XS | Same exposure as today, documented |
Files each option touches:
| Option | Files |
|---|---|
| Status quo | none |
| A | src/lib/api/resources.ts, src/lib/api/endpoints.ts, a shared withholding helper with src/lib/mcp/server.ts, docs/api.md, tests |
| B | docs/mcp.md, docs/api.md |
Recommendation: A. The deciding argument: a scope is a promise about the key, not the surface, and the MCP rule already exists to reuse. Second choice: B.
Plan
- Eddie picks an option on this issue.
- For A: move the withholding into a helper shared by MCP and REST, apply it in the REST event and alert resources, and state the rule in
docs/api.md. - For B: correct
docs/mcp.md:9anddocs/api.md.
Acceptance criteria
- The chosen option is recorded on this issue.
- REST and MCP answer the same key the same way, or the docs say exactly where they differ.
-
docs/api.mdstates the rule. - A test covers each scope on both surfaces.
- Playwright e2e: none needed, API only.
Files and areas
src/lib/api/, src/lib/mcp/server.ts, docs/api.md, docs/mcp.md, tests.
Non-goals: new scopes, rate limits (#96).
Verification
npm run typecheck, npm run lint, npx vitest run src/lib/api src/lib/mcp.
Branch: <issue-number>-rest-withhold-amounts
Model: anthropic/claude-opus-5-5 | Reasoning effort: unknown
- Lenguaje dominante
- TypeScript
- Estrellas
- 13
- Forks
- 2
- Merge medio
- 5 h 20 min
- PR fusionados (30 d)
- 287
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de eddiejaoude/StackDash
-
area: integrations documentation priority: P2 size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
eddiejaoude/StackDash#798 ·
Los mantenedores suelen responder en 1 día
-
area: ops documentation priority: P3 size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
eddiejaoude/StackDash#796 ·
Los mantenedores suelen responder en 1 día
-
area: docs documentation impact: low priority: P3 size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
eddiejaoude/StackDash#790 ·
Los mantenedores suelen responder en 1 día
-
area: ops bug impact: low priority: P3 size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
eddiejaoude/StackDash#785 ·
Los mantenedores suelen responder en 1 día
-
area: connections enhancement impact: low priority: P3 size: XS
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
eddiejaoude/StackDash#768 ·
Los mantenedores suelen responder en 1 día
Todos los issues de eddiejaoude/StackDash
Issues similares
-
bot:ai-assisted component:midnight-js status:untriaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
midnightntwrk/midnight-js#1790 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
area:vscode bug has repro platform:macos platform:vscode regression
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
anthropics/claude-code#113502 ·
-
Add: Rajdhani TV HDAbiertocheck:passed streams:add
Dificultad 1/5 Menos de una hora Aptitud para principiantes 77/100
Los mantenedores suelen responder en 1 día
-
effort/l priority/p1 risk/high triage/core
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
iflytek/skillhub#1188 · 1 comentario ·
Los mantenedores suelen responder en 1 día