An oauth2.Config is built with a hardcoded string-literal ClientSecret.
Why AI tools produce this: AI coding tools produce this regularly, typically when prompted for a shortcut or a quick fix.
Why this matters
The client secret authenticates your application to the authorization server; committed to source control it is one search away from compromise, letting an attacker impersonate your client and redeem authorization codes for tokens (CWE-798). LLMs routinely inline the secret to make an OAuth sample runnable.
Load it from the environment or a secret manager instead: conf := &oauth2.Config{ ClientID: os.Getenv("OAUTH_CLIENT_ID"), ClientSecret: os.Getenv("OAUTH_CLIENT_SECRET"), } Rotate any secret already committed.
Suppressing this rule
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.
// oauthlint-disable-next-line auth.go.oauth.hardcoded-client-secret -- <reason>