mirror of
https://github.com/openai/codex-security.git
synced 2026-12-03 02:41:33 +08:00
fix(patch): mask absent cache paths during Linux model startup
This commit is contained in:
+10
-17
@@ -18968,29 +18968,22 @@ export async function readSkillCommandOutput(
|
||||
modelReadOnlyPaths.add(path);
|
||||
}
|
||||
}
|
||||
const filesystem: JsonObject = { ...profile.filesystem };
|
||||
for (const path of modelReadOnlyPaths) {
|
||||
// Binding a missing cache read-only can race another Linux
|
||||
// sandbox removing its temporary mount source.
|
||||
const mask = process.platform === "linux" && !existsSync(path);
|
||||
filesystem[path] = { ".": mask ? "deny" : "read" };
|
||||
}
|
||||
// Snapshot Git still needs the operator configuration. The model
|
||||
// must not read those files through its inherited workspace policy.
|
||||
for (const path of appServer.permissions.externalConfigPaths ?? [])
|
||||
filesystem[path] = { ".": "deny" };
|
||||
startThread({
|
||||
...workspaceOverride,
|
||||
default_permissions: permissionProfile!,
|
||||
permissions: {
|
||||
[permissionProfile!]: {
|
||||
...profile,
|
||||
filesystem: {
|
||||
...profile.filesystem,
|
||||
...Object.fromEntries(
|
||||
[...modelReadOnlyPaths].map((path) => [
|
||||
path,
|
||||
{ ".": "read" },
|
||||
]),
|
||||
),
|
||||
...Object.fromEntries(
|
||||
(appServer.permissions.externalConfigPaths ?? []).map(
|
||||
(path) => [path, { ".": "deny" }],
|
||||
),
|
||||
),
|
||||
},
|
||||
},
|
||||
[permissionProfile!]: { ...profile, filesystem },
|
||||
},
|
||||
});
|
||||
continue;
|
||||
|
||||
@@ -427,6 +427,8 @@ glob_scan_max_depth = 8
|
||||
...profiles[name],
|
||||
filesystem: snapshotFilesystem,
|
||||
});
|
||||
const cacheAccess =
|
||||
process.platform === "linux" && !existingStorage ? "deny" : "read";
|
||||
expect(profiles[name]!["filesystem"]).toEqual({
|
||||
...snapshotFilesystem,
|
||||
...Object.fromEntries(
|
||||
@@ -437,7 +439,7 @@ glob_scan_max_depth = 8
|
||||
(configured && dirname(path) === extra),
|
||||
),
|
||||
...(configured ? (permissions.externalCachePaths ?? []) : []),
|
||||
].map((path) => [path, { ".": "read" }]),
|
||||
].map((path) => [path, { ".": cacheAccess }]),
|
||||
),
|
||||
...Object.fromEntries(
|
||||
(permissions.externalConfigPaths ?? []).map((path) => [
|
||||
|
||||
Reference in New Issue
Block a user