Permalink
Show file tree
Hide file tree
28 changes: 28 additions & 0 deletions
28
packages/techdocs-common/src/stages/generate/helpers.test.ts
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Add validation to prevent docs_dir from being an absolute path
* Adds a new validation function to helpers to prevent generation when mkdocs.yml is not present or is invalid * Handles vulnerability where docs_dir can be put in as an absolute path which copies and exposes the files from that absolute path in the file system Signed-off-by: Jussi Hallila <jussi@hallila.com>
- Loading branch information
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@backstage/techdocs-common': patch | ||
| --- | ||
|
|
||
| Adding validation to mkdocs.yml parsing to prevent directory tree traversing |
3 changes: 3 additions & 0 deletions
3
packages/techdocs-common/src/stages/generate/__fixtures__/mkdocs_invalid_doc_dir.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| site_name: Test site name | ||
| site_description: Test site description | ||
| docs_dir: /etc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters