mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-11-30 16:39:33 +01:00
fix(files): the editor never reaches Codeman's own .env by another spelling, and a save keeps the file's group (#797)
The four review items of #797, applied at merge. The editor's name rule lowercases, the data dir's .env pattern did not: .codeman/.ENV passed both, and on a case-insensitive filesystem (the macOS default) that is ~/.codeman/.env, the login file codeman attach reads. A session whose workspace is the home folder could open and save it. The pattern is case-insensitive now, pinned in the blocklist table and on the three editor routes. A save writes a new file and renames it over the old one, so the file took the server's own group: a 0640 .env owned you:www-data came back you:you and the web server lost read access. The save now puts the old user and group back where the account may (best effort), and the wiki says mode and group instead of permissions. Tests: an .env in an outside worktree is refused on edit=1 and PUT too, now that the editor's own gate lets dotenv through; the comment on why .env.example is blocked for downloads and attachments is back. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
18b309fc02
commit
59d4bbca2d
7 files changed
+89
-6
No files matched your search
@@ -85,7 +85,10 @@ const SENSITIVE_PATTERNS: RegExp[] = [
|
||||
// The data dir's `.env` is the CODEMAN_USERNAME/PASSWORD fallback `codeman attach`
|
||||
// reads. Named here as well as in DOTENV_PATTERNS so `allowDotenv` (the File
|
||||
// Viewer editor) cannot reach it from a session whose workspace is $HOME.
|
||||
/\/\.codeman[^/]*\/\.env$/,
|
||||
// Case-insensitive, unlike its neighbours: the editor's name rule lowercases
|
||||
// (`isEditableFileName`), so `.codeman/.ENV` passes it, and on a case-insensitive
|
||||
// filesystem (the macOS default) that IS this file.
|
||||
/\/\.codeman[^/]*\/\.env$/i,
|
||||
// Codeman's own state files. Named once `.json` became previewable outside
|
||||
// the workspace: `SessionState.envOverrides` persists whatever the user set
|
||||
// for a session, and the env allowlist admits key-shaped names
|
||||
|
||||
Reference in new issue
Block a user