dpop-adoption
하는 일
이 스킬은 도난당한 리프레시 토큰을 다른 사람이 쓰지 못하도록 OAuth 토큰을 보호하도록 개발자를 돕습니다. Google 로그인과 함께 토큰 보안을 강화하려는 팀을 위한 스킬입니다.
사용하는 경우
- ✓Google OAuth 리프레시 토큰을 DPoP로 키에 묶고 싶을 때.
- ✓Google 토큰 엔드포인트에 대한 요청용 증명 JWT를 만들어야 할 때.
- ✓use_dpop_nonce 질문을 받은 토큰 요청을 다시 시도해야 할 때.
스킬 링크
https://github.com/google/skills/blob/main/skills/identity/dpop-adoption/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“브라우저 앱의 Google 로그인에 DPoP를 추가해서, 리프레시 토큰이 내보낼 수 없는 키에 묶이도록 해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
내보낼 수 없는 P-256 키 쌍을 만들고, 각 토큰 요청에 DPoP 증명을 서명하며, Google이 nonce를 요구하면 다시 시도하는 방법을 설명합니다. 표준 웹 암호화 API를 사용합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
DPoP Adoption & Identity Security Architecture
Demonstrating Proof-of-Possession (DPoP, RFC 9449) secures OAuth 2.0 refresh
tokens against interception and replay attacks by cryptographically binding them
to a private key held exclusively by the client. In Google's OAuth 2.0 platform,
DPoP binds the refresh token at the token endpoint, while access tokens issued
for Google APIs are standard Bearer tokens (token_type: "Bearer").
1. Core Cryptographic & Architectural Invariants
When implementing DPoP helpers or upgrading HTTP clients, you MUST adhere to the following strict security invariants:
A. Universal WebCrypto & Runtime Compatibility
- In modern ES6 JavaScript (
"type": "module"for Node 18+ and browsers), ALWAYS accessglobalThis.cryptodirectly after verifying the environment context. - NEVER import legacy CommonJS modules via
require('node:crypto')or reference browser-scopedwindow.crypto, as these cause module initialization crashes across hybrid runtimes.
B. Hardware-Backed Non-Extractable Key Persistence
- Generate an Elliptic Curve key pair on the SECP256R1 (
P-256) curve:{ name: 'ECDSA', namedCurve: 'P-256' }. - CRITICAL SECURITY GUARDRAIL: The private key MUST be configured as
non-extractable (
extractable: false). This guarantees the private key can never leave the hardware cryptographic boundary (Secure Enclave, Android KeyStore, or JS sandbox memory), thwarting XSS and dependency token theft attacks. - The public key MUST remain exportable (
extractable: true) to allow emitting JSON Web Keys (JWKs).
C. Public JWK Formatting Standards
- When exporting public keys to attach to DPoP Proof JWT headers, construct a
clean JWK dictionary containing strictly:
"kty": "EC""crv": "P-256""x": Base64URL-encoded x-coordinate without trailing equal sign padding (=)."y": Base64URL-encoded y-coordinate without trailing equal sign padding (=).
- NEVER expose private key parameters (
"d") or superfluous metadata.
D. IEEE P1363 vs. ASN.1 DER Signature Disambiguation
- DPoP Proof JWTs require raw concatenated coordinate signatures ($R \parallel S$, exactly 64 bytes for P-256) per IEEE P1363 and RFC 7518.
- WebCrypto Native Rule: In standard WebCrypto (
crypto.subtle.sign), ECDSA signatures are ALREADY emitted natively in raw IEEE P1363 format (concatenated 32-byterandsbuffers, 64 bytes total). DO NOT attempt DER-to-Raw conversion oncrypto.subtle.signoutputs, as parsing a 64-byte raw buffer as ASN.1 DER causes an immediate runtime exception (Invalid DER sequence). Directly base64url-encode the raw ArrayBuffer. - Legacy API Fallback: If and only if implementing in legacy Java/Android
(
java.security.Signature) or Node CommonJS (crypto.createSign), convert ASN.1 DER output to raw 64-byte IEEE P1363 format before base64url encoding.
E. SPA & Backend-for-Frontend (BFF) Architecture
- Secretless SPAs Limitation: Pure client-side single-page applications
(SPAs) without a backend cannot use DPoP directly with Google APIs due to
client_secretrequirements on server endpoints and browser CORS limitations on theDPoP-Nonceresponse header. - BFF Pattern: To secure SPAs with DPoP, route authorization and token
refresh requests through a Backend-for-Frontend (BFF) server-side client.
The BFF sets
access_type=offline, binds refresh tokens server-side using DPoP, and maintains secure session cookies with the frontend.
2. Implementation Rules & Mandatory Public API
When creating new modules, your module MUST explicitly export all functions below to integrate cleanly with CI/CD verification harnesses and automated probers. When inspecting or refactoring existing codebases, ensure equivalent cryptographic and RFC 9449 logic is present. Obey strict claim derivation logic in all cases:
A. DPoP Proof JWT Claim Derivation Rules (createDPoPProof)
When generating the DPoP Proof JWT in createDPoPProof:
1. JOSE Header (typ, alg, jwk):
// Header
{
"typ": "dpop+jwt",
"alg": "ES256",
"jwk": await exportPublicJWK(publicKey)
}
2. Payload Claims:
"htm": Uppercase HTTP Method ("POST"for token requests)."htu": Target URI stripped of query parameters and hash fragments using `sanitizeH
자주 묻는 질문
개인 키를 복사할 수 있나요?
아닙니다. 키가 추출 불가능하게 설정되어 암호 시스템 밖으로 나갈 수 없습니다.
Google API 액세스 토큰도 바뀌나요?
아닙니다. 액세스 토큰은 표준 Bearer 토큰 그대로이며, DPoP는 리프레시 토큰을 묶습니다.
어떤 런타임을 다루나요?
브라우저, WebCrypto, Node.js ES 모듈 설정을 다룹니다.
상세 정보
작성자의 원본 설명
Implement and debug OAuth 2.0 DPoP (RFC 9449) refresh token sender-constraining for WebCrypto, Node.js ES6, and browser runtimes integrating with Google's OAuth platform. Use when configuring non-extractable asymmetric key pairs (P-256), generating DPoP Proof JWTs for authorization code exchange and token refresh, or handling 400 use_dpop_nonce challenge retry loops at oauth2.googleapis.com/token. Don't use for unconstrained OAuth 2.0 flows (where refresh tokens are not bound to a client key pair), or for Google Cloud IAM / service account authentication.
repo: google/skills
인기도
- GitHub 스타
- 22k
- 순위
- #10354
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
finding-google-skills
22k에이전트가 호스팅, 데이터베이스, 저장소, 로그인, AI 모델 제공처럼 설정 작업에 맞는 Google 가이드를 찾도록 돕습니다.
gcloud
22k에이전트가 Google Cloud gcloud 명령을 작성하고 확인하도록 돕습니다. 플래그를 추측하지 않도록 무엇이든 실행하기 전에 정확한 문법을 확인합니다.
google-cloud-recipe-auth
22k에이전트가 Google Cloud의 신원과 접근 권한을 안내합니다. 사람과 서비스가 어떻게 로그인하고 어떤 권한을 받는지 포함합니다.
google-cloud-recipe-onboarding
22k새 개발자가 Google Cloud에서 프로젝트 선택, 결제 연결, 첫 리소스 배포 같은 첫 단계를 밟도록 안내합니다.