← Back to Pull requests

fix: stop credential leaks in kiosk preview and loan responses #1679

Open
unknown opened this pull request with 266 lines diff across 3 files
View on GitHub
unknown unknown commented on Oct 04, 2026 01:23 UTC
Author

Kioskのsignage previewが他端末の認証キーを返し、LoanのORM relationがClientDevice/Userの秘密情報を返していたため、HTTP境界を表示用DTOへ変更する。

  • Preview候補・選択は端末IDと表示情報のみ。自端末の認証でサーバー側の画像取得を行い、自端末または登録済みsignage候補へ対象を限定する。

  • 保存済みの旧キー参照と新ID参照を互換アダプターで解決する。GETはDBを更新せず、新しい選択は既存String列へIDを保存する。

  • toolsの一覧・借用・返却・取消・写真借用・端末割当、履歴内Loan、計測機器と吊具の借用/返却に共通allowlist DTOを適用する。端末認証値、Userのpassword/MFA/backup codes、NFC識別子と内部idempotency情報を除き、表示・操作用情報を維持する。
  • APIとWebは同じ修正を含むreleaseで更新し、キャッシュ済みの旧Webを再読み込みする。元の画像配信・管理画面・公開schedule DTOを維持する。キー発行/交換/失効、本番DB参照移行、設定変更はこのPR/配備に含めない。

    Deploy impact declaration

    <!-- deploy-impact:start -->
    | Item | Declaration |
    | --- | --- |
    | Risk | db-auth-systemd-deploy |
    | Target machines | pi3, pi4, pi5 |
    | Changed surfaces | api, web, auth, docs |
    | Required files/artifacts | 同じ最終main SHAの署名済みAPI/Web release-set、両image digest、ci-required/CodeQL/gitleaks成功。API/Web実体の標準配備対象はPi5、Pi4/Pi3は既存consumer。 |
    | Database | no: schema/migration変更なし。GETで保存済み参照を旧キーまたはIDとして解決し、配備時の書換え・参照移行は不要。 |
    | Secrets/config delivery | no: 認証値の発行・交換・失効や設定変更は行わず、既存credentialをサーバー内で利用する。実在値をfixture/PR/logへ記録しない。 |
    | Success evidence | 合成fixtureのunit/Web/専用DB統合61件成功、API/Web lint・型検査を含むbuild成功。最終commitのCIとレビューを必須とし、標準配備のrecap/health/revision整合と秘密非公開をGETで確認する。 |
    | Rollback/cleanup | 標準release_pi5 roleの失敗時image rollbackを使用し、DB/keyを巻き戻さない。旧APIは新ID参照を解釈できず漏えいを再開するため、health復旧後はforward fixを優先する。専用合成DB2コンテナは削除済み、merged taskは標準lifecycleでcleanupする。 |
    | Production verification | Pi5のAPI/Web revision一致、health、preview候補の許可フィールド、保存済み対象のJPEG、Loan表示DTO、公開schedule/contentを読み取り確認する。現場設定や貸出/返却はテストで変更しない。実機画面/操作を直接確認できない場合は未確認と報告する。 |
    <!-- deploy-impact:end -->

    Test plan

  • 合成データでAPI unit 26件、Web 14件、専用loopback/tmpfs DB統合21件が成功。他39件は指定した統合対象外。

  • API/WebのESLint、TypeScriptを含むbuild、差分チェックを実施。最新main取り込み後の最終commitでも関連unit、lint、buildを検証する。

  • 保存済み旧参照/ID参照、認証なし・未知対象拒否、対象キー交換後のID参照、選択保存/解除、秘密フィールドと将来追加フィールドの除外、Loan表示/履歴を確認する。

  • 手動レビューでは新画像ルートの認証/対象制限/rate limit、全関連DTOレスポンス、Web表示利用側、API/Web混在期間と復旧制約を確認した。

  • 広いsuite、E2E、DB統合の最終commit証拠はhosted CIを使用する。キー交換・本番business writeテストは実施しない。

  • 正本: docs/knowledge-base/KB-393-security-hardening-audit-2026-07.md(2026-10-04 local correction節)。
  • Diff: 266 lines (+199 / -67) across 3 files Reviewer: chatgpt-codex-connector[bot] Review duration: 7m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.39) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.39 · 266 lines diff across 3 files
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    42%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.334
    Real PR Conversation Timeline
    1 comments
    "Review active on #1679"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 43.0% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39.4% (MEDIUM) · Higher = larger blast radius
    39.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 43.0% · Lower = rushed or shallow review
    43.0%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 22.4% · Safe to merge
    22.4%