Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Upgrade nanoid and openid-client

未关闭
#360 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
35/100
Issue 类型
重构
描述清晰度
基本清楚
活跃度
停滞
领域
backend

调研方向

从 app/lib/authn-oidc.js 开始,检查 openid-client 的加载方式,然后使用 npm list 查看依赖版本。确定在服务保持为 CommonJS 的情况下是否可以升级这两个依赖,或者是否需要合适的替代方案。完成的标准是所选版本能够在不出现 ERR_REQUIRE_ESM 的情况下运行,并保留现有的身份验证行为。

由索引模型根据 Issue 内容生成。

描述

The latest releases of these two dependencies default to ECMAScript syntax rather than CommonJS. We're not using a transpiler like Babel to handle converting between different JS flavors, and ideally we shouldn't have to until we're ready for a TS migration.

Figure out a way to upgrade these dependencies while still using CommonJS, or find suitable alternatives. nanoid specifies a solution for CommonJS (link below). I'm not sure about openid-client.

NanoID

After version 3, CommonJS support is mostly dropped in favor of ESM:

https://github.com/ai/nanoid?tab=readme-ov-file#commonjs

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/ssica/Development/attack/workbench/attack-workbench-rest-api/node_modules/openid-client/build/index.js from /Users/ssica/Development/attack/workbench/attack-workbench-rest-api/app/lib/authn-oidc.js not supported.
Instead change the require of index.js in /Users/ssica/Development/attack/workbench/attack-workbench-rest-api/app/lib/authn-oidc.js to a dynamic import() which is available in all CommonJS modules.

For now, downgraded back to 3x:

❯ npm list | grep nanoid
├── [email protected]
❯ npm install nanoid@3

changed 1 package, and audited 654 packages in 667ms

89 packages are looking for funding
  run `npm fund` for details

3 vulnerabilities (2 low, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
❯ npm list | grep nanoid
├── [email protected]

OpenID-Client

Same thing with openid-client -- v6 moves to ESM:

Downgraded:

❯ npm list | grep openid
├── [email protected]
❯ npm install openid-client@5

added 2 packages, removed 2 packages, changed 1 package, and audited 654 packages in 968ms

87 packages are looking for funding
  run `npm fund` for details

3 vulnerabilities (2 low, 1 high)

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
❯ npm list | grep openid
├── [email protected]
主要语言
JavaScript
星标
56
派生
18
平均合并
21 小时 30 分钟
30 天内合并 PR
8

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mitre-attack/attack-workbench-rest-api 的其他 Issue

查看 mitre-attack/attack-workbench-rest-api 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 发到你的邮箱

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