pub fn validate_plugin_relative(
value: &str,
root: &Path,
) -> Result<PathBuf, PluginError>Expand description
Validate that a plugin-relative path stays inside the plugin root.
Uses canonicalize (which resolves symlinks) so a symlink inside the
plugin pointing outside (e.g. bin/link -> /etc) cannot smuggle a path out
of the sandbox. The candidate must start with ./ per the Agent Plugins
spec.
The target need not exist yet (a plugin may spawn a binary built at runtime), so when it is absent we canonicalize the deepest existing ancestor and verify the remaining suffix stays lexically inside the canonicalized root.