fix(security): harden metrics exposure and namespace/private-skill auth#246
Open
fix(security): harden metrics exposure and namespace/private-skill auth#246
Conversation
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.
概述
修复安全基线与越权问题,关闭敏感端点暴露并收紧私有 skill 与命名空间访问授权。
变更内容
后端实现
server/skillhub-app/src/main/resources/application.ymlmanagement.endpoints.web.exposure.include收敛为health,infomanagement.metrics.export.prometheus.enableddocker-compose.yml127.0.0.1:6379:6379server/skillhub-auth/src/main/java/com/iflytek/skillhub/auth/policy/RouteSecurityPolicyRegistry.java/api/v1/namespaces与/api/web/namespaces的 GET 从permitAll改为authenticatedserver/skillhub-app/src/main/java/com/iflytek/skillhub/controller/portal/NamespaceController.javauserNsRoles,详情接口要求userIdserver/skillhub-app/src/main/java/com/iflytek/skillhub/service/NamespacePortalQueryAppService.javaDomainForbiddenException)server/skillhub-app/src/main/java/com/iflytek/skillhub/compat/CompatSkillLookupService.javacanAccess(...)统一复用VisibilityCheckerserver/skillhub-app/src/main/java/com/iflytek/skillhub/compat/ClawHubCompatController.javaGET /api/v1/download透传userId/userNsRolesserver/skillhub-app/src/main/java/com/iflytek/skillhub/compat/ClawHubCompatAppService.javaserver/skillhub-app/src/main/java/com/iflytek/skillhub/compat/ClawHubRegistryFacade.java前端实现
测试覆盖
server/skillhub-app/src/test/java/com/iflytek/skillhub/compat/CompatSkillLookupServiceTest.javaserver/skillhub-app/src/test/java/com/iflytek/skillhub/compat/ClawHubCompatControllerSecurityTest.javaserver/skillhub-app/src/test/java/com/iflytek/skillhub/compat/ClawHubCompatAppServiceTest.javaserver/skillhub-app/src/test/java/com/iflytek/skillhub/controller/NamespacePortalControllerTest.javaserver/skillhub-app/src/test/java/com/iflytek/skillhub/service/NamespacePortalQueryAppServiceTest.javaserver/skillhub-app/src/test/java/com/iflytek/skillhub/metrics/PrometheusEndpointTest.javaserver/skillhub-auth/src/test/java/com/iflytek/skillhub/auth/policy/RouteSecurityPolicyRegistryTest.javaweb/src/**/*.ts(x))质量门禁
make typecheck-web通过(0 errors)make lint-web通过(0 errors, 0 warnings)make test-frontend通过make test-backend-app通过(后端变更)web/e2e)关键路径通过(无 UI 交互变更,不适用)make generate-api已执行且schema.d.ts无差异安全考虑
相关 Issue
Related to #N/A
测试说明
本地验证步骤
make typecheck-webmake lint-webmake test-frontendmake test-backend-appmake generate-api并确认web/src/api/generated/schema.d.ts无 diff回归测试范围
/api/v1/skills/*、/api/v1/download、/api/v1/resolve)/api/v1/namespaces)截图/录屏(如有 UI 变更)
无(本次无 UI 变更)