TypeScript Security

Enforce OWASP-based secure coding standards for TypeScript applications.

51|6|Updated Mar 28, 2019
One-click install
npx skills add https://github.com/Mte90/dotfiles --skill typescript-security
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: TypeScript Security
Source: https://github.com/Mte90/dotfiles/tree/main/.config/opencode/skills/typescript/security
Command: npx skills add https://github.com/Mte90/dotfiles --skill typescript-security

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill addresses the critical need for secure coding practices in TypeScript development, helping to prevent common vulnerabilities like XSS, SQL injection, and data breaches.

Core Features & Use Cases

  • Input Validation: Ensures all incoming data is rigorously checked using libraries like Zod.
  • Data Sanitization: Protects against cross-site scripting (XSS) attacks by cleaning user-generated content.
  • Secure Authentication & Authorization: Implements robust methods for user verification and access control.
  • Secret Management: Guides developers on securely handling sensitive information like API keys and passwords.
  • Use Case: A developer building a web application can use this Skill to implement secure input validation and output encoding, significantly reducing the risk of security exploits.

Quick Start

Apply the TypeScript Security skill to validate user inputs using Zod and sanitize HTML output with DOMPurify.

Frequently Asked Questions about TypeScript Security

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

FAQPage Schema
How do I prevent XSS in TypeScript applications?

To prevent XSS in TypeScript applications, sanitize user-generated content using DOMPurify and enforce secure coding standards based on OWASP guidelines. This ensures malicious scripts are neutralized before rendering HTML output.

What is the best way to validate user input in TypeScript?

The best way to validate user input in TypeScript is using schema validation libraries like Zod or Joi. These libraries rigorously check incoming data against defined types to prevent malformed requests from processing.

How do I stop SQL injection when using TypeScript ORMs?

To stop SQL injection in TypeScript, use parameterized queries or an ORM for database interactions. This approach separates SQL code from user input, preventing malicious data from altering query structure.

Can I use bcrypt and RBAC for secure authentication in TypeScript?

Yes, you can implement secure authentication in TypeScript using bcrypt for password hashing and Role-Based Access Control (RBAC) for authorization. This combination verifies users and restricts access to authorized roles.

How should I manage API keys and secrets in a TypeScript web app?

Manage API keys and secrets in TypeScript by storing them in environment variables rather than hardcoding. This secure secret management practice prevents sensitive information from being exposed in source control.