Commit Graph

43151 Commits

Author SHA1 Message Date
Jon Moss 00545f3221 Fix ActionView tests
Reverts some of the changes from #23242.
2016-01-28 21:25:27 -05:00
Jon Moss fb7b36e655 Add outside_app_allowed arg to find_templates
A backport of #23247 to 4-1-stable.
2016-01-28 21:25:01 -05:00
Rafael Mendonça França 1db1f82670 Bundle update 2016-01-28 21:24:52 -05:00
eileencodes 722aa32fa5 Run `file.close` before unlinking for travis
This works on OSX but for some reason travis is throwing a
```
  1) Error:
ExpiresInRenderTest#test_dynamic_render_with_absolute_path:
NoMethodError: undefined method `unlink' for nil:NilClass
```
Looking at other tests in Railties the file has a name and we close
it before unlinking, so I'm going to try that.
2016-01-28 15:52:42 -05:00
eileencodes 5f2195af48 Regression test for rendering file from absolute path
Test that we are not allowing you to grab a file with an absolute path
outside of your application directory. This is dangerous because it
could be used to retrieve files from the server like `/etc/passwd`.
2016-01-28 14:18:40 -05:00
Godfrey Chan 8cbf301b4a Fix actionpack test cases broken by #16888 2016-01-28 14:14:14 -05:00
Godfrey Chan f5f7eccc4f Revert "Revert "Merge pull request #16888 from jejacks0n/render_template""
This reverts commit 585e75696b.

Conflicts:
	actionview/CHANGELOG.md
	guides/source/4_2_release_notes.md
2016-01-28 14:12:50 -05:00
Aaron Patterson 683d4f7675 clear view path cache between tests
The cache for `render file:` seems to also be used in the case of
`render(string)`.  If one is supposed to be a hit and the other is
supposed to be a miss, and they both reference the same file, then the
cache could return incorrect values.  This commit clears the cache
between runs so that we get non-cached behavior.
2016-01-28 10:52:29 -08:00
Rafael França 98a01c6f01 Merge pull request #23288 from bdewater/sprockets3-sha2-alt
Fix img alt attribute generation when using Sprockets >= 3.0
2016-01-27 14:18:32 -05:00
Aaron Patterson e8eda76893 fix permitted? conditional for `render` calls 2016-01-26 18:00:35 -08:00
Aaron Patterson 56034c1538 Merge pull request #23242 from maclover7/fix-error-sec
Fix undefined error for `ActionController::Parameters`
2016-01-26 17:25:26 -08:00
Aaron Patterson 7921ff8c21 Merge branch '4-1-sec' into 4-1-stable
* 4-1-sec:
  bumping version
  Remove unnecessary caching
  Eliminate instance level writers for class accessors
  allow :file to be outside rails root, but anything else must be inside the rails view directory
  Don't short-circuit reject_if proc
  stop caching mime types globally
  use secure string comparisons for basic auth username / password
2016-01-25 11:24:03 -08:00
Aaron Patterson 31ab3aa0e8 bumping version 2016-01-25 10:26:09 -08:00
eileencodes 98629dfcce Remove unnecessary caching
`ActiveSupport::Dependencies.constantize(const_name)` calls
`Reference.new` which is defined as
`ActiveSupport::Dependencies.constantize(const_name)` meaning this call
is already cached and we're doing caching that isn't necessary.

Conflicts:
	actionpack/lib/action_dispatch/routing/route_set.rb

Conflicts:
	actionpack/lib/action_dispatch/routing/route_set.rb

CVE-2015-7581
2016-01-22 15:03:27 -08:00
Aaron Patterson 50d3d7d011 Eliminate instance level writers for class accessors
Instance level writers can have an impact on how the Active Model /
Record objects are saved.  Specifically, they can be used to bypass
validations.  This is a problem if mass assignment protection is
disabled and specific attributes are passed to the constructor.

Conflicts:
	activerecord/lib/active_record/scoping/default.rb
	activesupport/lib/active_support/callbacks.rb

CVE-2016-0753
2016-01-22 15:03:03 -08:00
Aaron Patterson be543e8e18 allow :file to be outside rails root, but anything else must be inside the rails view directory
Conflicts:
	actionpack/test/controller/render_test.rb
	actionview/lib/action_view/template/resolver.rb

CVE-2016-0752
2016-01-22 15:02:03 -08:00
Andrew White 5875bc3ade Don't short-circuit reject_if proc
When updating an associated record via nested attribute hashes the
reject_if proc could be bypassed if the _destroy flag was set in the
attribute hash and allow_destroy was set to false.

The fix is to only short-circuit if the _destroy flag is set and the
option allow_destroy is set to true. It also fixes an issue where
a new record wasn't created if _destroy was set and the option
allow_destroy was set to false.

CVE-2015-7577
2016-01-22 15:01:10 -08:00
Aaron Patterson 221937c8ba stop caching mime types globally
Unknown mime types should not be cached globally.  This global cache
leads to a memory leak and a denial of service vulnerability.

CVE-2016-0751
2016-01-22 15:00:00 -08:00
Aaron Patterson 859ca4474e use secure string comparisons for basic auth username / password
this will avoid timing attacks against applications that use basic auth.

Conflicts:
	activesupport/lib/active_support/security_utils.rb

CVE-2015-7576
2016-01-22 14:56:47 -08:00
Rafael França a96c7233b1 Merge pull request #22968 from rabbitt/bugfix/rails41-logger-threadsafety
4.1 Backport of LoggerSilence#silence Threadsafety patch (see: PR #20507)
2016-01-15 14:31:02 -02:00
Carl P. Corliss e713069f20 4.1 Backport of LoggerSilence#silence Threadsafety patch (see: PR #20507)
- Uses Logger instance defined level if no custom local log level defined
- Keeps track of local log level per logger instance + thread id
- Prevents memory leakage by removing local level hash key/value on #silence method exit
- Test case for threadsafety issue added (and passes with these changes), based @rdubya's tests
- Fixes #20490 and supersedes https://github.com/rails/rails/pull/16885
2016-01-07 18:20:45 -05:00
Robin Dupret 766a0cd7de Avoid relying on error messages when rescuing
When we are rescuing from an error, it's a brittle approach to do checks
with regular expressions on the raised message because it may change in
in the future and error messages are different across implementations.

The NameError API could be improved at the MRI level but for now we need
to rely on its #name. A #== check will only pass for top level constants
or only when the last constant of the path is missing so we need to rely
on #include? instead. For instance:

    begin
      Namespace::Foo
    rescue NameError => e
      e.name # => :Namespace
    end

However, if the name-space already exists, only the name of the first
missing constant in the path is returned (e.g. for Math::PHI, the name
would be :PHI). JRuby will return a fully qualified name (:"Math::PHI").

We need to keep the == check for 1.9 compatibility since const_get will
raise a NameError with a name attribute set to the given string if it's
one of "::" or "".

See http://git.io/jnSN7g for further information.
2015-12-25 18:17:19 -02:00
Arthur Neves 7fd06ee2d2 Dont check bundler output on plugin generator test 2015-12-25 18:09:05 -02:00
Rafael Mendonça França 1703dd70a6 Bundle update 2015-12-25 18:09:01 -02:00
Rafael França d6fbf8774d Merge pull request #22792 from maclover7/patch-3
Add Ruby 2.3.0 to Travis matrix
2015-12-25 14:54:31 -02:00
Rafael França 7310a6d5c8 Merge pull request #22543 from datanoise/master
Fixed typo in mysql client parameter
2015-12-09 19:40:52 -02:00
Rafael Mendonça França 689df94716 Merge branch '4-1-14' into 4-1-stable 2015-11-17 17:02:34 -02:00
yui-knk 32ca78a670 Make `AR::SpawnMethods#merge!` to check an arg is a Proc
From Ruby ( 2.3.0dev trunk 52520), `Hash#to_proc` is defined
(fbe967ec02),
and many tests have been failed with
`ArgumentError: wrong number of arguments (given 0, expected 1)`.
Because we call `Hash#to_proc` with no args in `#merge!`.

This commit changes order of conditionals to not call `Hash#to_proc`.

(cherry picked from commit a98475c2df)
2015-11-17 14:05:36 +00:00
Rafael Mendonça França e694ac5fbc Preparing for 4.1.14 release 2015-11-12 15:17:28 -02:00
Rafael Mendonça França 84ef6032e5 Ignore Gemfile.lock in the release task 2015-11-12 15:12:27 -02:00
Christoph 4696e0d439 Fix week_field returning invalid value
According to the W3 spec[1] the value should use a 1-based index
and not a 0-based index for the week number.

[1]: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week

(cherry picked from commit 60dabb156f)
2015-11-10 12:43:21 +00:00
Rafael Mendonça França 96c4b1a131 Preparing for 4.1.14.rc2 release 2015-11-05 00:53:25 -02:00
Rafael Mendonça França bfff3c7192 Add bundle check to release task 2015-11-05 00:52:35 -02:00
Andrew White 7df77cf87e Fix tests for cd900f1
Backport additional changes from merge commit 9f4cefd
2015-11-04 12:34:41 +00:00
Andrew White 3c02257838 Fix tests for cd900f1
Backport additional changes from merge commit 9f4cefd
2015-11-04 12:21:57 +00:00
Andrew White 667373eb80 Remove deprecated pg_dump -i flag
Backport of f383552
2015-11-04 12:00:06 +00:00
Andrew White cd900f10a7 Remove deprecated pg_dump -i flag
Backport of f383552
2015-11-04 11:55:42 +00:00
Rafael Mendonça França 4986709fe0 Make sure mail_to work with nil and SafeBuffer 2015-11-03 20:01:20 -02:00
Rafael Mendonça França c8b69cde98 Make sure mail_to work with nil and SafeBuffer 2015-11-03 20:01:06 -02:00
Rafael Mendonça França 23df880908 Update the gem versions 2015-10-30 17:55:48 -02:00
Rafael Mendonça França 7ecac3e9f8 Prepare to 4.1.14.rc1 2015-10-30 17:34:57 -02:00
Rafael Mendonça França a76d1d7a9d Add tasks to automatize CHANGELOG headers 2015-10-30 17:33:31 -02:00
Rafael Mendonça França d0b60f3cd8 Add version constraint to database gem in generated application
We are using the same version constraint in the database adapters so
when a new version of the adapter that doesn't work with the version of
rails is released we don't break new applications.
2015-10-29 22:18:31 -02:00
Rafael Mendonça França 233091c0ec Don't use mysql2 0.4 in our tests. 2015-10-29 18:30:01 -02:00
Rafael Mendonça França 55084747ec Merge pull request #18383 from scambra/habtm-with-where-includes-16032-for-master
Includes HABTM returns correct size now
2015-10-27 22:23:03 -02:00
yuuji.yaginuma 13dfc8fbdc fix application_controller require_dependency path generated by the scaffold generator
This is follow up to #6643.
In #6643, the controller generator only had been fixed, in this commit to fix the scaffold generator.

(cherry picked from commit 2e8146909a)
2015-09-20 16:54:15 +01:00
Rafael Mendonça França e5ba382ccb Merge pull request #21402 from k0kubun/ruby20-url-helper
Fix mail_to to work well with Ruby 2.0
2015-08-28 02:42:58 -03:00
Rafael Mendonça França fbba4ad7c8 Fix Gemfile.lock 2015-08-27 23:47:15 -03:00
Rafael Mendonça França af68f1f4dd Merge branch '4-1-13' into 4-1-stable 2015-08-24 15:05:41 -03:00
Rafael Mendonça França 10ac0155b1 Preparing for 4.1.13 release 2015-08-24 14:57:52 -03:00