airqo-platform / airqo-platform/AirQo-api

Enforce permissions on sensitive token and IP management routes

未关闭
#5,175 0 条评论 0 个 reaction 已指派 1 人 已被 @Baalmart 认领 在 GitHub 查看
主要语言
JavaScript
星标
26
派生
24
平均合并
5 小时 36 分钟
30 天内合并 PR
81

描述

## Description

The token management routes in `src/auth-service/routes/v2/tokens.routes.js` currently only use authentication (`enhancedJWTAuth`) without proper permission checks. This creates a security gap where any authenticated user can potentially access sensitive token operations and IP management functions.

## Affected Routes

Routes that need permission enforcement include:
- Token CRUD operations (create, read, update, delete, regenerate)
- IP blacklisting/whitelisting operations
- IP range and prefix management
- Token listing and verification endpoints

## Security Impact

Without proper permission checks, authenticated users may be able to:
- View all tokens in the system
- Create/modify/delete tokens they shouldn't have access to
- Manipulate IP blacklists and whitelists
- Access sensitive token metadata

## Recommendation

Add `requirePermissions` middleware with appropriate permission scopes to all sensitive routes, following the pattern used in other protected endpoints.

## Related

- PR: https://github.com/airqo-platform/AirQo-api/pull/5159
- Comment: https://github.com/airqo-platform/AirQo-api/pull/5159#discussion_r2317157602
- Requested by: @Baalmart

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。