Skip to content

🔒 Security: Race condition on temp SARIF upload file #70

Description

@ajianaz

Description

upload_sarif_content() in src/main.rs:497-520 writes to a fixed predictable temp path cora-sarif-upload.json. Between create() and read, another process could replace the file contents (TOCTOU race).

Impact

  • Concurrent cora runs could read each other's SARIF data
  • Predictable filename in shared temp directory

Suggested Fix

Use random suffix or PID:

let tmp_path = tmp_dir.join(format!("cora-sarif-upload-{}.json", std::process::id()));

Or use tempfile::NamedTempFile crate.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions