AGENT SKILL

rust-service-security

Use when adding, changing, testing, or reviewing security-sensitive Rust web service behavior, especially login flows, password hashing, credential checks, session cookies, flash messages, admin route protection, auth middleware, user enumeration defenses, or moving CPU-heavy password work off async executors.

License 许可
MIT
最近更新
2026-06-26
Stars
★ 0
Forks
0

01 前言 Front Matter

name
rust-service-security
license
MIT
metadata
{ "tags": "rust,security,authentication,sessions,passwords", "version": "0.1.0", "category": "Rust", "displayName": "Rust Service Security" }
description
Use when adding, changing, testing, or reviewing security-sensitive Rust web service behavior, especially login flows, password hashing, credential checks, session cookies, flash messages, admin route protection, auth middleware, user enumeration defenses, or moving CPU-heavy password work off async executors.
compatibility
Codex, Claude Code, and other Agent Skills-compatible clients.

02 资源文件 4

03 SKILL.md 正文

Rust Service Security

Use this skill when a Rust service handles identity, credentials, sessions, cookies, privileged routes, or sensitive user data. Prefer explicit threat checks and tests over optimistic handler code.

Core Workflow

  1. Identify the protected asset: account access, admin area, session state, password change, reset token, private data, or privileged operation.
  2. Trace the whole flow: request parsing, credential lookup, verification, session mutation, redirects/responses, logs, and tests.
  3. Keep secrets out of logs and debug output. Use secret wrappers for passwords, tokens, signing keys, and session secrets.
  4. Run password hashing and verification with memory-hard algorithms and move CPU-heavy work off async reactor threads.
  5. Prevent user enumeration. Failed login and password reset flows should not reveal whether the account exists.
  6. Set cookie and session attributes deliberately: HttpOnly, Secure, SameSite, path, lifetime, signing/encryption, and store backend.
  7. Protect routes at middleware or extractor boundaries, not by repeating ad-hoc checks in every handler.
  8. Add tests for happy path, failed auth, missing session, forged cookie or token, and logout/session rotation behavior.

Password Rules

Read references/password-auth.md before implementing or changing password storage or verification.

  • Store PHC strings produced by Argon2id or the project's chosen password hasher; never store plaintext or reversible encrypted passwords.
  • Generate salts with a secure RNG.
  • Use constant, generic responses for invalid credentials.
  • Use tokio::task::spawn_blocking or a dedicated blocking abstraction for expensive password operations.
  • Keep password hash parameters configurable enough to upgrade over time.

Cookie And Session Rules

Read references/cookies-sessions.md when setting, reading, deleting, signing, or persisting cookies and sessions.

  • Never store raw credentials in cookies.
  • Prefer opaque session IDs backed by a server-side store for privileged apps.
  • Rotate or renew session state after login and privilege changes.
  • Delete sessions server-side on logout when using a server-side store.
  • Test security attributes on Set-Cookie headers.

Route Protection

Read references/auth-middleware.md when adding admin routes, extractors, guards, or framework middleware.

Keep handlers typed:

pub async fn admin_dashboard(user: AuthenticatedUser) -> Result<HttpResponse, AppError> {
    // Handler can assume authentication succeeded.
    Ok(HttpResponse::Ok().finish())
}

Avoid optional user lookups in handlers that require authentication; make the missing-user case impossible at the handler signature when the framework allows it.

Reference Files

  • references/password-auth.md: Argon2, PHC strings, user enumeration, and blocking password work.
  • references/cookies-sessions.md: cookie flags, signed messages, server-side sessions, and logout.
  • references/auth-middleware.md: route guards, extractors, and typed session access.

04 同仓库更多 Skills

ConcertoNotes
ConcertoNotes/codex-plugins

android-emulator-qa

Use when validating Android feature flows in an emulator with adb-driven launch, input, UI-tree inspection, screenshots, and logcat capture.

★ 0
ConcertoNotes
ConcertoNotes/codex-plugins

supabase-postgres-best-practices

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

★ 0
ConcertoNotes
ConcertoNotes/codex-plugins

sentry

Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.

★ 0
ConcertoNotes
ConcertoNotes/codex-plugins

render-workflows

Sets up, develops, tests, and deploys Render Workflows. Covers first-time scaffolding (via CLI or manual), SDK installation (Python or TypeScript), task patterns (retries, subtasks, fan-out), local development, Dashboard deployment, and troubleshooting. Use when a user wants to set up Render Workflows for the first time, scaffold a workflow service, add or modify workflow tasks, test workflows locally, or deploy workflows to Render.

★ 0
ConcertoNotes
ConcertoNotes/codex-plugins

render-web-services

Configures Render web services—port binding, TLS, health checks, custom domains, auto-deploy, PR previews, persistent disks, and deploy lifecycle. Use when the user needs to set up a web service, fix health check failures, add a custom domain, configure zero-downtime deploys, or troubleshoot port binding issues.

★ 0
ConcertoNotes
ConcertoNotes/codex-plugins

render-static-sites

Deploys and configures static sites on Render's global CDN—build commands, publish paths, SPA routing, redirects, custom headers, and PR previews. Use when the user needs to deploy a static site, set up a React/Vue/Hugo/Gatsby frontend, configure SPA fallback routing, add redirect rules, customize response headers, or choose between a static site and a web service for their frontend. Trigger terms: static site, CDN, SPA, single-page app, React deploy, Vue deploy, Hugo, Gatsby, Docusaurus, Jekyll, staticPublishPath.

★ 0