Skip to content

Overly Restrictive Input Directory Validation? #139

@nickhudkins

Description

@nickhudkins

Hoping to understand the intent of the guard here:

if not self.absNavPath.startswith(self.rootDir):
log.critical(
"[mkdocs-monorepo] The mkdocs file {} is outside of the current directory. ".format(self.absNavPath) +
"Please move the file and try again."
)
raise SystemExit(1)

A repository structure I have worked with recently made this guard prohibitive to achieve what seemed like a reasonable organization strategy:

.
├── docs-site
│   └── mkdocs.yml # Root Project
│       # Contents:
│        #   package-a: !include ../package-a/mkdocs.yml
│        #   package-b: !include ../package-b/mkdocs.yml
├── package-a
│   ├── docs
│   │   └── index.md
│   └── mkdocs.yml # Package A Documentation (Included by Root)
└── package-b
    ├── docs
    │   └── index.md 
    └── mkdocs.yml # Package B Documentation (Included by Root)

By allowing upward traversal, self references might occur. If this guard is intended to protect against self references, could we consider a guard that specifically protects against self references but allows for upward and lateral traversal of the file system?

I was able to run a simple test to validate that the proper site is built when building the site with that guard removed. I have not validated what occurs in a situation where a self reference is attempted to be modeled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions