Repository navigation
Answer 404 for unknown pastes and add robots.txt - #38
Merged
Merged
Conversation
An unknown paste ID rendered the not-found panel with status 200. That made /robots.txt a paste page titled "Paste robots.txt", and every mistyped link looked like a real page to a crawler. The route now calls notFound(), and app/not-found.tsx shows the same panel with a 404. robots.txt allows the site and blocks /api/, /raw/ and /dl/, which serve the same content as the paste page.
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found in a crawl of msk-scripts.de with OpenSpider:
https://paste.msk-scripts.de/robots.txtanswered 200 with an HTML page titled "Paste robots.txt".app/[id]/page.tsx: an unknown ID now callsnotFound(). Before, the page rendered the not-found panel itself, so the status stayed 200 for every unknown ID.app/not-found.tsxshows the same panel, now with a 404.app/robots.ts: allows/, blocks/api/,/raw/and/dl/.Expired and burned pastes still render their panel with 200. They were real pages once, and changing that is a separate decision.
Typecheck and lint pass locally. The 404 needs the database, so it gets checked live after the deploy.