Skip to content

元数据不可解析时的 fail-open 残余风险评估(api-exposure / rest-server) #3545

Description

@os-zhuang

#3391 的独立 follow-up ②。

背景

API 曝露 gate 在元数据不可解析/暂不可用时故意 fail-open(回退到 schema 默认 apiEnabled:true / 无 apiMethods),以免元数据短暂不可用时阻断流量。位置:

  • packages/runtime/src/api-exposure.ts(checkApiExposure:def 为空 → { allowed: true })。
  • packages/rest/src/rest-server.ts(loadObjectItems 取不到元数据时返回 [] → gate 默认放行;enforceApiAccess 对未知对象放行交由数据层 404)。

目标

评估这条 fail-open 路径的残余安全风险并决定是否收紧:

  • 枚举「元数据取不到」的真实成因(冷启动、注册竞态、scoped 服务未就绪、真实故障),判断哪些应 fail-closed。
  • 权衡:fail-closed 会不会在正常启动窗口误伤流量?是否可用「元数据已就绪」信号区分「暂时缺」与「确实没有」。
  • 若收紧,给出分级策略(例如:对象存在但 enable 不可解析 → fail-closed;整个元数据服务未就绪 → 短暂 fail-open + 告警)。

非阻塞项 —— P1 未改变这条既有行为,此 issue 仅做评估 + 决策。

关联:#3391#3498、ADR-0049。

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions