Skip to content

fix: eliminate TOCTOU race conditions in ssl-bump.ts #838

@Mossaka

Description

@Mossaka

Tracking issue from closed PR #766.

Replace check-then-act pattern (existsSync + writeFileSync) with atomic file creation using the wx flag (O_WRONLY | O_CREAT | O_EXCL) in initSslDb().

Changes needed

  • Replace existsSync + writeFileSync with atomic wx flag writes
  • Handle EEXIST errors gracefully (file already exists is not an error)
  • Eliminate TOCTOU (time-of-check-time-of-use) race conditions

Original PR: #766

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