Skip to content

[HN-035] decryptPassword performs no input-format validation (related to #88) #456

Description

@Inakitajes

Problem

decryptPassword destructures encoded.split(':') into [ivB64, authTagB64, encryptedB64] and immediately calls Buffer.from(<undefined>, 'base64') with no checks. A malformed stored value throws a cryptic error. The sibling decryptSecret in totp.ts does validate; decryptPassword does not.

Location

apps/web/src/lib/spawner/crypto.ts:23-31

Impact

Callers like chat/stream/route.ts:324 invoke decryptPassword without a try/catch, so a corrupt serverPassword yields an opaque 500 with no useful diagnostic. Related to issue #88 (closed, but only decryptSecret was fixed).

Suggested fix

Add the same if (!ivB64 || !authTagB64 || !encryptedB64) throw new Error('Malformed encrypted password') guard already present in decryptSecret.

Source: code investigation.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backendÁrea: Backend/APIbugSomething isn't workingreliabilityReliability / data integrityseverity:lowLow severity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions