authentication-security

Enforce authentication token and session lifecycle security across login, refresh, logout, and recovery flows.

4|Updated May 16, 2026
One-click install
npx skills add https://github.com/machenjie/rd-skills --skill authentication-security-machenjie
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: authentication-security
Source: https://github.com/machenjie/rd-skills/tree/main/src/foundation/capabilities/authentication-security
Command: npx skills add https://github.com/machenjie/rd-skills --skill authentication-security-machenjie

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This capability prevents authentication credentials (tokens, cookies, sessions, refresh material, and recovery flows) from silently outliving their intended security lifecycle, becoming replayable after compromise, or enabling privilege escalation through weak recovery or session-handling design.

Core Features & Use Cases

  • Token, refresh, and session lifecycle hardening: enforces short-lived access tokens, single-use refresh rotation, revocation, and session fixation prevention after login and privilege changes.
  • Secure cookie and credential storage guidance: specifies HttpOnly/Secure/SameSite/path rules and memory-hard password storage requirements to reduce takeover risk.
  • MFA, step-up, and recovery controls: defines when MFA is required, how to handle account recovery safely, and what to audit and notify.

Quick Start

Use the authentication-security skill to review how your login, session, token rotation, logout, and recovery flows handle lifecycle, revocation, MFA, cookies, and audit logging.

Frequently Asked Questions about authentication-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent session fixation after login and privilege changes?▼

Prevent session fixation by enforcing session lifecycle hardening that rotates session identifiers immediately after login and privilege changes, revoking old sessions to block replay attacks and privilege escalation.

What is the correct way to handle JWT validation for access and refresh tokens?▼

Correct JWT validation requires strict enforcement of algorithm, audience, issuer, and expiry claims with clock-skew limits, combined with short-lived access tokens and single-use refresh rotation to detect compromise.

How do I secure cookies for web authentication sessions?▼

Secure cookies for web authentication by applying strict HttpOnly, Secure, SameSite, and path attributes to reduce takeover risk and prevent credential theft across login, refresh, and logout flows.

Does this approach work with OAuth, OIDC, SAML, and passkey MFA flows?▼

This approach works across web and service identity scenarios including OAuth, OIDC, SAML federation, passkeys, WebAuthn, and OTP-based MFA by enforcing safe issuance, rotation, and revocation behaviors.

What's the best way to design account recovery without enabling privilege escalation?▼

Design safe account recovery by enforcing uniform anti-enumeration behavior, memory-hard password hashing, and auditable event logging with secret redaction to prevent weak recovery exploitation.

Why do refresh tokens need single-use rotation?▼

Refresh tokens need single-use rotation to detect compromise through refresh reuse, immediately invalidating stolen material and preventing replay attacks across service identity scenarios.