Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirects: additional checks to ensure relative and not-too-long filepaths #756

Open
gwern opened this issue Feb 22, 2020 · 0 comments
Open

Comments

@gwern
Copy link
Contributor

gwern commented Feb 22, 2020

While writing redirects, I continue to make two errors routinely when copying from my Google Analytics's 404 data: I accidentally leave in the root '/', and I try to make redirects where the original error is invalid as a file because it's too long. These both cause gwern.net builds to fail, often while unattended, when it tries to create invalid files.
The attached patch adds two more checks for these:

0001-Redirect-checks-for-absolute-path-redirects-typicall.patch.txt

It is possible for redirects to fail these checks and still be valid: a root offender could hypothetically still work if it was written as something like ('/home/gwern/wiki/_site/foo', '/foobar'), and some filesystems allow >255 character filenames. But anyone writing redirects like those should seriously rethink what they are doing, as the former is perverse and the latter is nonportable / FS-specific.

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

No branches or pull requests

1 participant