{
  "filename": "src/main.ts",
  "rule": "- name: unknown-mutation-fields-rejected\n  where: \"src/main.ts\"\n  ensure: >-\n    The global ValidationPipe must enable both whitelist and forbidNonWhitelisted to reject unknown mutation fields instead of silently accepting or stripping them.",
  "corrected": "import { NestFactory } from \"@nestjs/core\";\nimport { ValidationPipe } from \"@nestjs/common\";\nimport { AppModule } from \"./app.module\";\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  app.useGlobalPipes(new ValidationPipe({\n    whitelist:true,\n    forbidNonWhitelisted:true,\n    transform:true,\n  }));\n  await app.listen(3000);\n}\nvoid bootstrap();\n",
  "broken": "import { NestFactory } from \"@nestjs/core\";\nimport { ValidationPipe } from \"@nestjs/common\";\nimport { AppModule } from \"./app.module\";\n\nasync function bootstrap() {\n  const app = await NestFactory.create(AppModule);\n  app.useGlobalPipes(new ValidationPipe({\n    whitelist:true,\n    forbidNonWhitelisted:false,\n    transform:true,\n  }));\n  await app.listen(3000);\n}\nvoid bootstrap();\n",
  "regression": [
    "    forbidNonWhitelisted:true,",
    "    forbidNonWhitelisted:false,"
  ],
  "test_scenarios": [
    [
      "Allowed valid fields",
      "Service invoked with transformed DTO"
    ],
    [
      "Body adds admin=true",
      "400 before service"
    ],
    [
      "Wrong field type",
      "400"
    ],
    [
      "Controller uses an interface",
      "Negative test exposes missing runtime metadata"
    ]
  ],
  "test_source": null,
  "test_command": "npm test -- --runInBand validation.e2e-spec.ts"
}