Skip to content

Harden automation storage ids#3443

Closed
Hmbown wants to merge 1 commit into
mainfrom
codex/v0.8.65-automation-id-hardening
Closed

Harden automation storage ids#3443
Hmbown wants to merge 1 commit into
mainfrom
codex/v0.8.65-automation-id-hardening

Conversation

@Hmbown

@Hmbown Hmbown commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Goal

Harden durable automation storage path construction for the v0.8.65 lane.

Changes

  • Validate automation and automation-run ids before composing JSON/run storage paths.
  • Route automation read, write, update/delete, run listing, and run writes through the same storage-id guard.
  • Add regression coverage for path-like ids on automation lookup, automation save, run listing, and run save.

Verification

  • cargo fmt --all -- --check
  • cargo test -p codewhale-tui --bin codewhale-tui --locked automation_manager
  • git diff --check

Risks

Low. CodeWhale-generated automation and run ids are UUID strings, which remain accepted. The new guard rejects only ids that are not safe single path segments.

Validate automation and run ids before composing durable storage paths so caller-supplied ids cannot escape the automations or runs roots.

Tests cover read/list/write rejection for path-like automation and run ids.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces path validation for automation and run IDs in the AutomationManager to prevent path traversal vulnerabilities, updating path-resolving methods to return a Result and adding comprehensive unit tests. The feedback suggests simplifying the validate_storage_id function by removing the redundant id.trim() != id check, as any leading or trailing whitespace would already fail the ASCII alphanumeric and hyphen/underscore check.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +777 to +784
if id.is_empty()
|| id.trim() != id
|| !id
.bytes()
.all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_')
{
bail!("{label} must be a safe path segment");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The check id.trim() != id is redundant because any leading or trailing whitespace characters (or any other characters stripped by trim()) are not ASCII alphanumeric, -, or _. Therefore, any string with such characters will already fail the .bytes().all(...) check. Removing this redundant check simplifies the validation logic.

    if id.is_empty()
        || !id
            .bytes()
            .all(|b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_')
    {
        bail!("{label} must be a safe path segment");
    }

@Hmbown

Hmbown commented Jun 23, 2026

Copy link
Copy Markdown
Owner Author

Closing this narrower branch because the same automation storage-id hardening is already covered in the broader v0.8.65 local-state hardening PR #3433.

@Hmbown Hmbown closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant