Communitygithub.com

YepAPI/skills

工作階段驗證、社交登入提供者、CSRF 保護以及安全 Cookie 模式。

skills 是什麼?

此技能為網頁應用程式定義了一套全面的驗證與授權實務守則,涵蓋工作階段管理、社交登入整合、CSRF 保護以及安全 Cookie 設定。它強制採用基於工作階段的驗證,僅在 API 對 API 的情境下使用 JWT,確保路由保護中介層能確認有效工作階段後才渲染內容。該技能指定至少支援 Google 與 GitHub 作為社交登入提供者,並建議使用魔法連結做為密碼替代方案,以提升安全性與使用者體驗。同時也透過 `user.role` 欄位強制實施基於角色的存取控制,搭配中介層驗證,並在所有變更端點上加入 CSRF 保護。安全性方面要求 Cookie 必須設定 `httpOnly`、`secure`、`sameSite: "lax"` 以及適當的 `maxAge`,並實施重新整理令牌輪換機制。此技能適用於 Claude Code、Cursor、Codex 等 AI 代理平台,能幫助開發者避免將令牌儲存在 localStorage、自製密碼雜湊或缺少伺服器驗證的客戶端角色檢查等常見陷阱。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/auth

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

驗證

規則

  • 網頁應用程式使用基於工作階段的驗證 — 僅在 API 對 API 的情境下使用 JWT
  • 路由保護中介層 — 在渲染前檢查工作階段
  • 社交登入提供者:至少支援 Google + GitHub — 根據目標受眾增加更多提供者
  • 魔法連結作為密碼替代方案 — 更簡單、更安全
  • 基於角色的存取控制:使用 user.role 欄位搭配中介層檢查
  • 在所有變更端點上加入 CSRF 保護
  • 安全 Cookie 設定:httpOnly、secure、sameSite: "lax"、適當的 maxAge
  • 重新整理令牌輪換 — 不讓令牌永遠有效

避免

  • 將令牌儲存在 localStorage — 改為使用 httpOnly Cookie
  • 自行實作密碼雜湊 — 使用 bcrypt/argon2(透過您的驗證函式庫)
  • 未經伺服器驗證的客戶端角色檢查
  • 缺少表單提交的 CSRF 保護

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

相關技能