Skip to main content

Duplicated object

Description

Duplicated objects in OpenAPI or GraphQL schemas can lead to maintenance difficulties, increased complexity, data inconsistencies, performance issues, integration challenges, and documentation problems. This redundancy complicates API management and usage.

Remediation

Remove duplicated objects from the schema.

REST Specific

Asp.net

In ASP.NET, ensure that your models and controllers are designed with a single responsibility principle to avoid duplication. Use inheritance or partial classes to share common properties.

Ruby on rails

In Ruby on Rails, use concerns or modules to encapsulate shared logic and DRY up your codebase.

Next.js

In Next.js, create reusable API handlers and utility functions to prevent duplication in your API routes.

Laravel

In Laravel, use Eloquent's relationships, traits, and service classes to avoid duplication in your models and controllers.

Express.js

In Express.js, use middleware and modular routing to encapsulate common functionality and avoid duplication.

Django

In Django, use abstract base classes and mixins to share common fields and methods across models.

Symfony

In Symfony, use traits and inheritance to share common functionality between different classes.

Spring boot

In Spring Boot, use @Component and @Service annotations to create shared beans and avoid duplication.

Flask

In Flask, use Blueprints to create modular endpoints and shared utility functions to reduce duplication.

Nuxt

In Nuxt.js, use mixins and plugins to share common functionality across components and pages.

Configuration

Identifier: schema/duplicated_object

Examples

Ignore this check

{
"checks": {
"schema/duplicated_object": {
"skip": true
}
}
}

Score

  • Escape Severity: INFO

Compliance

  • OWASP: API9:2023
  • pci: 6.5
  • gdpr: Article-32
  • soc2: CC6.1
  • psd2: Article-95
  • iso27001: A.12.6
  • nist: SP800-53
  • fedramp: AR-2

Classification

Score

  • CVSS_VECTOR: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N