codex: sanitize plugin cache paths
Use sanitized plugin name and version components for cache targets while preserving manifest names in Codex config.
This commit is contained in:
@@ -9,7 +9,10 @@ in
|
||||
programs.codex = {
|
||||
enable = true;
|
||||
package = codexPackage;
|
||||
plugins = [ ./sample-plugin ];
|
||||
plugins = [
|
||||
./sample-plugin
|
||||
./unsafe-plugin
|
||||
];
|
||||
marketplaces.team = ./sample-marketplace;
|
||||
};
|
||||
|
||||
@@ -21,12 +24,15 @@ in
|
||||
assertFileContains home-files/.codex/config.toml 'source_type = "local"'
|
||||
assertFileContains home-files/.codex/config.toml 'source = "${./sample-marketplace}"'
|
||||
assertFileContains home-files/.codex/config.toml '[plugins."sample-plugin@home-manager"]'
|
||||
assertFileContains home-files/.codex/config.toml '[plugins."../../../outside@home-manager"]'
|
||||
assertFileContains home-files/.codex/config.toml 'enabled = true'
|
||||
|
||||
assertFileExists home-files/.agents/plugins/marketplace.json
|
||||
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "home-manager"'
|
||||
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "sample-plugin"'
|
||||
assertFileContains home-files/.agents/plugins/marketplace.json '"path": "./.codex/plugins/cache/home-manager/sample-plugin/1.0.0"'
|
||||
assertFileContains home-files/.agents/plugins/marketplace.json '"name": "../../../outside"'
|
||||
assertFileContains home-files/.agents/plugins/marketplace.json '"path": "./.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-"'
|
||||
|
||||
assertLinkExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0
|
||||
assertFileExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/.codex-plugin/plugin.json
|
||||
@@ -34,5 +40,8 @@ in
|
||||
home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/.codex-plugin/plugin.json \
|
||||
${./sample-plugin/.codex-plugin/plugin.json}
|
||||
assertFileExists home-files/.codex/plugins/cache/home-manager/sample-plugin/1.0.0/skills/sample/SKILL.md
|
||||
assertLinkExists home-files/.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-
|
||||
assertFileExists home-files/.codex/plugins/cache/home-manager/-..-..-outside/1.0.0-touch-pwned-/.codex-plugin/plugin.json
|
||||
assertPathNotExists home-files/.codex/plugins/outside
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "../../../outside",
|
||||
"version": "1.0.0$(touch pwned)",
|
||||
"description": "Unsafe Codex plugin name for Home Manager tests."
|
||||
}
|
||||
Reference in New Issue
Block a user