Skip to content

WA-VERIFY-071 follow-up: Fix EnforceHostMiddleware NameError in Rails 7.0 appraisal boot #1058

@kitcommerce

Description

@kitcommerce

Summary

During WA-VERIFY-071 (PR #1049), the Rails 7.0 deprecation baseline capture was blocked because the test suite cannot boot under the Rails 7.0 appraisal.

Error

uninitialized constant Workarea::EnforceHostMiddleware (NameError)
.../core/config/initializers/10_rack_middleware.rb:56

Impact

  • Rails 7.0 test suite cannot run at all — no deprecation warnings can be captured
  • The deprecation baseline (goal of WA-VERIFY-071) is blocked until this is resolved

Security Note

EnforceHostMiddleware enforces HTTP Host header validation. Its absence in the Rails 7.0 appraisal means the upgrade path currently lacks this protection. Rails 7.0 introduced native config.hosts allowlist enforcement — this investigation should determine whether:

  1. The native Rails 7.0 host protection supersedes EnforceHostMiddleware and the middleware can be removed/shimmed
  2. Or the middleware needs to be updated for Rails 7.0 compatibility

Steps to Reproduce

BUNDLE_GEMFILE=gemfiles/rails_7_0.gemfile bundle exec rake core_test

Expected: test suite runs
Actual: aborts with NameError for Workarea::EnforceHostMiddleware

Also Noted

The top-level rake test task is incompatible with the Rails 7.0 appraisal — it prints the rails new usage banner instead of running tests. This may be a separate issue with the Rakefile task definition under the appraisal environment.

Acceptance Criteria

  • Identify whether EnforceHostMiddleware needs updating or can be replaced by Rails 7.0 native host enforcement
  • Rails 7.0 appraisal boots successfully through the test environment initialization
  • rake core_test (or equivalent) can run at least one test under Rails 7.0 appraisal
  • WA-VERIFY-071 deprecation baseline can be re-attempted

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions