Skip to content

fix!: prevent bad chars in session names#368

Merged
ethanpailes merged 1 commit intomasterfrom
fix-bad-sess-name-chars
May 7, 2026
Merged

fix!: prevent bad chars in session names#368
ethanpailes merged 1 commit intomasterfrom
fix-bad-sess-name-chars

Conversation

@ethanpailes
Copy link
Copy Markdown
Contributor

Issue Link

#362

AI Policy Ack

Ack

This PR was:

  • mostly or completely vibe coded
  • mostly or completely meat coded
  • bit of both

Description

This patch adds a guard against bad chars in session names. It also adds a check for bad session names into the daemon just for extra defensiveness, though the attach proc is probably good enough.

Closes #362

@ethanpailes ethanpailes requested a review from maxhbooth May 7, 2026 20:56
@ethanpailes ethanpailes force-pushed the fix-bad-sess-name-chars branch from f675658 to ae90ff5 Compare May 7, 2026 21:03
Comment thread libshpool/src/daemon/server.rs Outdated
Comment thread libshpool/src/attach.rs
eprintln!("session name '{}' may not have whitespace", resolved_name);
return Ok(AttachResult::Done);
}
if resolved_name.chars().any(|c| '/' == c) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

it seems like it'd be useful to have slashes for grouping session names. e.g. something like fixing-bugs/1 fixing-bugs/2 etc. I guess we're doing this because the session name gets passed directly into some file operations. Have you considered URL encoding the names for filesystem purposes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I kinda feel like there are lots of other potential seperators people can use, and I would rather not make the rules about which files go where overly complicated.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

If you take out period, white space and slash there's not really any seperators left (I mean I guess dash?) If you use URL encoding you can get rid of all these other checks you have to do too, so the code would probably become simpler if anything. The only downside is that the filepath that gets used will be ugly, but people can just not use special characters in their session name if they care about that.

This patch adds a guard against bad chars in session names.
It also adds a check for bad session names into the daemon just
for extra defensiveness, though the attach proc is probably good
enough.

Closes #362
@ethanpailes ethanpailes force-pushed the fix-bad-sess-name-chars branch from ae90ff5 to 41b52d2 Compare May 7, 2026 21:13
@ethanpailes ethanpailes requested a review from maxhbooth May 7, 2026 21:15
Copy link
Copy Markdown

@maxhbooth maxhbooth left a comment

Choose a reason for hiding this comment

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

I'll go ahead and approve this, but I do think you should consider using URL encoding (or whatever other encoding you like.)

@ethanpailes
Copy link
Copy Markdown
Contributor Author

If people complain we can relax the rule later and add directory encoding logic, but let's try the simpler approach first.

@ethanpailes ethanpailes merged commit cbaedd6 into master May 7, 2026
11 of 12 checks passed
@ethanpailes ethanpailes deleted the fix-bad-sess-name-chars branch May 7, 2026 21:29
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.

BUG: creating a session with slash in its name is broken

2 participants