Skip to content

Conversation

@augustuswm
Copy link
Contributor

Adds rudimentary support for includes during local editing that roughly matches include handling by the RFD API.

@vercel
Copy link

vercel bot commented Mar 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
rfd-site ✅ Ready (Inspect) Visit Preview Mar 17, 2025 11:40pm


function checkForRelativePath(path: string) {
if (path.includes('..')) {
throw new Error('Path must not include any relative path parts')
Copy link
Contributor

@david-crespo david-crespo Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd log the bad path here and say "include path", not just path, to make it easier to figure out the problem. Might also say "no directory traversal with .." instead of "no relative path parts", I'm not sure the latter is recognizable enough. And as far as I can tell, you actually require the path itself to be relative to the RFD dir. So something like:

throw new Error(`Directory traversal with ".." is not allowed in include:: path. Bad path is ${path}. Included path must be relative to RFD dir ${localRepo}/rfd/${numStr}.`)

@benjaminleonard
Copy link
Collaborator

Good to merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants