One API key per feeder + feeder-scoped ingest URLs (migrate off shared keys)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 12/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Área
- api, authentication, backend
Línea de trabajo
Start with the auth path: NodeAuthorizationPermission and the NodeAuth link between NodeAPIKey and ManagedNode, then common/meshcore_feeder_auth.py for the MeshCore equivalent. The issue's open points need a maintainer decision first, including the per-protocol key rule and the prod query for keys linked to several feeders. Done means the acceptance criteria are met: feeder-scoped endpoints reject shared keys, old v1/v3 URLs are unchanged, and Prometheus shows usage of old and new URLs.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Part of #437. This ticket should land before the feeder re-key work (ID-4) and makes that work much smaller.
Problem
Today an API key can be shared between several feeders owned by the same person (NodeAuth is many-to-many between NodeAPIKey and ManagedNode). Because of that, the feeder's node number in the URL (/api/packets/{node_id}/...) is what chooses which feeder is posting, and NodeAuthorizationPermission authorises on the pair (key, node number).
From 2.8, a node's number is crc32(public_key), so it changes on upgrade. An upgraded feeder then posts under a number its key isn't linked to, gets a 403, and ingest stops silently.
MeshCore has the same sharing built in: common/meshcore_feeder_auth.py uses the X-MeshCore-Feeder-Pubkey header to tell a user's feeders apart.
Proposal: one feeder, one API key
When a key belongs to exactly one feeder, the key on its own identifies the ManagedNode. The node number the bot reports is then just information we record, not something we authorise on. If the number changes, the feeder simply reports a new one:
- if
crc32(public_key)equals the new number, updatemeshtastic_node_idautomatically, keep the old number as an alias and notify the owner; - if it doesn't match, flag it for review rather than reject it. The likely cause is a bot config copied onto another radio.
Keys can still be rotated.
Migration
- API: add feeder-scoped endpoints with no node number in the path, for example
/api/v4/feeder/ingest/,/api/v4/feeder/nodes/and/api/v4/feeder/bot-version/. Exact paths to be decided; MeshCore gets the equivalent. These endpoints require a key linked to exactly one feeder. A shared key gets a clear 4xx telling the owner to mint a per-feeder key. - Bot: post to the new URLs. Ship this in the same bot release as feeder identity reporting (ID-5).
- Owners upgrade their bot over time. The old v1/v3 URLs keep working unchanged, shared keys included. No new shared links can be created (UI/admin), though existing ones keep working on the old URLs.
- Track usage of the old and new URLs in Prometheus:
- Request counts per URL version.
django-prometheusper-view metrics may already cover this; check the views have distinct names. - Which feeders are still on the old URLs, so we can chase their owners. Use either a low-cardinality counter labelled by feeder (the fleet is small) or a
last_used_legacy_url_atfield onManagedNode. Pick one.
- Request counts per URL version.
- Retire the old URLs once legacy usage reaches zero, or stays at a known handful we've contacted. This joins up with #319 (retire v1 ingest URLs).
- Once the old URLs are gone, enforce one key per feeder in the schema: a unique constraint on
NodeAuth.api_key, or move the key ontoManagedNode.
Open points
- A bot running both a Meshtastic and a MeshCore radio on one key: should the rule be one key per feeder per protocol, or one bot record owning both radios? Check prod for keys linked across protocols.
- Before step 6, find out how many prod keys are linked to more than one feeder:
NodeAuth.objects.values("api_key").annotate(n=Count("node")).filter(n__gt=1) - Dual-API (prod plus pre-prod) is unaffected, because each environment has its own key.
Acceptance criteria
- New feeder-scoped endpoints authenticate by key alone and reject shared keys with an actionable error.
- A feeder whose node number changes keeps ingesting on the new endpoints. Its number is updated, with the CRC check, an alias for the old number, and an owner notification. If ID-4 lands separately, at minimum there is no 403.
- Old v1/v3 endpoints behave exactly as they do today.
- New shared key links can no longer be created.
- Prometheus shows request volume for the old and new URLs, plus a way to list the feeders still on the old URLs.
- Bot change tracked in a linked meshflow-bot issue.
- Docs updated:
API.md,API_KEYS.mdand the ingestion docs.
- Lenguaje dominante
- Python
- Estrellas
- 1
- Forks
- 0
- Merge medio
- 1 d 20 h
- PR fusionados (30 d)
- 5
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin 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 pskillen/meshflow-api
-
enhancement meshtastic-2.8
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
pskillen/meshflow-api#459 ·
-
enhancement meshtastic-2.8
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
pskillen/meshflow-api#465 ·
-
enhancement meshtastic-2.8
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
pskillen/meshflow-api#464 ·
-
enhancement meshtastic-2.8
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pskillen/meshflow-api#463 ·
-
[2.8] Handle missing rxTimeAbiertoenhancement meshtastic-2.8
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
pskillen/meshflow-api#462 ·
Todos los issues de pskillen/meshflow-api
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
yt-project/yt#5624 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NousResearch/hermes-agent#148376 ·
Los mantenedores suelen responder en 1 día
-
Analysis
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SACGF/variantgrid#2615 ·
Los mantenedores suelen responder en 1 día