Skip to content

Remove dead migration-audit routes that 500 on bot probes#1906

Open
maebeale wants to merge 1 commit into
mainfrom
maebeale/fix-missing-images-controller
Open

Remove dead migration-audit routes that 500 on bot probes#1906
maebeale wants to merge 1 commit into
mainfrom
maebeale/fix-missing-images-controller

Conversation

@maebeale

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 📖 Read — light-logic: removes routes pointing at non-existent controllers; verified nothing references them

What is the goal of this PR and why is this important?

Leftover "migration audit" routes (images, the images namespace, attachments, media_files) pointed at controllers that never existed, so any request matching them raised ActionDispatch::MissingController — a 500 instead of a 404. A bot probing GET /images/index.php matched resources :images and dispatched to the missing ImagesController, generating Honeybadger noise.

How did you approach the change?

Removed the dead routes (keeping primary_assets and rich_text_assets, the only two backed by real controllers and actually used — no route helpers reference the removed ones). Added a request spec asserting each removed path now 404s; it fails 7/7 on the old routes and passes after the fix.

Anything else to add?

This was purely bot/scanner traffic probing for PHP vulnerabilities — no real user or data was affected. A routing spec can't catch this since recognition masks the missing controller as a RoutingError; only full dispatch reproduces the 500, so the test is a request spec.

These routes pointed at controllers that never existed, so any request
they matched raised ActionDispatch::MissingController (a 500) instead of
a 404. A bot probing GET /images/index.php matched `resources :images`
and dispatched to the missing ImagesController, generating Honeybadger
noise. Only primary_assets and rich_text_assets have real controllers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
# A bot probing GET /images/index.php matched `resources :images` and dispatched
# to the missing ImagesController, raising ActionDispatch::MissingController (a
# 500) instead of a plain 404. These paths must be unrouted, i.e. raise a
# routing error rather than a missing-controller error.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Deliberately a request spec, not a routing spec — recognize_path masks the missing controller as a RoutingError, so a routing spec would pass even with the broken routes still present. Only full dispatch reproduces the 500, so this hits the real path and asserts a 404.

@maebeale maebeale marked this pull request as ready for review June 24, 2026 00:53
@maebeale maebeale requested a review from jmilljr24 June 24, 2026 00:53

@jmilljr24 jmilljr24 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

If the routes no longer exist, I'm not sure we need any tests?

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