Skip to content

Commit 2372316

Browse files
committed
Switch to using Rails LTS community edition for Rails 2.3 to pick up security patches
1 parent 830c849 commit 2372316

5 files changed

Lines changed: 55 additions & 25 deletions

File tree

Gemfile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
source 'https://rubygems.org'
22

3-
gem "rails", "2.3.17"
3+
git 'https://github.com/makandra/rails.git', :branch => '2-3-lts' do
4+
gem 'rails', '~> 2.3.18'
5+
gem 'actionmailer', :require => false
6+
gem 'actionpack', :require => false
7+
gem 'activerecord', :require => false
8+
gem 'activeresource', :require => false
9+
gem 'activesupport', :require => false
10+
gem 'rack', :require => false
11+
end
412
gem "mysql"
513
gem "tzinfo", "~> 0.3.61" # See https://github.com/asalant/freehub/pull/56
614
gem 'authorization', git: "https://github.com/asalant/rails-authorization-plugin"

Gemfile.lock

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,37 @@ GIT
44
specs:
55
authorization (1.0.12)
66

7+
GIT
8+
remote: https://github.com/makandra/rails.git
9+
revision: c5617b2672bb0a51d01aee619c9329a0b38f6322
10+
branch: 2-3-lts
11+
specs:
12+
actionmailer (2.3.18.60)
13+
actionpack (= 2.3.18.60)
14+
actionpack (2.3.18.60)
15+
activesupport (= 2.3.18.60)
16+
rack (< 1.5)
17+
activerecord (2.3.18.60)
18+
activesupport (= 2.3.18.60)
19+
activeresource (2.3.18.60)
20+
activesupport (= 2.3.18.60)
21+
activesupport (2.3.18.60)
22+
rack (1.4.7.27)
23+
rails (2.3.18.60)
24+
actionmailer (= 2.3.18.60)
25+
actionpack (= 2.3.18.60)
26+
activerecord (= 2.3.18.60)
27+
activeresource (= 2.3.18.60)
28+
activesupport (= 2.3.18.60)
29+
railties (= 2.3.18.60)
30+
railties (2.3.18.60)
31+
actionpack (= 2.3.18.60)
32+
activesupport (= 2.3.18.60)
33+
rake (>= 0.8.3)
34+
735
GEM
836
remote: https://rubygems.org/
937
specs:
10-
actionmailer (2.3.17)
11-
actionpack (= 2.3.17)
12-
actionpack (2.3.17)
13-
activesupport (= 2.3.17)
14-
rack (~> 1.1.0)
15-
activerecord (2.3.17)
16-
activesupport (= 2.3.17)
17-
activeresource (2.3.17)
18-
activesupport (= 2.3.17)
19-
activesupport (2.3.17)
2038
acts-as-taggable-on (2.0.6)
2139
annotate (2.6.2)
2240
activerecord (>= 2.3.0)
@@ -33,14 +51,6 @@ GEM
3351
mysql (2.9.1)
3452
newrelic_rpm (3.7.3.204)
3553
power_assert (0.3.0)
36-
rack (1.1.6)
37-
rails (2.3.17)
38-
actionmailer (= 2.3.17)
39-
actionpack (= 2.3.17)
40-
activerecord (= 2.3.17)
41-
activeresource (= 2.3.17)
42-
activesupport (= 2.3.17)
43-
rake (>= 0.8.3)
4454
raindrops (0.19.0)
4555
rake (10.1.1)
4656
rdoc (4.1.1)
@@ -58,6 +68,11 @@ PLATFORMS
5868
ruby
5969

6070
DEPENDENCIES
71+
actionmailer!
72+
actionpack!
73+
activerecord!
74+
activeresource!
75+
activesupport!
6176
acts-as-taggable-on (= 2.0.6)
6277
annotate
6378
authorization!
@@ -68,7 +83,8 @@ DEPENDENCIES
6883
json (= 1.7.7)
6984
mysql
7085
newrelic_rpm
71-
rails (= 2.3.17)
86+
rack!
87+
rails (~> 2.3.18)!
7288
rdoc
7389
test-unit
7490
thoughtbot-shoulda
@@ -77,4 +93,4 @@ DEPENDENCIES
7793
validates_email_format_of
7894

7995
BUNDLED WITH
80-
1.15.4
96+
1.17.3

MIGRATION_CHECKLIST.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
- [x] **Homepage N+1 queries** - Replaced per-org queries with single `active` scope using SQL aggregation and correlated subquery. Added composite index on `visits(person_id, arrived_at)`. Upgraded DB to Premium AMD 2GB. Homepage: 30s+ → ~1.9s.
1515
- [x] **Review other slow pages** if any
1616

17+
## Security
18+
19+
- [x] **Rails LTS** - Switched to [Rails LTS community edition](https://github.com/makandra/rails/tree/2-3-lts) (2.3.18.60). Patches 209+ CVEs including remote code execution, SQL injection, XSS, and directory traversal. Rack upgraded from 1.1.6 to 1.4.7.27. Hardened mode enabled (disables XML/JSON parameter parsing, escapes HTML in JSON).
20+
1721
## DNS Cutover
1822

1923
- [ ] **Add custom domains** in App Platform settings:

config/environment.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
# Be sure to restart your server when you modify this file
22

3-
# Specifies gem version of Rails to use when vendor/rails is not present
4-
RAILS_GEM_VERSION = '2.3.17' unless defined? RAILS_GEM_VERSION
5-
63
# Bootstrap the Rails environment, frameworks, and default configuration
74
require File.join(File.dirname(__FILE__), 'boot')
85

@@ -38,6 +35,11 @@
3835
config.time_zone = 'Pacific Time (US & Canada)'
3936
config.active_record.default_timezone = :utc
4037

38+
# Rails LTS security hardening: disables XML/JSON parameter parsing,
39+
# escapes HTML entities in JSON, and other security improvements.
40+
# See https://makandracards.com/railslts/16311-enabling-additional-security-features-rails-lts
41+
config.rails_lts_options = { :default => :hardened }
42+
4143
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
4244
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
4345
# config.i18n.default_locale = :de

config/initializers/utf8_params.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
raise "Check if this is still needed on #{Rails.version} (it is not in Rails 3.x)" unless Rails.version == '2.3.17'
1+
raise "Check if this is still needed on #{Rails.version} (it is not in Rails 3.x)" unless Rails.version.start_with?('2.3.')
22

33
class ActionController::Base
44

0 commit comments

Comments
 (0)