Skip to content

Malformed URL query params (mileage/filterOpts/sortOpts) crash contributor page #434

Description

@NUAAwqy

贡献者详情页在渲染时直接 JSON.parse URL 查询参数:

  • MetricContributor/index.tsx:30 mileage
  • ContributorTable/index.tsx:73 filterOpts
  • ContributorTable/index.tsx:75 sortOpts

查询参数是用户可控的。手写、截断(分享链接)或过期的 URL 例如:

/analyze/...?...&mileage=abc

会在渲染时抛出 SyntaxError,导致整个页面崩溃(Next.js error boundary 或白屏),
三处调用都没有 try/catch。

建议修复:解析失败时回退到默认值,不抛出异常;并补充单元测试。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions