Move docs directory validation to after copying README.md
Signed-off-by: Ruslans Tarasovs <ruslan@tarasovs.com>
This commit is contained in:
committed by
Ruslans Tarasovs
parent
fd1854e3bc
commit
6ce84626ab
@@ -121,11 +121,6 @@ export class TechdocsGenerator implements GeneratorBase {
|
||||
this.options.dangerouslyAllowAdditionalKeys,
|
||||
);
|
||||
|
||||
// Validate that no symlinks in the docs directory point outside the input directory
|
||||
// This prevents path traversal attacks where malicious symlinks could leak host files
|
||||
const resolvedDocsDir = path.join(inputDir, docsDir ?? 'docs');
|
||||
await validateDocsDirectory(resolvedDocsDir, inputDir);
|
||||
|
||||
if (parsedLocationAnnotation) {
|
||||
await patchMkdocsYmlPreBuild(
|
||||
mkdocsYmlPath,
|
||||
@@ -139,6 +134,12 @@ export class TechdocsGenerator implements GeneratorBase {
|
||||
await patchIndexPreBuild({ inputDir, logger: childLogger, docsDir });
|
||||
}
|
||||
|
||||
// Validate that no symlinks in the docs directory point outside the input directory
|
||||
// This prevents path traversal attacks where malicious symlinks could leak host files
|
||||
const resolvedDocsDir = path.join(inputDir, docsDir ?? 'docs');
|
||||
|
||||
await validateDocsDirectory(resolvedDocsDir, inputDir);
|
||||
|
||||
// patch the list of mkdocs plugins
|
||||
const defaultPlugins = this.options.defaultPlugins ?? [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user