Refuse base-repo installs under GL_SCOPE_USR at the library level
gl_install_pkg now returns GL_INSTALL_ERR_SCOPE for scope == GL_SCOPE_USR && repo == "base", checked immediately after manifest parse and before any store path construction or filesystem mutation. Per SECURITY_DESIGN.txt section 8: enforced in the library rather than a CLI, since the split-.so architecture lets third-party tools call gl_install_pkg directly. Also drops src/istoreutils.c.rej, .c.back, .h.back — stale leftovers from the uid -> gl_context_t migration patch; that migration is fully present in the current tree, so these were dead weight. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b22e3746a
commit
c432274936
5 files changed
+22
-1768
No files matched your search
@@ -1188,6 +1188,27 @@ gl_install_pkg(gl_context_t *ctx, const char *gpkg_path)
|
||||
if (!manifest_found) {
|
||||
return GL_INSTALL_ERR_MANIFEST;
|
||||
}
|
||||
|
||||
/*
|
||||
* Base-repo packages can NEVER be installed under per-user scope.
|
||||
* Enforced here, at the library level, rather than in any CLI: the
|
||||
* split-.so architecture means a third-party tool can call
|
||||
* gl_install_pkg directly without going through gpkg/syspkg, and a
|
||||
* rule only one CLI respects is not a real guarantee. See
|
||||
* SECURITY_DESIGN.txt section 8.
|
||||
*
|
||||
* This is the earliest possible point — pkg.pkg_repo only exists
|
||||
* once the manifest is parsed — and deliberately sits before any
|
||||
* store path construction or filesystem mutation below.
|
||||
*/
|
||||
if (ctx->scope == GL_SCOPE_USR &&
|
||||
strcmp(pkg.pkg_repo, GL_BASE_REPO) == 0) {
|
||||
lg_printf(2,
|
||||
"Refusing to install base-repo package '%s' under user scope.",
|
||||
pkg.pkg_name);
|
||||
gl_free_pkg(&pkg);
|
||||
return GL_INSTALL_ERR_SCOPE;
|
||||
}
|
||||
|
||||
char pkg_store_base[PATH_MAX];
|
||||
char pkg_store_final[PATH_MAX];
|
||||
|
||||
Reference in new issue
Block a user