safe-dto

Map sensitive entities to Safe DTOs for API responses.

Updated Sep 21, 2025
One-click install
npx skills add https://github.com/hmjn023/solid-imager --skill safe-dto
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safe-dto
Source: https://github.com/hmjn023/solid-imager/tree/main/.opencode/skills/safe-dto
Command: npx skills add https://github.com/hmjn023/solid-imager --skill safe-dto

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

APIレスポンスに含まれる機密情報を安全に保護し、クライアントに渡す前に Safe DTO へマッピングすることで情報漏洩を防ぎます。

Core Features & Use Cases

  • 機密情報を除外する Safe DTO への自動マッピング
  • 'Safe' プレフィックスのスキーマを使った型安全なレスポンス設計
  • 代表的なユースケース: ユーザーアカウントデータ、セッション情報、APIキーを含むレスポンスのセキュア化

Quick Start

APIレスポンスから機密情報を除外する Safe DTO へのマッピングを実装してください。

Frequently Asked Questions about safe-dto

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

FAQPage Schema
How do I prevent sensitive data like passwords and API keys from leaking in API responses?

To prevent sensitive data from leaking in API responses, you map entities containing passwords, keys, or tokens to Safe DTOs before sending data to the client. This approach omits confidential fields from the response payload.

What is a Safe DTO and how does it secure backend API responses?

A Safe DTO is a type-safe response schema, identified by a Safe prefix like SafeMediaSource, that excludes confidential fields. It secures backend responses by mapping sensitive entities to these restricted schemas before client delivery.

How to map sensitive user profile entities to safe response objects in a backend service?

You map sensitive user profile entities to safe response objects by implementing mapping functions that transform full entities into Safe-prefixed DTOs. These functions explicitly omit confidential fields like passwords and tokens from the output.

When do I need to use Safe DTO mappings for API response design?

You need Safe DTO mappings when backend services return data containing passwords, keys, or tokens. Use cases include securing user account data, session information, and configuration data in API responses to prevent information leakage.

Does this Safe DTO pattern work for securing configuration data with API keys?

Yes, the Safe DTO pattern works for securing configuration data with API keys. It provides mapping functions that omit confidential fields from configuration entities, ensuring sensitive keys are excluded before the response is sent.

What are the limitations of using Safe-prefix schemas for API response security?

A limitation of using Safe-prefix schemas is that developers must manually implement and maintain the mapping functions for each entity type. If a new sensitive field is added to the source entity, the Safe DTO mapping must be updated to prevent leakage.