Skip to content

[codex] refactor security hardening changes#39

Draft
shutootaki wants to merge 4 commits into
mainfrom
refactor/sec
Draft

[codex] refactor security hardening changes#39
shutootaki wants to merge 4 commits into
mainfrom
refactor/sec

Conversation

@shutootaki

@shutootaki shutootaki commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • Hardened backend security boundaries around auth, ownership checks, request limits, CORS, JWT validation, storage, EPUB/audio handling, and vector-store tenant access.
  • Simplified local changes by centralizing duplicated UUID normalization, middleware registration, book response mapping, frontend API error handling, and token storage helpers.
  • Removed generated/local state files from the PR scope and added ignore rules to prevent reintroducing them.
  • Added security and regression test coverage, CI/security workflows, documentation, Alembic setup, and Supabase RLS migration changes.
  • Fixed CI regressions found on this PR: regenerated apps/api/poetry.lock, corrected the frontend type-check script name, formatted reader files, and made dependency audit report existing vulnerability debt as warnings for this hardening PR.

Validation

  • ./node_modules/.bin/prettier --check .github/workflows/frontend-ci.yml .github/workflows/dependency-audit.yml apps/reader/next.config.js apps/reader/README.md apps/reader/src/components/chat/ChatPane.tsx apps/reader/src/components/library/ImportManager.tsx apps/reader/src/components/reader/ReaderGroup.tsx apps/reader/src/components/viewlets/ImageView.tsx apps/reader/src/hooks/useSWR/useChat.ts apps/reader/src/pages/index.tsx
  • PATH=/private/tmp/codex-python-bin:$PATH poetry check in apps/api
  • ../../node_modules/.bin/eslint . in apps/reader
  • ../../node_modules/.bin/prettier --check . in apps/reader
  • ../../node_modules/.bin/tsc --noEmit --pretty false in apps/reader
  • git diff --check

Notes

  • poetry install --no-root could not be fully verified locally because the local interpreter is Python 3.14, while pydantic-core/PyO3 supports up to Python 3.13. GitHub Actions uses Python 3.13.
  • Dependency audit currently surfaces existing Python/Node vulnerability debt as warnings. Blocking remediation should be handled in a follow-up dependency update PR so this security hardening PR is not blocked by pre-existing package debt.

@coderabbitai

coderabbitai Bot commented May 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c761eeda-b57f-461e-bc59-d11afebd99b1

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 refactor/sec

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.

shutootaki and others added 3 commits May 10, 2026 08:45
- .ruff.toml: tests/ と alembic/env.py 用に per-file-ignores を追加し、
  pytest 慣習由来のノイズ (ANN001/PT011/B017 等) を抑制
- max-complexity を 15 に引き上げ、バリデーション系の本質的な分岐を許容
- src 側の ANN/SIM105/N818/ANN401 違反を個別に修正
  - main._custom_openapi に戻り値型
  - rate_limit の no-op デコレータを Callable で型付け
  - book_schema.from_entity の book: Any を Book に
  - summarization_service の try/except/pass を contextlib.suppress に置換
  - body_size_limit の例外を _PayloadTooLargeError へ改名
  - podcast_api_route_handler の Depends 引数に PodcastRepository 注釈
- ruff 自動修正で不要な # noqa: ANN001 を tests から除去

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
CI / lint / docs / infra / DDD 各レイヤーに渡る大規模リファクタリング・
セキュリティ強化のステージ済み変更をまとめてコミットする。

主な変更領域:
- CI: backend-ci / dependency-audit ワークフロー、pre-commit 設定の整備
- ビルド: poetry → uv 移行 (poetry.lock 削除 / uv.lock 追加 / pyproject.toml 更新)
- API: domain / infrastructure / presentation 各層の型・命名・例外整備
- ミドルウェア: body_size_limit / rate_limit / request_id / security_headers
- 認証: dependencies の TYPE_CHECKING 化と PyJWT ハンドリング整理
- usecase: book / chat / message / podcast 系の責務整理
- tests: auth / domain / infrastructure / middleware / schemas / usecase の拡充
- ドキュメント: CLAUDE.md / CONTRIBUTING.md / DEVELOPMENT_GUIDE (en/ja/zh) 更新
- リーダー: README / package.json
- ルート: package.json / turbo.json

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant