Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.0.x #8

Open
wants to merge 55 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
133111d
[merb_datamapper]Removed a temp monkey patch to fix an issue with DM:…
mattetti Feb 10, 2009
fa06c14
Poll for memory every 30 seconds instead of every 1/4 second
wycats Mar 18, 2009
0af606e
Update merb_datamapper to use DataMapper.repository instead of Kernel…
wycats Mar 18, 2009
476d30b
Bump version
wycats Mar 18, 2009
a690ec0
Yikes! Variable name fail
wycats Mar 23, 2009
ca8ccfb
bumped DM version to 0.9.11
mattetti Mar 30, 2009
fa9c894
Fix Local IP Address regexp
pusewicz Mar 25, 2009
09efad0
improved route generation support for couchdb ORMs using hash objects.
mattetti Mar 24, 2009
1b9f210
another quick fix to support Model objects being Hashes. (couchdb for…
mattetti Mar 24, 2009
621d082
removed obsolete private spec
mattetti Mar 31, 2009
2f52938
fixed the specs to match the latest version of webrat
mattetti Mar 31, 2009
8300b86
Patch security vulnerability in json_pure 1.1.6.
Jun 30, 2009
a6bead6
Bump version to 1.0.12 for release
Jun 30, 2009
e01eac0
populate toplevel LICENSE file with MIT License
Aug 21, 2009
b2e2bbb
[merb-core] bumped Merb::DO_VERSION and Merb::DM_VERSION to 0.10.0
snusnu Sep 9, 2009
6db47aa
[merb_datamapper] updated dependencies
snusnu Sep 9, 2009
8af779c
[merb_datamapper] fixed rake db:automigrate
snusnu Sep 9, 2009
1503d93
[merb_datamapper] fixed deprecation warnings
snusnu Sep 9, 2009
3db4e32
[merb_datamapper] fixed typo in rake task debug message
snusnu Sep 9, 2009
cefee4a
[merb_datamapper] define lazy properties after models were loaded
snusnu Sep 9, 2009
f2eed0b
[merb_datamapper] fixed session configuration.
protocarl Sep 9, 2009
13db054
[merb-core] fixed overwriting of config options on rake tasks [#1270]
ojak Sep 9, 2009
ccb4235
[merb_datamapper] Fixed raketasks for migrations
snusnu Sep 18, 2009
bb5b992
[merb_datamapper] Perform IM wrapping at the rack level
snusnu Sep 24, 2009
aa6b2fc
[merb] Fixed failing rake install due to missing merb-more
snusnu Sep 23, 2009
6478336
[merb-helpers] Generate valid html id attributes
snusnu Sep 25, 2009
26835c8
[merb-core] Fix run_later to work on servers other than just 'merb'
FooBarWidget Feb 16, 2009
45116f1
[merb-auth-more] Original :length constraints for dm_salted_user
snusnu Sep 27, 2009
d42a369
[merb-gen] Don't add resource route when using -p or -d
snusnu Sep 29, 2009
214543f
[merb_datamapper] Depend on the '~> 0.10' series
snusnu Oct 1, 2009
75eb0fc
[merb-core] Fixed multipart specs (including spec10)
merbjedi Oct 1, 2009
a45c4a8
[merb-assets] Don't rely on hash ordering in specs
snusnu Oct 1, 2009
b575998
[merb_datamapper] Depend on Merb::DM_VERSION
snusnu Oct 1, 2009
6eefe62
[merb_datamapper] Don't use gem method if not necessary
snusnu Oct 1, 2009
b8eb936
[merb-gen] config/dependencies.rb requires "~> #{DM_VERSION}" in stac…
snusnu Oct 2, 2009
633e859
Changed plugin dependencies to "~> #{Merb::VERSION}"
snusnu Oct 2, 2009
960192b
Install the merb meta-package as the last one
snusnu Oct 2, 2009
d41ee6a
Fixed rake uninstall to uninstall everything that got rake install'ed
snusnu Oct 2, 2009
f9b723c
[merb-cache] Not using Time.today in specs makes them more robust
snusnu Oct 2, 2009
161a626
Bumped version in preparation for release
snusnu Oct 2, 2009
35404ab
[merb-helpers] Avoid dm-0.10 deprecation warnings
snusnu Oct 2, 2009
c6642b7
[merb-core] Fixed docs for replacing an existing logger
snusnu Oct 20, 2009
8dd17dd
[merb-core] Allow testing without webrat
merbjedi Oct 17, 2009
260c696
[merb-core] Fixed focs for Merb::Router::Behavior#to
snusnu Oct 21, 2009
9c44e16
[merb-auth-slice-password] Use proper config value
snusnu Oct 21, 2009
7d730e7
[merb_datamapper] Print merb-gen message only for dm models
merbjedi Oct 1, 2009
cb5c783
[merb-haml] Fixed compilation of sass files
snusnu Oct 22, 2009
7e30838
Fix potential timing attack on cookie sessions
namelessjon Oct 22, 2009
df8ebd4
[merb-gen] Fixing generated thor task to work with RubyGems 1.3.5.
merbjedi Oct 23, 2009
2990598
[merb-gen] Explain how to load dependencies in (very) flat apps
pk Oct 23, 2009
8d84d2a
[merb-core] -i and --irb-console take precedence over config in init.rb.
pk Oct 23, 2009
7d9a669
[merb-core] Fixed link to extlib in error message
snusnu Oct 26, 2009
db4357f
[merb-gen] Add default rspec options to spec.opts file
snusnu Oct 26, 2009
b26df5a
[merb-helpers] Select the correct field in select tags
teamon Oct 26, 2009
aa09e3a
Updated CHANGELOG
snusnu Oct 1, 2009
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,64 @@
== 1.0.13 "The weekend has landed" 2009-10-30

* [merb_datamapper] Support for dm-0.10.x (identity map wrapping is now perforemd at the rack level)
* [merb-core] Fix run_later to work on servers other than just 'merb' (Thin or Phusion Passenger for example)
* [merb-gen] Don't add resource route to config/routes.rb when using -p or -d with merb-gen resource
* [merb-gen] Explain how to load dependencies in (very) flat apps
* [merb] Fixed failing rake install due to missing merb-more
* [merb] rake uninstall now uninstalls everything that got rake install'ed
* [merb-core] Allow testing without webrat
* [merb-haml] Fixed compilation of sass files
* [merb-helpers] Select the correct field in bound select tags

* [merb-core] -i and --irb-console take precedence over config in init.rb.

This change allows you to have default adapter set
in the init.rb and still if you want to run Merb in
IRB you can do it. Currently you can't because setting
adapter in init.rb override the config value from ARGV
parsing.

* [merb-helpers] Generate valid html id attributes

This patch changes any occurrence of '[' or ']' in id attributes to '_'.
The brackets are not valid characters in an HTML id attribute value.

* [merb-core] Fix potential timing attack on cookie sessions

This patch fixes a potential timing attack on the HMAC authentication
used to verify cookie session contents by ensuring a constant time
algorithm is used to compare the hashes. For more information see:

http://codahale.com/a-lesson-in-timing-attacks/

* [merb-auth-slice-password] Use proper config value

Without this change, the default password strategy
is always activated because the wrong config key is
used.

* [merb-gen] Fixing generated thor task to work with RubyGems 1.3.5.

Setting thor dependency to "~> 0.9.9", as newer versions will break
the default merb-gen app bundling tasks

* [merb-core] Fixed multipart specs (including spec10)

The previous version of the spec was wrong in expecting that

file_params[:tempfile].should be_a_kind_of(File)

This spec only passed because of a now resolved bug in older versions of rspec.
The correct spec for the tempfile param now reads:

file_params[:tempfile].should be_a_kind_of(Tempfile)

* To run merb's specsuite (rake spec or rake specs:oneoh) you will either need webrat-0.3.1 or webrat-0.4.0
installed. webrat-0.4 is recommended for use in your app's specs, using newer versions of webrat may be
possible but is not explicitly supported.

* Minor docfixes

== 1.0.1
* generate unique session_id_key with new apps

Expand Down
20 changes: 20 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) 2008 Engine Yard

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
15 changes: 10 additions & 5 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ merb_release = {
"merb-mailer",
"merb-param-protection",
"merb_datamapper",
"merb",
"merb-more"
"merb"
]
}

merb_gem_paths = %w[merb merb-core merb_datamapper] + merb_more_gem_paths
merb_gem_paths = %w[merb-core merb_datamapper] + merb_more_gem_paths + %w[merb]

merb_gems = merb_gem_paths.map { |p| File.basename(p) }
merb_more_gems = merb_more_gem_paths.map { |p| File.basename(p) }
Expand Down Expand Up @@ -115,11 +114,17 @@ task :install do
merb_gems.each do |gem|
Merb::RakeHelper.install(gem, :version => Merb::VERSION)
end
puts %x{sudo gem install pkg/merb-more-#{Merb::VERSION}.gem}
end

desc "Uninstall all gems"
task :uninstall => ['uninstall:core', 'uninstall:more']
task :uninstall do
merb_gems.each do |gem|
Merb::RakeHelper.uninstall(gem, :version => Merb::VERSION)
end
Merb::RakeHelper.uninstall('merb-auth-slice-password', :version => Merb::VERSION)
Merb::RakeHelper.uninstall('merb-auth-more', :version => Merb::VERSION)
Merb::RakeHelper.uninstall('merb-auth-core', :version => Merb::VERSION)
end

desc "Build the merb-more gems"
task :build_gems do
Expand Down
2 changes: 1 addition & 1 deletion merb-action-args/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec = Gem::Specification.new do |s|
s.author = AUTHOR
s.email = EMAIL
s.homepage = PROJECT_URL
s.add_dependency('merb-core', ">= #{Merb::VERSION}")
s.add_dependency('merb-core', "~> #{Merb::VERSION}")
s.add_dependency('ruby2ruby', '>= 1.1.9')
s.add_dependency('ParseTree', '>= 2.1.1')
s.require_path = 'lib'
Expand Down
2 changes: 1 addition & 1 deletion merb-assets/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec = Gem::Specification.new do |s|
s.author = GEM_AUTHOR
s.email = GEM_EMAIL
s.homepage = PROJECT_URL
s.add_dependency('merb-core', ">= #{Merb::VERSION}")
s.add_dependency('merb-core', "~> #{Merb::VERSION}")
s.require_path = 'lib'
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
end
Expand Down
4 changes: 2 additions & 2 deletions merb-assets/spec/merb-assets_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
end

it "should convert objects that respond to to_json to json" do
js({'user' => 'Lewis', 'page' => 'home'}).should ==
"{\"user\":\"Lewis\",\"page\":\"home\"}"
expected = {'user' => 'Lewis', 'page' => 'home'}
JSON.parse(js(expected)).should == expected
end

it "should convert objects using inspect that don't respond to_json to json" do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module DMClassMethods
def self.extended(base)
base.class_eval do

property :crypted_password, String
property :salt, String
property :crypted_password, String, :length => 60
property :salt, String

validates_present :password, :if => proc{|m| m.password_required?}
validates_is_confirmed :password, :if => proc{|m| m.password_required?}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def self.loaded
# Initialization hook - runs before AfterAppLoads BootLoader
def self.init
require 'merb-auth-more/mixins/redirect_back'
unless MerbAuthSlicePassword[:no_default_strategies]
unless ::Merb::Slices::config[:"merb-auth-slice-password"][:no_default_strategies]
::Merb::Authentication.activate!(:default_password_form)
end
end
Expand Down
2 changes: 1 addition & 1 deletion merb-cache/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec = Gem::Specification.new do |s|
s.author = GEM_AUTHOR
s.email = GEM_EMAIL
s.homepage = PROJECT_URL
s.add_dependency('merb-core', ">= #{Merb::VERSION}")
s.add_dependency('merb-core', "~> #{Merb::VERSION}")
s.require_path = 'lib'
s.files = %w(LICENSE README Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def ticker
end

it "should cache the stats action by team, start_date & end_date parameters" do
start_date, end_date = Time.today.to_s, Time.now.to_s
start_date, end_date = (Time.now - 60).to_s, Time.now.to_s
dispatch_to(MLBScores, :stats, :start_date => start_date, :end_date => end_date)

@dummy.data("MLBScores#stats", :team => :all, :start_date => start_date, :end_date => end_date).should == "MLBScores stats(all, #{start_date}, #{end_date})"
Expand Down
4 changes: 2 additions & 2 deletions merb-core/Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ spec = Gem::Specification.new do |s|
s.add_dependency "rspec"
s.add_dependency "rack"
s.add_dependency "mime-types"
s.add_dependency "thor", ">= 0.9.9"
s.add_dependency "thor", "~> 0.9.9"
# this escalates to "regular" dependencies, comment it out
# for now. RubyGems need some love.
#s.add_development_dependency "libxml-ruby"
Expand Down Expand Up @@ -352,7 +352,7 @@ def contributors(since_release = nil)
git_log(since_release).split("\n").uniq.sort
end

PREVIOUS_RELEASE = '0.9.9'
PREVIOUS_RELEASE = '0.9.10'
namespace :history do
namespace :update do
desc "updates contributors list"
Expand Down
8 changes: 8 additions & 0 deletions merb-core/lib/merb-core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ def start(argv = ARGV)
Merb::Config.parse_args(argv)
end

# Keep information that we run inside IRB to guard it against overriding in init.rb
@running_irb = Merb::Config[:adapter] == 'irb'

Merb::Config[:log_stream] = STDOUT

Merb.environment = Merb::Config[:environment]
Expand Down Expand Up @@ -786,6 +789,11 @@ def on_windows?
def run_later(&blk)
Merb::Dispatcher.work_queue << blk
end

# :api: private
def running_irb?
@running_irb
end
end
end

Expand Down
16 changes: 16 additions & 0 deletions merb-core/lib/merb-core/bootloader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def self.enable_json_gem
rescue LoadError
gem "json_pure"
require "json/pure"
require "merb-core/core_ext/json_pure_fix"
end

# Resets the logger and sets the log_stream to Merb::Config[:log_file]
Expand Down Expand Up @@ -1268,6 +1269,8 @@ class Merb::BootLoader::ChooseAdapter < Merb::BootLoader
#
# :api: plugin
def self.run
# Check if we running in IRB if so run IRB adapter
Merb::Config[:adapter] = 'irb' if Merb.running_irb?
Merb.adapter = Merb::Rack::Adapter.get(Merb::Config[:adapter])
end
end
Expand Down Expand Up @@ -1306,6 +1309,19 @@ def self.run
end
end

class Merb::BootLoader::BackgroundServices < Merb::BootLoader
# Start background services, such as the run_later worker thread.
#
# ==== Returns
# nil
#
# :api: plugin
def self.run
Merb::Worker.start unless Merb.testing? || Merb::Worker.started?
nil
end
end

class Merb::BootLoader::ReloadClasses < Merb::BootLoader

class TimedExecutor
Expand Down
4 changes: 4 additions & 0 deletions merb-core/lib/merb-core/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,10 @@ def to_yaml
#
# :api: private
def setup(settings = {})
# Merge new settings with any existing configuration settings
settings = @configuration.merge(settings) unless @configuration.nil?

# Merge new settings with default settings
config = defaults.merge(settings)

unless config[:reload_classes]
Expand Down
2 changes: 1 addition & 1 deletion merb-core/lib/merb-core/constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module Const
JSON_MIME_TYPE_REGEXP = %r{^application/json|^text/x-json}.freeze
XML_MIME_TYPE_REGEXP = %r{^application/xml|^text/xml}.freeze
FORM_URL_ENCODED_REGEXP = %r{^application/x-www-form-urlencoded}.freeze
LOCAL_IP_REGEXP = /^unknown$|^(127|10|172\.16|192\.168)\./i.freeze
LOCAL_IP_REGEXP = /^unknown$|^(127|10|172\.16|192\.168)\.|^(172\.(1[6-9]|2[0-9]|3[0-1]))\.|^(169\.254)\./i.freeze
XML_HTTP_REQUEST_REGEXP = /XMLHttpRequest/i.freeze
UPCASE_CONTENT_TYPE = 'CONTENT_TYPE'.freeze
CONTENT_TYPE = "Content-Type".freeze
Expand Down
2 changes: 1 addition & 1 deletion merb-core/lib/merb-core/core_ext.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
begin
require "extlib"
rescue LoadError => e
puts "Merb-core 0.9.4 and later uses extlib for Ruby core class extensions. Install it from github.com/sam/extlib."
puts "Merb-core 0.9.4 and later uses extlib for Ruby core class extensions. Install it from github.com/datamapper/extlib."
exit
end

Expand Down
14 changes: 14 additions & 0 deletions merb-core/lib/merb-core/core_ext/json_pure_fix.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
if defined?(JSON::Pure::Parser::STRING)
class JSON::Pure::Parser
if JSON::Pure::Parser::STRING.source.include?('\\[\x20-\xff]')
remove_const(:STRING)
STRING = /" ((?:[^\x0-\x1f"\\] |
\\["\\\/bfnrt] |
\\u[0-9a-fA-F]{4} |
\\[\x20-\x21\x23-\x2e\x30-\x5b\x5d-\x61\x63-\x65\x67-\x6d\x6f-\x71\x73\x75-\xff])*)
"/nx
warn("You are running an outdated an vulnerable version of JSON::Pure. Merb has fixed the vulnerability, but " \
"you should upgrade to the latest version of JSON::Pure or use the json gem")
end
end
end
2 changes: 1 addition & 1 deletion merb-core/lib/merb-core/core_ext/kernel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ def __profile__(name, min=1, iter=100)
#
# :api: public
def extract_options_from_args!(args)
args.pop if Hash === args.last
args.pop if (args.last.instance_of?(Hash) || args.last.instance_of?(Mash))
end

# Checks that the given objects quack like the given conditions.
Expand Down
2 changes: 1 addition & 1 deletion merb-core/lib/merb-core/dispatch/router/behavior.rb
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ def match(path = {}, conditions = {}, &block)
# r<Behavior>:: +optional+ - The to behavior object.
#
# ==== Returns
# Route:: It registers a new route and returns it.
# Behavior:: The route definition behavior defining the created route
#
# ==== Examples
# match('/:controller/:id).to(:action => 'show')
Expand Down
2 changes: 1 addition & 1 deletion merb-core/lib/merb-core/dispatch/router/route.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ def identify(obj, param_key = nil)
def identifier_for(obj)
return if obj.is_a?(String) || obj.is_a?(Symbol) || obj.is_a?(Numeric) ||
obj.is_a?(TrueClass) || obj.is_a?(FalseClass) || obj.is_a?(NilClass) ||
obj.is_a?(Array) || obj.is_a?(Hash)
obj.is_a?(Array) || obj.instance_of?(Hash)

@identifiers.each do |klass, identifier|
return identifier if obj.is_a?(klass)
Expand Down
32 changes: 31 additions & 1 deletion merb-core/lib/merb-core/dispatch/session/cookie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,36 @@ def to_cookie
def generate_digest(data)
OpenSSL::HMAC.hexdigest(DIGEST, @secret, data)
end

# Securely compare two digests using a constant time algorithm.
# This avoids leaking information about the calculated HMAC
#
# Based on code by Michael Koziarski <[email protected]>
# http://github.com/rails/rails/commit/674f780d59a5a7ec0301755d43a7b277a3ad2978
#
# ==== Parameters
# a, b<~to_s>:: digests to compare.
#
# ==== Returns
# Boolean:: Do the digests validate?
def secure_compare(a, b)
if a.length == b.length

# unpack to forty characters.
# needed for 1.8 and 1.9 compat
a_bytes = a.unpack('C*')
b_bytes = b.unpack('C*')

result = 0
for i in 0..(a_bytes.length - 1)
result |= a_bytes[i] ^ b_bytes[i]
end
result == 0
else
false
end
end


# Unmarshal cookie data to a hash and verify its integrity.
#
Expand All @@ -167,7 +197,7 @@ def unmarshal(cookie)
else
data, digest = Merb::Parse.unescape(cookie).split('--')
return {} if data.blank? || digest.blank?
unless digest == generate_digest(data)
unless secure_compare(generate_digest(data), digest)
clear
unless Merb::Config[:ignore_tampered_cookies]
raise TamperedWithCookie, "Maybe the site's session_secret_key has changed?"
Expand Down
8 changes: 8 additions & 0 deletions merb-core/lib/merb-core/dispatch/worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ def start
end
@worker
end

# ==== Returns
# Whether the Merb::Worker instance is already started.
#
# :api: private
def started?
[email protected]?
end
end

# Creates a new worker thread that loops over the work queue.
Expand Down
Loading