resolveSafeChildPath()
Home > @backstage/backend-plugin-api
> resolveSafeChildPath
Resolves a target path from a base path while guaranteeing that the result is a path that point to or within the base path. This is useful for resolving paths from user input, as it otherwise opens up for vulnerabilities.
Signature:
function resolveSafeChildPath(base: string, path: string): string;
Parameters
Parameter |
Type |
Description |
---|---|---|
base |
string |
The base directory to resolve the path from. |
path |
string |
The target path, relative or absolute |
string
A path that is guaranteed to point to or within the base path.