Restore portal device login for DataOps API access
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- api, authentication, cli, testing
調査の方向性
Start with backend/src/docs/portal.ts:handlePortal and backend/src/router.ts, then inspect the device-auth and portal-auth tests named in the issue. Reproduce the anonymous POST failure through the combined HTTP portal/router boundary; the existing handler-only tests do not cover it. Done means the exact two POST operations work anonymously without granting identity, while the specified auth-boundary regressions and production-shaped local CLI journey pass; real operator approval remains a separate deployment check.
索引モデルが issue の本文から書いたものです。
説明
Restore portal device login for authenticated DataOps API access
Status: pending
Tags: bug, portal, backend, testing, P1
Depends on: none for implementation; real operator browser approval is required for live profile verification.
Blocks: reliable operator CLI/API checks, including the live invoice workflow in #232.
Problem and scope
The user requests configuring access to the DataOps API. The official CLI cannot start its legitimate device login: anonymous POST /api/auth/device against the deployed portal returns 401 before a pairing code is issued. In origin/main, backend/src/router.ts exempts device start/poll from authentication, but backend/src/docs/portal.ts:handlePortal runs first and rejects the anonymous request when browser authentication is configured. Existing isolated device-handler tests do not prove the complete deployed preprocessing path.
Repair this narrow authorization mismatch. Allow only device-start and device-token polling requests to reach their existing handlers anonymously, using exact paths and supported methods after existing /work/api normalization. Forwarding these requests must not mark them authenticated or establish a user identity. Retain normal request validation, grant expiry, attempt limits, human browser approval, token ownership and subsequent bearer verification. Reuse the existing handlers and CLI device flow rather than introducing another login or direct credential creation path.
The existing approval UI (#/device), dataops login, secure URL-keyed CLI profile, whoami, token listing/revocation and authenticated API behavior are the operator journey to verify. Production credential storage occurs only after the legitimate grant is approved and exchanged; no account secrets or raw access/device codes belong in public comments, committed fixtures, screenshots or logs. Synthetic local test credentials may be used privately in project-local scratch.
Acceptance criteria
- With browser auth configured and portal auth mode enabled, anonymous POST
/api/auth/devicetraverses the actual portal plus router and returns the existing bounded pairing response instead of preprocessing 401. Anonymous POST/api/auth/device/tokenreaches the existing grant handler and returns its correct pending/denied/expired/approved outcome. Existing normalized/work/api/auth/deviceand/work/api/auth/device/tokenpaths behave consistently. - The anonymous exception is exact and limited to these two POST operations. Anonymous pending-grant lookup, approval, token management,
/api/me, invoice/data APIs, sibling/prefix lookalikes and unsupported methods do not gain authenticated access. A suppliedx-user-idcannot impersonate an operator. Password login remains unavailable in portal mode. Invalid bearer credentials still fail server-side validation. - Approval requires the existing signed-in enabled operator identity, displays the expected application label/code context, and grants or denies the requested device through the existing browser flow. Starting or polling a grant cannot approve it. Missing/invalid/expired grants and disabled users do not yield a token; successful exchange retains existing single-use behavior and token expiry. No token/browser-session/device-grant TTL changes or authentication bypass flags are introduced.
- A complete local production-shaped journey uses the real HTTP portal/router with browser auth enabled and normal authorization enforcement: real CLI starts anonymously, unapproved polling stays pending, browser approval resolves the grant, CLI exchanges it, saves its existing secure profile, and a subsequent CLI
whoami/read-only API call authenticates through normal bearer middleware. Tests must not prove this by settingSKIP_AUTH=true, disabling browser configuration or calling onlyhandleCliAuthRoutesdirectly. - CLI profile behavior remains URL-specific and owner-only (new credential directory 0700/file 0600), normal login output does not expose the bearer token, and denial/expiry/failure do not save a credential. Existing logout/revoke behavior remains protected. No existing peer/operator profiles are overwritten by local testing; use an isolated
DATAOPS_CONFIG_DIRunder.tmp/. - Existing browser login/callback/session, portal private pages, bearer API authorization and device API regressions pass. Capture and inspect sanitized rendered approval/pending and approved/denied states for the complete changed journey, even if the UI source itself requires no changes.
- [HUMAN] After code deployment, run the official CLI device login against the configured DataOps portal, let the real operator approve it in their legitimately authenticated browser, verify the local profile and
whoami, then make a read-only DataOps API check. Report this separately from local tests; no automatic or simulated production approval. Keep the issue open until this succeeds.
Required verification
Use the current consolidated TypeScript packages, not retired Python docs/work-engine commands. Tester runs:
npm --prefix backend testnpm --prefix backend run typechecknpm --prefix backend run buildnpm run test:clinpm run test:frontend:unit- The new production-shaped full HTTP/portal/router + real CLI device-approval test, with browser authentication configured and
SKIP_AUTH=false; name its exact reproducible command in the engineer handoff. Use synthetic enabled/disabled users and test-owned sessions against a local DynamoDB emulator or equivalent faithful store fixture, not a production identity provider. - Playwright changed journey plus existing
backend/e2e/browser-cookie-bootstrap-production-portal.spec.jsandbackend/e2e/auth-error-production-portal.spec.jsregressions. Use an isolated test server/store and capture approval/pending/approved/denied screenshots under.tmp/screenshots/; fixture responses alone do not prove portal preprocessing. This bounded browser set is intentional for a two-endpoint authorization repair; it must exercise the full changed journey and existing authentication boundaries. Any failures or omitted commands must be documented with evidence, not called green.
Include direct and normalized path variants, wrong methods/prefix lookalikes, spoofed identity headers, unauthenticated approval, pending/denied/expired/unknown codes, disabled users, replay after exchange, valid/invalid bearer calls, CLI storage modes and failed-login no-profile behavior. Existing tests include backend/tests/device-auth.test.ts, portal-auth.test.ts, browser-auth.test.ts, api-authorization.test.ts and cli/test/cli.test.mjs; add regression coverage at the actual combined route boundary that currently fails. Validate/build SAM only if packaging or infrastructure changes are needed; no infrastructure change is expected for this scope. No content/search rebuild is needed because content and search are untouched.
Boundaries and handoff
No token TTL expansion, silent human approval, direct DynamoDB production token insertion, hardcoded credentials, broader anonymous auth prefix exemption, invoice-domain changes, alternative login product, or unrelated account migration. Runtime never creates infrastructure. This issue reuses existing grant/token storage, backups and secure CLI configuration; no new persistent family or portable schema is expected.
Implement in a clean project-local worktree based on current origin/main; shared main contains peer process-file edits and must remain untouched. PM grooming → engineer implementation → independent Tester → PM acceptance → focused commit → merge/push → On-Call. Agent-verifiable code can ship before real operator approval; use Refs #248, keep the issue open and add human only after shipped agent checks pass and the real login is the sole remaining gate.
- 主要言語
- TypeScript
- スター
- 2
- フォーク
- 0
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
DataTalksClub/dataops のほかの issue
-
backend bug data frontend human P1 portal
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
DataTalksClub/dataops#244 · コメント 7 件 ·
-
backend enhancement frontend
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
DataTalksClub/dataops#237 · コメント 2 件 ·
-
infra needs grooming P1
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
DataTalksClub/dataops#235 ·
-
backend data enhancement frontend P1
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
DataTalksClub/dataops#232 · コメント 10 件 ·
-
backend bug needs grooming
難易度 3/5 1〜2日 初心者へのやさしさ 75/100
DataTalksClub/dataops#227 · コメント 1 件 ·
DataTalksClub/dataops の issue をすべて見る
似ている issue
-
[bug] diagnostics.dumpBody:Buffer 形态请求(透传 lane)跳过 dumps/ 落盘,仅留 raw/-unknown-対応中かも @ranxianglei が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
ranxianglei/billion-context#2421 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
pending triage
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
nuxt/test-utils#1842 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
MoonshotAI/kimi-code#4146 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
farbenmeer/tapi#531 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
メンテナーはふだん 1 日以内に返信