diegosouzapw/OmniRoute · error

OIDC_ALLOWED_SUBJECTS_REQUIRED

OIDC_ALLOWED_SUBJECTS_REQUIRED

Error message

oidcAllowedSubjects must contain at least one subject or email when oidcEnabled is true

What it means

OIDC consistency validation on the settings route: oidcEnabled was set to true but the effective oidcAllowedSubjects list (from the body or current stored settings) contains no valid subject or email entry. Allowing this would lock out every OIDC user, so the write is rejected.

Solutions

  1. Add at least one allowed subject or email to oidcAllowedSubjects
  2. Keep oidcEnabled false until the allowlist is populated
  3. Verify existing stored subjects weren't cleared by the same request
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/app/api/settings/route.ts:337 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/ab0c74c19b1c33d9. Report an issue: GitHub.

Appendix: source

Thrown at src/app/api/settings/route.ts:337

    // Sanitize model lockout settings: clamp values to valid bounds.
    if (body.modelLockout) {
      body.modelLockout = resolveModelLockoutSettings({
        modelLockout: body.modelLockout as Record<string, unknown>,
      }) as typeof body.modelLockout;
    }

    if (body.oidcEnabled === true) {
      const current = await getSettings();
      const subjects = Array.isArray(body.oidcAllowedSubjects)
        ? (body.oidcAllowedSubjects as unknown[])
        : ((current.oidcAllowedSubjects as unknown[] | undefined) ?? []);
      const hasAtLeastOne = subjects.some((s) => typeof s === "string" && s.trim().length > 0);
      if (!hasAtLeastOne) {
        emitSettingsFailureAudit(request, actor, "OIDC_ALLOWED_SUBJECTS_REQUIRED", attemptedKeys);
        return NextResponse.json(
          {
            error: {
              code: "OIDC_ALLOWED_SUBJECTS_REQUIRED",
              message:
                "oidcAllowedSubjects must contain at least one subject or email when oidcEnabled is true",
            },
          },
          { status: 400 }
        );
      }
    }

    // VALIDATED body so we never trip on stray unknown keys. If any security
    // key is present, require currentPassword + verify against the stored
    // bcrypt hash. Dedupes with the previous inline newPassword reauth — the
    // password is verified at most once per PATCH.
    const touchedSecurityKeys = SECURITY_IMPACTING_KEYS.filter((k) => k in validation.data);
    if (touchedSecurityKeys.length > 0) {
      const settings = await getSettings();
      // Lazy-hash any plaintext INITIAL_PASSWORD migration BEFORE we read the
      // stored hash, so the gate works on fresh deploys too.

View on GitHub (pinned to a179ffed5b)