Skip to content

Do not allow POST requests to /sitemaps#3491

Open
hannako wants to merge 1 commit intomainfrom
sitemaps_error_handling
Open

Do not allow POST requests to /sitemaps#3491
hannako wants to merge 1 commit intomainfrom
sitemaps_error_handling

Conversation

@hannako
Copy link
Copy Markdown
Contributor

@hannako hannako commented Feb 4, 2026

We get relatively frequent vulnerability scans to the sitemaps endpoint, attempting to post data. We should handle this.
Screenshot 2026-02-04 at 16 32 17

We get relatively frequent vulnerability scans to the sitemaps endpoint,
attempting to post data.

We should handle this.
@hannako hannako force-pushed the sitemaps_error_handling branch from 2ab14fa to caf1587 Compare February 4, 2026 16:31
serve_from_s3(sitemap)
end

post "/sitemaps/*" do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not sure this will fix it. The error in Sentry is Invalid multipart/form-data: Rack::Multipart::EmptyContentError (Sinatra::BadRequest) I think this is a bot sending a broken http request to the sitemaps endpoint

It's probably better to catch the Sinatra::BadRequest error like:

error Sinatra::BadRequest do
  status 400
  "Bad request"
end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe we need both? If a bot sends a valid body it would hit the post route right?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm actually not sure what would happen. Maybe it would return a 404? We could try it out using curl

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.

2 participants