Why AI tools produce this: AI coding tools generate this anti-pattern by default, it appears in a large share of AI-written auth code.
Why this matters
Any website can then make cross-origin requests to this endpoint, defeating the same-origin policy (CWE-942). This is a common AI-generated Spring mistake: @CrossOrigin(origins = "*") or addAllowedOrigin("*") is pasted in to "make the browser call work" and the intended scope is never added. A bare @CrossOrigin (no arguments) also defaults to all origins.
Restrict CORS to an explicit allowlist of trusted origins instead, e.g. @CrossOrigin(origins = "https://app.example.com") or config.setAllowedOrigins(List.of("https://app.example.com")). Note that addAllowedOriginPattern("*") combined with setAllowCredentials(true) is just as dangerous, because it sends the victim's cookies cross-origin.
If a finding is a genuine false positive, scope the suppression to the exact line and leave a reason, never disable the rule project-wide. Disable directives are line-scoped by design.