Join our Newsletter — 33% off our NHI Course

DTO

A DTO, or data transfer object, is a purpose-built structure used to move data between application layers or across APIs. In security-sensitive systems, DTOs help separate internal domain models from external representations, reducing the risk that private fields are accidentally exposed through default serialization behaviour.

Expanded Definition

A DTO is a deliberately limited data shape that carries only the fields an API, service, or user interface needs at a specific boundary. That boundary may be between presentation and application layers, between microservices, or between a backend and an external client. The security value of a DTO comes from explicit data selection: it helps teams avoid exposing internal domain objects, lazy-loaded relationships, secrets, or control flags that were never meant to leave the trusted runtime.

In practice, DTO design is part architecture and part security control. A well-formed DTO can reduce accidental data disclosure, make validation more predictable, and create a stable contract for callers. The concept aligns with the intent of NIST Cybersecurity Framework 2.0 by supporting safer data handling and more intentional system boundaries, even though NIST does not formally define DTOs as a standalone term.

Usage in the industry is still evolving in service meshes, event-driven systems, and AI-enabled applications, where DTOs may also carry prompts, policy inputs, or tool results. The most common misapplication is treating domain entities as DTOs, which occurs when developers serialize internal objects directly and assume framework defaults will safely filter sensitive fields.

Examples and Use Cases

Implementing DTOs rigorously often introduces mapping overhead, requiring organisations to weigh cleaner interfaces and reduced exposure against extra code, testing, and maintenance.

  • A public user profile endpoint returns a DTO with display name and avatar URL, while the internal account model retains password hashes, recovery tokens, and audit metadata.
  • A payment service sends an order DTO to a downstream fraud engine, excluding card data and internal pricing logic while preserving the minimum context needed for review.
  • An admin portal uses a separate DTO for permission changes, so role assignments are validated independently from the broader identity object and cannot overwrite unrelated fields.
  • A microservice publishes an event DTO to a queue, carrying only identifiers and status fields, which limits the chance of leaking secrets into logs or subscribers.
  • In application security reviews, teams compare DTOs against API schemas and serialization settings to confirm that defaults in frameworks such as Jackson, .NET, or ORMs are not exposing extra properties.

For design discipline around interfaces and state exposure, teams often pair DTO review with OWASP guidance and boundary-focused controls. When DTOs are used in identity flows, they can also help ensure that only the minimum attributes needed for verification or authorization are passed between components.

Why It Matters for Security Teams

DTOs matter because many data leaks are not caused by a dramatic exploit, but by over-sharing at application boundaries. If internal objects are reused as external payloads, a simple API change, library upgrade, or serializer configuration can expose fields that were never intended for clients. That creates confidentiality risk, weakens data minimization, and makes it harder to reason about what each service is allowed to see and store.

This is especially important in identity-heavy and NHI-adjacent systems, where DTOs may move claims, tokens, roles, approval status, or agent execution context across service layers. A poorly designed DTO can blur trust boundaries and turn an otherwise narrow interface into a broad disclosure path. In API-heavy environments, teams should also align DTO design with OWASP API Security guidance and, where applicable, the verification and assurance expectations reflected in NIST SP 800-63.

Organisations typically encounter the impact only after a staging export, incident log, or public API response reveals fields that should have remained internal, at which point DTO discipline becomes operationally unavoidable.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-63 and NIST AI RMF set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 PR.DS DTOs support data protection by limiting what crosses system boundaries.
OWASP Non-Human Identity Top 10 DTOs often carry NHI-related credentials, tokens, and agent context across services.
NIST SP 800-63 AAL2 Identity flows using DTOs should preserve assurance by limiting sensitive claim exposure.
NIST AI RMF AI systems use DTO-like payloads to move prompts, context, and outputs safely.
OWASP Agentic AI Top 10 Agentic systems rely on bounded messages to prevent overbroad tool and data access.

Apply governance checks to AI payload DTOs so only approved context reaches tools and models.