orpc-simple-csrf-protection

Add CSRF protection to oRPC applications using server plugins.

8|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/ali-master/skills --skill orpc-simple-csrf-protection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: orpc-simple-csrf-protection
Source: https://github.com/ali-master/skills/tree/main/skills/orpc-simple-csrf-protection
Command: npx skills add https://github.com/ali-master/skills --skill orpc-simple-csrf-protection

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @orpc/server, @orpc/client.

What problem does it solve?

This Skill adds basic CSRF protection to your oRPC application, ensuring that requests originate from JavaScript code and not from HTML forms or direct browser navigation.

Core Features & Use Cases

  • CSRF Protection: Helps ensure requests originate from JavaScript code.
  • Use Case: Ideal for applications that store sensitive data in cookies with SameSite=Lax or SameSite=None.

Quick Start

Add the Simple CSRF Protection Plugin to your oRPC application using the following code:

import { SimpleCsrfProtectionHandlerPlugin } from '@orpc/server/plugins';
const handler = new RPCHandler(router, {
  strictGetMethodPluginEnabled: false,
  plugins: [
    new SimpleCsrfProtectionHandlerPlugin()
  ],
});

Frequently Asked Questions about orpc-simple-csrf-protection

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

FAQPage Schema
How do I add CSRF protection to my oRPC application?

To add CSRF protection to your oRPC application, instantiate the SimpleCsrfProtectionHandlerPlugin and pass it into the RPCHandler plugins array to ensure requests originate from JavaScript code.

When do I need CSRF protection for cookies in JavaScript applications?

You need CSRF protection for cookies in JavaScript applications when storing sensitive data with SameSite=Lax or SameSite=None attributes, preventing malicious requests from HTML forms or direct browser navigation.

Does oRPC CSRF protection work with SameSite cookies?

Yes, oRPC CSRF protection is specifically designed for applications using sensitive data stored in cookies with SameSite=Lax or SameSite=None attributes, validating that requests originate from JavaScript.

What dependencies do I need to implement oRPC CSRF protection?

Implementing oRPC CSRF protection requires the @orpc/server and @orpc/client packages, applying both server and client plugins to validate JavaScript request origins against direct browser navigation.

How does basic CSRF protection prevent direct browser navigation in oRPC?

Basic CSRF protection in oRPC prevents direct browser navigation by verifying that incoming requests are initiated through JavaScript code rather than standard HTML forms, securing SameSite cookie data.