commit a2e308335edeac502b28001eec85bba89e74ee659b50fdb52934ae3d09d9b913 from: Stefan Sperling date: Thu Jun 5 16:04:42 2025 UTC relax repository path permission checks in gotsys-repo-create Since gotwebd can now be given read access to gotd repositories by making the directory readable for the _gotwebd group, these checks are too strict. Stop requiring a specific GID, and allow group rx bits to be set for group read access. As before, keep rejecting world/other rwx bits for safety. Read access to repositories is supposed to be managed by gotd. commit - d8edb9b3d7629efe31c0e33d56acc527255f73aed8d47bababbc7bdc0670105e commit + a2e308335edeac502b28001eec85bba89e74ee659b50fdb52934ae3d09d9b913 blob - 10557582fdaf88cb11560040625cf59b5799fb6882ecc02caf10e0bf00a26cfe blob + 9c221635c5cc9d8753e67fdcf1b17c74298c3a837a1b7e0f88e9e6b36a04c352 --- gotsysd/libexec/gotsys-repo-create/gotsys-repo-create.c +++ gotsysd/libexec/gotsys-repo-create/gotsys-repo-create.c @@ -473,20 +473,21 @@ main(int argc, char **argv) goto done; } - if (gotd_gid != sb.st_gid) { + if (sb.st_mode & (S_IWGRP | S_IWOTH)) { error = got_error_fmt(GOT_ERR_BAD_PATH, - "directory is not owned by GID %u: %s", - gotd_gid, repos_path); - goto done; - } - - if (sb.st_mode & (S_IRWXG | S_IRWXO)) { - error = got_error_fmt(GOT_ERR_BAD_PATH, - "directory must only be accessible/writable by user %s: %s", + "directory must only be writable by user %s: %s", username, repos_path); goto done; } + if (sb.st_mode & (S_IROTH | S_IXOTH)) { + error = got_error_fmt(GOT_ERR_BAD_PATH, + "directory must not be world-readable: %s; " + "chmod 750 %s or chmod 700 %s recommended", + repos_path, repos_path, repos_path); + goto done; + } + if (gotsysd_imsg_compose_event(&iev, GOTSYSD_IMSG_PROG_READY, 0, -1, NULL, 0) == -1) { error = got_error_from_errno("gotsysd_imsg_compose_event");