Skip to content

Do not allow POST requests to /sitemaps - #3491

Draft
hannako wants to merge 1 commit into
mainfrom
sitemaps_error_handling
Draft

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

Conversation

@hannako

@hannako hannako commented Feb 4, 2026

Copy link
Copy Markdown
Contributor

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
Comment thread lib/rummager/app.rb
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

@emmalowe

emmalowe commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

Marking this as draft, since it's not being actively worked on.

There is a Jira ticket that captures this work, so we can reprioritise later: https://gov-uk.atlassian.net/browse/SCH-2004

@emmalowe
emmalowe marked this pull request as draft June 1, 2026 09:57
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.

3 participants