Skip to content

chore(functions): Firebase 依存更新 / Node 22 ランタイム / firebase-tools 除去 - #42

Merged
YasunoriMATSUOKA merged 1 commit into
mainfrom
chore/functions-deps-node22
Jun 8, 2026
Merged

chore(functions): Firebase 依存更新 / Node 22 ランタイム / firebase-tools 除去#42
YasunoriMATSUOKA merged 1 commit into
mainfrom
chore/functions-deps-node22

Conversation

@YasunoriMATSUOKA

Copy link
Copy Markdown
Member

概要

メンテナンス再生作業の PR2/4。Cloud Functions の依存を刷新し、デプロイ先ランタイムを Node 22 へ。Gen1(v1)トリガー構成は維持(Gen2/Node 24 は auth.user() 等の再設計が必要でスコープ外)。

⚠️ このPRは PR1(chore/supply-chain-hardening)にスタックしています。PR1 をマージ後にベースが main に切り替わります

主な変更

  • engines.node 18 → 22(Gen1 上限。Node 24 は Gen2 専用)
  • firebase-admin ^10 → ^13.10 / firebase-functions ^4 → ^6.6(v1 名前空間維持。モジュールロード・tsc 型チェック確認済み)
  • 新メジャーで壊れる内部 deep import を公開サブパスへ置換(firebase-functions/v1, /v1/firestore, /v1/storage, /v1/auth)
  • @types/node22.x に固定(Node 18 types は TS 5.9 のジェネリック TypedArray と非互換)
  • axios / ws / rxjs / @slack/web-api / TypeScript 5.9 / ESLint 8.57 / @typescript-eslint 8 / Prettier 3 / firebase-functions-test 3 を更新
  • firebase-tools を functions から除去(ここでは CLI 不要。high/critical の主因。デプロイは root の firebase CLI を使用)
  • overrides: crypto-js 4.2.0(merkletreejs が引く脆弱な 3.3.0 対策)/ axios ^1.17.0(OpenAPI クライアント内蔵の旧 axios)/ bn.js 5.2.3。決定的ハッシュ出力は不変、testnet デプロイで結合検証

脆弱性

  • high/critical: 80 → 0
  • moderate 9件が残存。全て firebase-admin/firebase-functions(最新版)が内包する Google ネットワーク層(gaxios, teeny-request, retry-request, uuid 等)。強制 override は backend を壊すリスクがあるため上流/Dependabot に委ねる。CI ゲートは --audit-level=high

検証

  • npm ci 成功 / tsc ビルド 0 エラー / 生成 lib/index.js のモジュールロード成功(v1 API 実行時互換確認)

🤖 Generated with Claude Code

…ase-tools

Modernize Cloud Functions dependencies while keeping the Gen1 (v1) trigger
model (Gen2/Node 24 would require rewriting auth.user() triggers; out of scope).

- engines.node 18 -> 22 (Gen1 max; Node 24 is Gen2-only).
- firebase-admin ^10 -> ^13.10, firebase-functions ^4 -> ^6.6
  (v1 namespace retained; verified module loads and tsc type-checks).
- Replace internal deep imports that break on the new majors with public
  subpaths: firebase-functions/v1, /v1/firestore, /v1/storage, /v1/auth.
- Pin @types/node to 22.x (Node 18 types were incompatible with TS 5.9's
  generic typed-array lib).
- Bump axios, ws, rxjs, @slack/web-api, typescript 5.9, eslint 8.57,
  @typescript-eslint 8, prettier 3, firebase-functions-test 3.
- Remove firebase-tools from functions devDeps (CLI not needed here; was the
  main source of high/critical advisories). Deploy uses root-level firebase CLI.
- overrides: crypto-js 4.2.0 (merkletreejs pulled vulnerable 3.3.0), axios
  ^1.17.0 (old bundled axios in the OpenAPI client), bn.js 5.2.3. Deterministic
  hashing outputs preserved; testnet deploy is the integration check.

Result: npm audit high/critical 80 -> 0. 9 moderate advisories remain, all in
the firebase-admin/firebase-functions Google networking stack (gaxios,
teeny-request, retry-request, uuid) pinned by the latest upstream releases;
force-overriding them risks breaking the backend, so they are left for upstream
/ Dependabot. CI gate is set at --audit-level=high.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 8, 2026 13:53
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 85e4ca0e-43e9-4db8-992b-e78b57452740

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/functions-deps-node22

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Cloud Functions(Gen1/v1 トリガー維持)の依存更新と import 経路整理を行い、ランタイム更新も含めて保守性/セキュリティ改善を狙うPRです。

Changes:

  • firebase-functions v6 系に合わせて、内部 deep import を公開サブパス(firebase-functions/v1/*)へ置換
  • Functions 側の主要依存(firebase-admin / firebase-functions / TypeScript / ESLint 等)を更新
  • functions/package.json の Node エンジン指定を更新し、依存の override を追加

Reviewed changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
functions/src/v1/storage/admin/user/file/index.ts Storage v1 の型 import を公開サブパスへ移行
functions/src/v1/pubsub/topic/index.ts Pub/Sub v1 の型 import を公開サブパスへ移行
functions/src/v1/pubsub/schedule/index.ts スケジュール(Pub/Sub)v1 の型 import を公開サブパスへ移行
functions/src/v1/https/onRequest/index.ts HTTPS onRequest の型 import を公開サブパスへ移行
functions/src/v1/https/onCall/index.ts HTTPS onCall の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/vote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/team/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/submission/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/judge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/finalVote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/year/finalJudge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/public/user/index.ts (コメントアウト行の)Firestore v1 型 import の更新
functions/src/v1/firestore/private/user/year/vote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/team/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/submission/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/judge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/finalVote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/finalJudge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/year/entry/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/tx/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/private/user/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/config/symbol/node/check/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/vote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/team/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/submission/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/judge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/finalVote/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/finalJudge/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/year/entry/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/tx/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/firestore/admin/user/index.ts Firestore v1 の型 import を公開サブパスへ移行
functions/src/v1/auth/index.ts Auth v1 の型 import を公開サブパスへ移行
functions/src/utils/firebase/logger.ts firebase-functions import を v1 サブパスへ移行
functions/src/utils/firebase/hasAlreadyTriggered.ts EventContext の import を v1 サブパスへ移行
functions/src/utils/firebase/baseFunction.ts firebase-functions import を v1 サブパスへ移行
functions/package.json Node engines / 依存更新 / overrides 追加

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread functions/package.json
Comment on lines 16 to 18
"engines": {
"node": "18"
"node": "22"
},
Comment thread functions/package.json
Comment on lines +31 to +32
"@types/node": "22.19.20",
"@types/ws": "^8.18.1",
Base automatically changed from chore/supply-chain-hardening to main June 8, 2026 14:24
@YasunoriMATSUOKA
YasunoriMATSUOKA merged commit 77a8ad9 into main Jun 8, 2026
3 checks passed
@YasunoriMATSUOKA
YasunoriMATSUOKA deleted the chore/functions-deps-node22 branch June 8, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants