Skip to content

cook logout cannot remove a corrupt session file #716

Closed

Description

@drawmeanelephant

Suggested labels: bug, area: cli


Discovery audit finding L5 (low) — cooklang/cookcli @ 7c2f48b (v0.38.1), audited 2026-10-12. Repro verified.

Summary

cook logout cannot remove a corrupt session file.

Where

src/logout.rs:15-23 — a parse error prints "Not logged in." and leaves the file.

Repro

Write garbage to $COOK_CONFIG_DIR/session.json, then cook logout → the file remains.

Expected

Logout removes the session file even if it can't be parsed (or reports and removes it).

Actual

"Not logged in." and the corrupt file stays, so the session keeps being loaded.

Acceptance criteria (red → green)

  • Red: after the repro, session.json still exists.
  • Green: the repro removes the file (or clearly reports it and removes it).

Verification

Executed repro.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions