Files
zeekayandHanzo Dev 4855f06fd1
CI / build (push) Failing after 33s
Go / generate (push) Failing after 46s
fix(execd): confine git, make patch all-or-nothing, answer only what happened
The git ceiling named the workspace, which git only applies to a proper
ancestor of the directory it starts from, so a request with no dir found,
read and wrote a repository above the workspace. The ceiling is now the
workspace's parent, which refuses from the root and from any directory
under it.

patch staged by action id, so two changes naming one file collided and
the second failed with the first's bytes already in place, and a delete
that could not happen left earlier renames behind. Every change now
stages under a random name, the file that was there is kept on a second
link until every move has landed, and a move that fails is put back. A
diff that names one file twice, gives two names for one file, would
delete a directory, or renames is refused.

A zero-length packet is a packet on SOCK_SEQPACKET, and reading it as end
of file ended the daemon for good. POLLRDHUP tells the two apart.

Also: a listing fills a page to what a frame holds instead of promising
4096 entries no frame can carry; write and patch resolve the parent with
openat2 on the path as written, so one string cannot mean two places; a
refused request is not recorded, so its id is free, while an action that
ran is recorded whatever came of it; a staged name is random, so a
workspace file is never unlinked to make room; children start from a
declared environment instead of the daemon's; write reports the mode on
disk and keeps the mode a file had; mode means permission bits in stat as
well as read and list; a read past the end is refused; an oversize
refusal names the op it refused; the ledger is bounded by bytes as well
as count; the diff path is the reading both header lines agree on; the
build constraint sits above the package doc; and BUILD embeds a library,
which is how the repo builds a main package with tests.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-18 17:49:38 -07:00

53 lines
1.1 KiB
Python

load("//tools:defs.bzl", "go_binary", "go_library", "go_test")
package(
default_applicable_licenses = ["//:license"],
licenses = ["notice"],
)
go_library(
name = "lib",
srcs = [
"exec.go",
"file.go",
"frame.go",
"git.go",
"ledger.go",
"main.go",
"patch.go",
"pty.go",
"root.go",
"serve.go",
"watch.go",
],
stateify = False,
deps = [
"@com_github_creack_pty//:go_default_library",
"@com_github_zap_proto_go//:go_default_library",
"@org_golang_x_sys//unix:go_default_library",
],
)
# The sources are the library's, so nogo analyses them there.
go_binary(
name = "execd",
embed = [":lib"],
nogo = False,
pure = True,
visibility = ["//visibility:public"],
)
go_test(
name = "execd_test",
size = "medium",
srcs = [
"frame_test.go",
"ledger_test.go",
"patch_test.go",
"root_test.go",
"serve_test.go",
],
library = ":lib",
deps = ["@org_golang_x_sys//unix:go_default_library"],
)