Security rules

NGB024: Weakened OAuth/OIDC client configuration

Reports OAuth 2.0 / OpenID Connect client configuration that explicitly switches off a protection: PKCE disabled or using the plain challenge method, the implicit flow (responseType returning tokens), disabled issuer / ID-token / at_hash / subject checks, and requireHttps: false.

Property Value
Rule ID NGB024
Category Navigation & authentication
Default severity high
CWE CWE-287, CWE-345
Built-in presets recommended: error, strict: error

Confidence is reported per finding (high, medium, low) and is independent of severity. See Reading findings.

What it checks

Reports OAuth 2.0 / OpenID Connect client configuration that explicitly switches off a protection: PKCE disabled or using the plain challenge method, the implicit flow (responseType returning tokens), disabled issuer / ID-token / at_hash / subject checks, and requireHttps: false. Covers configuration objects for angular-oauth2-oidc (AuthConfig), angular-auth-oidc-client (OpenIdConfiguration) and hand-written client settings.

Why it matters

OIDC client libraries are secure by default; these settings exist for legacy providers and debugging and are easy to leave in production. Without PKCE an intercepted authorization code (logs, referrers, malicious redirect handlers) can be redeemed; the implicit flow exposes access tokens in the URL; disabled ID-token validation lets forged or replayed tokens sign users in.

Detection behavior and supported patterns

  • Object literals that look like an OAuth client config (contain issuer, authority, clientId, client_id, redirectUri, loginUrl, tokenEndpoint …)
  • disablePKCE: true / disablePkce: true, code_challenge_method: "plain" (also in URL strings) — high
  • responseType / response_type containing token without code (implicit flow) — high
  • disableIdTokenValidation: true — high; skipIssuerCheck: true, requireHttps: false — medium
  • disableAtHashCheck, strictDiscoveryDocumentValidation: false, skipSubjectCheck, disableIatOffsetValidation — low
  • angular-oauth2-oidc AuthConfig without a responseType (the library defaults to the implicit flow) — medium confidence

Example

TypeScript
export const authConfig: AuthConfig = {  issuer: 'https://login.example.com',  clientId: 'spa',  responseType: 'id_token token',  disablePKCE: true,  requireHttps: false,};

Safer alternative

TypeScript
export const authConfig: AuthConfig = {  issuer: 'https://login.example.com',  clientId: 'spa',  responseType: 'code',  redirectUri: window.location.origin + '/callback',};

Remediation

Use the authorization code flow with PKCE (S256): responseType: 'code', leave disablePKCE, skipIssuerCheck, disableIdTokenValidation and friends at their defaults, and keep requireHttps: true (or 'remoteOnly').

False-positive considerations

  • requireHttps: false in a configuration used only for local development is reported; keep such configs in development-only environment files and exclude them, or use requireHttps: "remoteOnly".

Known limitations

  • Configuration loaded at runtime (from JSON files fetched over HTTP, environment variables injected at deploy time) is not visible.
  • Values built dynamically (requireHttps: environment.production) are not evaluated.
  • Identity-provider settings (allowed flows, redirect URI allowlists) are outside the repository and not assessed.

References

Run it

Shell
ngbastion explain NGB024