You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A file added by a patch is always created 0o444: the manifest has no per-file mode, so a patch cannot add an executable or a shared library #2196
A file that a patch ADDS is written with mode 0o444 (StageMode::ReadOnly, crates/socket-patch-core/src/patch/apply.rs:878; the mode is described at apply.rs:608). The manifest has nowhere to say otherwise: PatchFileInfo holds only beforeHash and afterHash (crates/socket-patch-core/src/manifest/schema.rs:23). An existing file keeps its own mode, so this only affects new files.
Why this matters
A patch cannot add an executable script, or a new shared library where the platform expects the execute bit. For patches made of rebuilt artifacts this comes up when a fix adds a helper binary or splits a library.
Suggested direction
An optional per-file mode in the manifest (absent = today's behaviour), applied on create and restored by rollback. If a general mode is too broad, a single boolean for the execute bit would cover the cases above.
[agent] Looked at what this needs. Not started: the field is a contract between the patch service and the CLI, so its shape needs a decision first, and it needs a matching change in Socket's backend.
A file a patch adds is staged read-only (StageMode::ReadOnly), and neither the patch API's file entry (PatchFileResponse) nor the manifest's (PatchFileInfo) has a place for a mode.
Released clients tolerate a new per-file field: neither type rejects unknown fields. One caveat: a released client that rewrites .socket/manifest.json drops a field it does not know, so in a project that mixes CLI versions an older run would lose it, and a later apply would create the file without it.
Proposal, the smallest thing that covers the cases in the issue:
one optional boolean per file, executable, in the API's file entry and in the manifest; absent means today's behaviour;
it applies only where the patch creates the file (an existing file keeps its own mode, as today), sets the execute bits the umask allows, and is ignored on Windows;
no general mode: a server-supplied mode could ask for setuid, setgid or world-writable files, and nothing in the issue needs more than the execute bit. A shared library loads without it on Linux and macOS, so the real need is scripts and helper binaries;
rollback already removes a file a patch added, so there is nothing to restore.
The CLI half is small and could land ahead of the backend, since an absent field changes nothing.
[agent] Janitor: #2433 (762cec2) added a per-file mode to the manifest, but it doesn't cover this issue, so I'm leaving it open.
In #2433, mode is an upper bound on write bits. apply clears group-write and other-write bits the mode doesn't grant. It never sets bits, and it never reads or changes the execute bit. A file that a patch creates is still staged StageMode::ReadOnly (crates/socket-patch-core/src/patch/apply.rs:1353 on 6280589), so a patch still can't add an executable script or library. The mode field could carry this later, but its meaning would have to grow from "clear these write bits" to "set these bits when the file is created", and that needs the contract decision described in the comment above.
Activity
mikolalysenko commentedon Dec 1, 2026
[agent] Looked at what this needs. Not started: the field is a contract between the patch service and the CLI, so its shape needs a decision first, and it needs a matching change in Socket's backend.
Checked on
mainat 1b3f422:StageMode::ReadOnly), and neither the patch API's file entry (PatchFileResponse) nor the manifest's (PatchFileInfo) has a place for a mode..socket/manifest.jsondrops a field it does not know, so in a project that mixes CLI versions an older run would lose it, and a later apply would create the file without it.Proposal, the smallest thing that covers the cases in the issue:
executable, in the API's file entry and in the manifest; absent means today's behaviour;mode: a server-supplied mode could ask for setuid, setgid or world-writable files, and nothing in the issue needs more than the execute bit. A shared library loads without it on Linux and macOS, so the real need is scripts and helper binaries;rollbackalready removes a file a patch added, so there is nothing to restore.The CLI half is small and could land ahead of the backend, since an absent field changes nothing.
Generated by Claude Code
mikolalysenko commentedon Dec 2, 2026
[agent] Janitor: #2433 (
762cec2) added a per-filemodeto the manifest, but it doesn't cover this issue, so I'm leaving it open.In #2433,
modeis an upper bound on write bits.applyclears group-write and other-write bits the mode doesn't grant. It never sets bits, and it never reads or changes the execute bit. A file that a patch creates is still stagedStageMode::ReadOnly(crates/socket-patch-core/src/patch/apply.rs:1353on6280589), so a patch still can't add an executable script or library. Themodefield could carry this later, but its meaning would have to grow from "clear these write bits" to "set these bits when the file is created", and that needs the contract decision described in the comment above.Generated by Claude Code