본문으로 건너뛰기
cccskills
무료GitHub에 공개

auth-pro

Implement web authentication: sessions, OAuth/OIDC, MFA, passwordless, and session security. Use when adding login and access control to apps.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md4.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Auth Pro

A practical guide to web authentication done safely: session management, OAuth 2.0/OIDC social login, MFA, passwordless (passkeys/magic links), and the session-security details that prevent account takeovers.

Overview

Authentication answers "who are you?"; authorization answers "what can you do?" — don't conflate them. The modern default: delegate to proven providers/libraries (auth services or maintained libraries) rather than hand-rolling crypto, token logic, or password storage. Custom auth code is where breaches are born.

When to use

  • Adding login/signup to any web app.
  • Social login (Google, GitHub, Apple) via OAuth/OIDC.
  • MFA, passkeys, magic links.
  • Session management and "remember me".
  • Reviewing auth implementations for vulnerabilities.

Core concepts

  • Sessions vs tokens. Server sessions (session ID in httpOnly cookie, state on server — revocable, simple) vs JWTs (stateless, carry claims — harder to revoke). Default to server sessions for web apps; JWTs for APIs/mobile where statelessness matters, with short expiry + refresh rotation.
  • Cookies done right. HttpOnly, Secure, SameSite=Lax (or Strict), __Host- prefix. Session cookie never accessible to JS.
  • OAuth 2.0 / OIDC. Authorization code flow + PKCE for SPAs/mobile; state + nonce to prevent CSRF/replay; validate ID tokens (issuer, audience, expiry, signature). Never use the implicit flow.
  • Passwords. Argon2id/bcrypt/scrypt with proper work factors; never MD5/SHA-256 alone. Enforce breach-list checking (haveibeenpwned API) over arbitrary complexity rules; allow password managers (long inputs, paste allowed).
  • MFA. TOTP (authenticator apps) baseline; WebAuthn/passkeys strongest (phishing-resistant). Offer MFA, require it for sensitive actions/roles.
  • Passkeys. WebAuthn platform authenticators — phishing-resistant, no passwords to phish. Implement as primary or alternative login.
  • Magic links. Email-based login: single-use, short-expiry tokens; rate-limit sending; tokens hashed in DB like passwords.
  • Refresh rotation. Refresh tokens rotate on each use; reuse detected = theft → revoke the family. Absolute lifetime cap.

Practical workflow

1. Choose the approach. Managed auth provider (fastest, most secure default) vs maintained library (Auth.js, etc.) vs hand-rolled (only with security review — usually the wrong choice).

2. Session setup (server sessions).

Login: verify credentials → create session (random 256-bit ID) → Set-Cookie(__Host-session=..., HttpOnly, Secure, SameSite=Lax, Path=/)
Request: look up session → load user + expiry → sliding or absolute expiry
Logout: delete session server-side + clear cookie

3. OAuth login.

→ redirect to provider with code_challenge (PKCE), state
← callback with code + state → verify state → exchange code for tokens (server-side) → validate ID token → find-or-create user → create session

Link OAuth identities to existing accounts carefully (verified email matching, with confirmation for mismatches).

4. Protect routes. Middleware: require valid session; check authorization (roles/permissions) per resource — authentication ≠ authorization.

5. Sensitive actions. Step-up auth (re-prompt password/WebAuthn) for: password change, email change, payouts, API key creation.

Common pitfalls

  • Hand-rolled crypto/password storage. The cardinal sin. Use Argon2id via a maintained library; never invent session token schemes.
  • Tokens in localStorage. XSS steals them. httpOnly cookies for sessions; if you must use JWTs in SPAs, short-lived + refresh in httpOnly cookie.
  • Missing PKCE/state. OAuth without PKCE (public clients) or state (CSRF) is exploitable. Both, always.
  • No rate limiting. Login, signup, magic-link, and reset endpoints need rate limits + account lockout/backoff — otherwise credential stuffing walks in.
  • User enumeration. "Email not found" vs "wrong password" distinctions leak accounts. Generic messages; constant-time-ish responses.
  • Unrevocable sessions. No session list, no "log out everywhere", password change not invalidating sessions. Users need control; breaches need containment.
  • Password reset flaws. Predictable/long-lived tokens, tokens in logs, no expiry, not invalidating old sessions after reset. Single-use, 15–60 min expiry, hashed storage.
  • OAuth account takeover. Auto-linking by unverified email lets attackers claim accounts. Link only on verified emails; confirm mismatches.
  • MFA bypass paths. MFA on login but recovery flows skipping it. Every path to the account needs equivalent protection.
  • Logging sensitive data. Passwords, tokens, magic links in logs. Redact; hash tokens before storing.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Master 1Password: vaults, Watchtower, passkeys, SSH agent, CLI, and family/team administration. Use when getting full value from 1Password personally or administering it for others.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Create 3D visuals with modeling, texturing, lighting, rendering, and optimization for web and product.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Create 3D web experiences: scene setup, models, materials, lighting, animation, scroll-driven scenes, and performance budgets. Use when adding 3D to websites beyond basic demos.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Writing abstracts that get papers read — structured content, the 5-sentence core, and journal-specific constraints.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Learn effectively from courses and academies: choosing programs, studying actively, and converting courses into skills. Use when investing time/money in structured learning.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

Audit designs for accessibility with WCAG checklists covering color, type, focus, motion, and content.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aicodedecode/awesome-muse-skills252026년 10월 10일 업데이트

aicodedecode의 스킬 모두 보기

이 스킬의 문제 신고