{"record":{"id":"640df2b79cd068e2","repo":"diegosouzapw/OmniRoute","slug":"password-required","errorCode":"PASSWORD_REQUIRED","errorMessage":"currentPassword required for security-impacting setting changes","messagePattern":"currentPassword required for security-impacting setting changes","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/app/api/settings/route.ts","lineNumber":377,"sourceCode":"      });\n      const storedPasswordHash = getStoredManagementPassword(passwordState.settings);\n      // Cold-boot exception: same condition the existing newPassword path\n      // honoured before T-011 — when no password is configured yet AND login\n      // is currently disabled, allow the first write to set policy (incl.\n      // the password itself). Once a hash exists the gate always fires.\n      // #8950: also treat the request as cold boot when newPassword is present\n      // without a stored hash, so the Security tab's two-step flow (enable\n      // requireLogin first, then set password) does not deadlock.\n      const isColdBoot =\n        !storedPasswordHash &&\n        (passwordState.settings.requireLogin === false || Boolean(body.newPassword));\n      if (!isColdBoot) {\n        if (!body.currentPassword) {\n          emitSettingsFailureAudit(request, actor, \"PASSWORD_REQUIRED\", attemptedKeys);\n          return NextResponse.json(\n            {\n              error: {\n                code: \"PASSWORD_REQUIRED\",\n                message: \"currentPassword required for security-impacting setting changes\",\n                keys: touchedSecurityKeys,\n              },\n            },\n            { status: 400 }\n          );\n        }\n        const isValid = await verifyManagementPassword(body.currentPassword, storedPasswordHash);\n        if (!isValid) {\n          emitSettingsFailureAudit(request, actor, \"PASSWORD_MISMATCH\", attemptedKeys);\n          return NextResponse.json(\n            {\n              error: {\n                code: \"PASSWORD_MISMATCH\",\n                message: \"Invalid current password\",\n              },\n            },\n            { status: 401 }","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/api/settings/route.ts#L359-L395","documentation":"Error \"currentPassword required for security-impacting setting changes\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/app/api/settings/route.ts:377 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}