Skip to content

[feat] auth-gateway를 없애고 Drive는 사용자 Google 클라이언트로 Google에 직접 연결한다 - #17

Merged
m16khb merged 1 commit into
mainfrom
16-remove-auth-gateway
Oct 12, 2026
Merged

m16khb merged 1 commit into
mainfrom
16-remove-auth-gateway

Conversation

@m16khb

@m16khb m16khb commented Oct 12, 2026

Copy link
Copy Markdown
Collaborator

요약

Galpi가 auth-gateway에 요청을 보내지 않도록 앱 로그인 게이트를 없앴습니다. Drive 코드 교환과 토큰 갱신은 oauth2.googleapis.com/token에 직접 보냅니다. Drive를 연결하려면 사용자가 설정 시트에 자기 Google OAuth 클라이언트를 저장해야 하고, 소스에는 클라이언트 ID와 보안 비밀번호가 없습니다.

로그인 게이트는 로컬 기능을 보호하지 않았고, gateway가 Drive에 필요했던 이유는 보안 비밀번호를 보관하는 일뿐이었습니다. 그 값을 소스에 두려 했으나 GitHub push 보호가 평문과 base64를 모두 막았고, 한 프로젝트에 모든 사용자를 묶는 문제도 있어 사용자가 자기 클라이언트를 가져오게 했습니다.

Closes #16

변경 내용

  • 삭제: 접근 게이트(AppAccessGate)와 gateway 포트·어댑터·세션 저장소, IPC 명령 4개, AUTH_REQUIRED·GATEWAY_* 오류 코드, 로그인 화면·계정 칩·로그아웃. 앱은 세션 없이 작업 화면으로 바로 열립니다.
  • Drive: 교환과 갱신에서 bearer 인자를 없앴고 갱신은 연결을 만든 클라이언트를 받습니다. 400 invalid_grant만 연결을 지우고, 401과 5xx는 DRIVE_UNAVAILABLE로 처리합니다.
  • 사용자 클라이언트: 값 객체 DriveClient(형식 검증, Debug에서 비밀번호 가림), 명령 3개(load_drive_client, save_drive_client, clear_drive_client), 비밀번호는 기존 비밀 저장소 흐름에 Secret::DriveClientSecret으로 저장합니다. 보안 비밀번호는 IPC로 돌려주지 않습니다.
  • 클라이언트가 없을 때: 연결과 Picker는 Google을 부르기 전에 DRIVE_CLIENT_REQUIRED로 멈추고, 설정 시트와 온보딩 카드는 연결 대신 클라이언트 설정으로 안내합니다.
  • 연결 중 변경 금지: Drive가 연결돼 있거나 동의를 기다리는 동안 저장·삭제는 DRIVE_CLIENT_LOCKED로 거부합니다. refresh token은 발급한 클라이언트에서만 갱신되기 때문입니다. Picker 동의를 기다리는 사이 클라이언트가 바뀌면 새 토큰을 폐기합니다.
  • 이전 연결: 내장 클라이언트로 연결해 둔 기존 사용자는 시작할 때 연결이 해제되고 토큰 폐기를 시도합니다. 클라이언트를 저장한 뒤 다시 연결해야 합니다.
  • 문서: README 두 벌에 Google Drive 사용 준비(클라이언트 만드는 방법), 설정 시트의 만드는 방법, ADR(앞선 두 ADR을 대체)과 push 보호 caution을 추가했고, 명령 39개·포트 16개로 문서를 맞췄습니다.
  • 바꾸지 않은 것: auth-gateway 저장소, Drive 동기화 방식과 drive.file 범위, Picker 흐름, ChatGPT 로그인, 워커.

확인한 것

  • 자동 테스트: Rust cargo test --all-targets 346건, cargo clippy -D warnings, cargo fmt --check, bun run check, bun test 282건이 통과했습니다. 클라이언트 저장 규칙, 잠금, Picker 중 클라이언트 변경, 클라이언트 없음, 옛 연결 해제는 전용 테스트로 고정했습니다.
  • 실제 Google 스모크: 앱에 클라이언트를 저장한 뒤 Drive 연결, 결과·녹음 업로드, 만료 후 갱신, Picker 가져오기, 연결 해제와 이전 refresh token 거부까지 모두 통과했습니다. 토큰 요청이 oauth2.googleapis.com/token으로 가는 것도 확인했습니다.
  • 앱 창(개발 빌드): 로그인 화면 없이 작업 화면이 열립니다. 클라이언트가 없을 때의 안내, 입력과 저장됨, 연결된 동안의 잠금 안내, 재시작 뒤 유지, 클라이언트 삭제를 직접 눌러 확인했습니다. 단계별 시각과 결과는 .issueops/evidence/task-16-smoke.md에 있습니다.
  • 소스와 이력에 OAuth 값이 없는지 추적·미추적 파일 전체와 커밋 이력으로 검색했습니다. 스모크용 클라이언트는 Cloud 콘솔에서 지웠습니다.
  • 확인하지 못한 것: 내장 클라이언트로 만든 옛 연결이 시작 때 해제되는 경로를 실제 창에서 보는 일(개발 컴퓨터에 그런 연결이 없어 use case 테스트로만 확인했습니다), 프로덕션으로 게시한 사용자 프로젝트에서의 동의 화면, 좁은 폭 화면, Windows 화면입니다.

리뷰 포인트

  • Drive를 쓰려면 모든 사용자가 Cloud 콘솔에서 클라이언트를 직접 만들어야 합니다. 설치 한 번에 끝나던 Drive 연결이 번거로워지는 대신 소스에 비밀 값이 없고 Galpi가 쓰는 Google 프로젝트에 의존하지 않습니다. 이 교환이 맞는지 의견을 주세요.
  • 내장 클라이언트 연결을 시작할 때 조용히 해제하는 방식이 적절한지 봐 주세요. 대안은 갱신이 실패했을 때만 해제하는 것인데, 그러면 연결된 것처럼 보이다가 처음 쓰는 순간 실패합니다.
  • 클라이언트를 바꾸면 Drive에 새 Galpi 폴더가 생깁니다. drive.file 범위가 클라이언트(프로젝트)별로 파일을 구분하기 때문이고, 설정 시트와 README에 이 점을 적었습니다.
  • 잘못 입력한 칸을 표시하는 방식은 오류 문구의 앞부분(클라이언트 ID, 보안 비밀번호)에 기대고 있습니다. Rust 테스트가 두 접두어를 고정하지만, 오류 코드를 칸별로 나누는 편이 나은지 의견을 받고 싶습니다.
  • Cloud 콘솔의 Galpi Desktop 클라이언트는 이제 Galpi가 쓰지 않습니다. 삭제 여부는 소유자가 정합니다.

…equire the user's own client (#16)

Why: the gateway login protected no local feature (nothing local talks to the
gateway, any Google account was allowed) yet forced a first-run login and no
offline first start. Drive only needed the gateway to hold the desktop client
secret. The app now sends code exchange and renewal to
oauth2.googleapis.com/token itself and opens straight to the work screen.
Galpi ships no Google OAuth client: GitHub push protection rejects the plain and
the base64 form alike, a shipped secret ties every user to one project, and
Google may revoke a published one. Users save their own client (ID + secret) in
the settings sheet; README (both copies) and the sheet explain how to create one.
Changes: remove AppAccessGate, GatewayAuthPort/GatewaySessionStore, the gateway
adapter and session store, 4 IPC commands, 2 ports, the AUTH_REQUIRED/GATEWAY_*
codes and the login screen, account chip and sign-out; DriveAuthPort
exchange/refresh lose the bearer and take the required client; DriveTokenFailure
drops AuthRequired (401 is now Unavailable); startup is bind -> subscribe ->
loadWorkspace. Add DriveClient (validated, redacted Debug, no Serialize),
Secret::DriveClientSecret, load/save/clear_drive_client commands (39 total,
16 ports), DRIVE_CLIENT_REQUIRED without a saved client, DRIVE_CLIENT_LOCKED
while connecting or connected, a Picker callback guard that revokes tokens
issued under a replaced client, a start-up drop of connections made with the old
built-in client, and the settings sheet section with the setup entry shown
instead of Connect while no client is saved. Docs: new ADR superseding
2026-10-09 and 2026-10-11, cautions for push protection and the native failure
banner.
Tested: cargo test --all-targets (346 passed), cargo clippy -D warnings, cargo
fmt --check, bun run check, bun test (282 pass), gates G1-G23; live Google smoke
with a client saved in the app (connect, upload, renewal, Picker import,
disconnect, revoked-token check) and app-window checks (no login screen, setup
entry without a client, save, locked while connected, kept across restart,
delete), see .issueops/evidence/task-16-smoke.md.
Not-tested: the start-up drop of an old built-in-client connection in a real
window (none on the dev machine; covered by use case tests), a production-
published user project, narrow-width layout, Windows.
@m16khb m16khb added the enhancement New feature or request label Oct 12, 2026
@m16khb m16khb self-assigned this Oct 12, 2026
@m16khb
m16khb marked this pull request as ready for review October 12, 2026 07:35
@m16khb
m16khb merged commit 17a7615 into main Oct 12, 2026
9 checks passed
@m16khb
m16khb deleted the 16-remove-auth-gateway branch October 12, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

auth-gateway 의존 제거: 앱 로그인 게이트를 없애고 Drive 토큰을 Google에 직접 교환

1 participant