Skip to content

this.sessions[transactionID] unguarded in drizzle commitTransaction — same pattern as MongoDB adapter #16475

@zer0contextlost

Description

@zer0contextlost

File: packages/drizzle/src/transactions/commitTransaction.ts:20

Same unguarded session map access as the MongoDB adapter. this.sessions[transactionID] can be undefined if the transaction ID was never registered, and session.resolve() throws in that case.

Severity: CRITICAL [high confidence]

Pattern:

const session = this.sessions[transactionID];
delete this.sessions[transactionID];
session.resolve(transactionID); // throws if session was undefined

Fix:

const session = this.sessions[transactionID];
if (!session) throw new Error(`No active transaction: ${transactionID}`);
delete this.sessions[transactionID];
session.resolve(transactionID);

Found via AXIOM — static invariant analysis tool that detects untested null assumptions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions