Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
张重言
rails
提交
7c7a4273
R
rails
项目概览
张重言
/
rails
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rails
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7c7a4273
编写于
4月 02, 2013
作者:
T
Trevor Turk
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename DummyKeyGenerator -> LegacyKeyGenerator
上级
c9597985
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
18 addition
and
18 deletion
+18
-18
actionpack/lib/action_dispatch/middleware/cookies.rb
actionpack/lib/action_dispatch/middleware/cookies.rb
+1
-1
actionpack/test/controller/flash_test.rb
actionpack/test/controller/flash_test.rb
+2
-2
actionpack/test/controller/http_digest_authentication_test.rb
...onpack/test/controller/http_digest_authentication_test.rb
+2
-2
actionpack/test/dispatch/cookies_test.rb
actionpack/test/dispatch/cookies_test.rb
+6
-6
actionpack/test/dispatch/session/cookie_store_test.rb
actionpack/test/dispatch/session/cookie_store_test.rb
+2
-2
activesupport/lib/active_support/key_generator.rb
activesupport/lib/active_support/key_generator.rb
+1
-1
railties/lib/rails/application.rb
railties/lib/rails/application.rb
+2
-2
railties/test/application/middleware/remote_ip_test.rb
railties/test/application/middleware/remote_ip_test.rb
+2
-2
未找到文件。
actionpack/lib/action_dispatch/middleware/cookies.rb
浏览文件 @
7c7a4273
...
@@ -428,7 +428,7 @@ class EncryptedCookieJar #:nodoc:
...
@@ -428,7 +428,7 @@ class EncryptedCookieJar #:nodoc:
include
ChainedCookieJars
include
ChainedCookieJars
def
initialize
(
parent_jar
,
key_generator
,
options
=
{})
def
initialize
(
parent_jar
,
key_generator
,
options
=
{})
if
ActiveSupport
::
Dumm
yKeyGenerator
===
key_generator
if
ActiveSupport
::
Legac
yKeyGenerator
===
key_generator
raise
"You didn't set config.secret_key_base, which is required for this cookie jar. "
+
raise
"You didn't set config.secret_key_base, which is required for this cookie jar. "
+
"Read the upgrade documentation to learn more about this new config option."
"Read the upgrade documentation to learn more about this new config option."
end
end
...
...
actionpack/test/controller/flash_test.rb
浏览文件 @
7c7a4273
require
'abstract_unit'
require
'abstract_unit'
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
class
FlashTest
<
ActionController
::
TestCase
class
FlashTest
<
ActionController
::
TestCase
...
@@ -219,7 +219,7 @@ def test_redirect_to_with_adding_flash_types
...
@@ -219,7 +219,7 @@ def test_redirect_to_with_adding_flash_types
class
FlashIntegrationTest
<
ActionDispatch
::
IntegrationTest
class
FlashIntegrationTest
<
ActionDispatch
::
IntegrationTest
SessionKey
=
'_myapp_session'
SessionKey
=
'_myapp_session'
Generator
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
'b3c631c314c0bbca50c1b2843150fe33'
)
Generator
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
'b3c631c314c0bbca50c1b2843150fe33'
)
class
TestController
<
ActionController
::
Base
class
TestController
<
ActionController
::
Base
add_flash_types
:bar
add_flash_types
:bar
...
...
actionpack/test/controller/http_digest_authentication_test.rb
浏览文件 @
7c7a4273
require
'abstract_unit'
require
'abstract_unit'
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
class
HttpDigestAuthenticationTest
<
ActionController
::
TestCase
class
HttpDigestAuthenticationTest
<
ActionController
::
TestCase
...
@@ -43,7 +43,7 @@ def authenticate_with_request
...
@@ -43,7 +43,7 @@ def authenticate_with_request
setup
do
setup
do
# Used as secret in generating nonce to prevent tampering of timestamp
# Used as secret in generating nonce to prevent tampering of timestamp
@secret
=
"4fb45da9e4ab4ddeb7580d6a35503d99"
@secret
=
"4fb45da9e4ab4ddeb7580d6a35503d99"
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
@secret
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
@secret
)
end
end
teardown
do
teardown
do
...
...
actionpack/test/dispatch/cookies_test.rb
浏览文件 @
7c7a4273
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
$stderr
.
puts
"Skipping KeyGenerator test: broken OpenSSL install"
$stderr
.
puts
"Skipping KeyGenerator test: broken OpenSSL install"
else
else
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
require
'active_support/message_verifier'
require
'active_support/message_verifier'
...
@@ -413,29 +413,29 @@ def test_tampered_cookies
...
@@ -413,29 +413,29 @@ def test_tampered_cookies
def
test_raises_argument_error_if_missing_secret
def
test_raises_argument_error_if_missing_secret
assert_raise
(
ArgumentError
,
nil
.
inspect
)
{
assert_raise
(
ArgumentError
,
nil
.
inspect
)
{
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
nil
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
nil
)
get
:set_signed_cookie
get
:set_signed_cookie
}
}
assert_raise
(
ArgumentError
,
''
.
inspect
)
{
assert_raise
(
ArgumentError
,
''
.
inspect
)
{
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
""
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
""
)
get
:set_signed_cookie
get
:set_signed_cookie
}
}
end
end
def
test_raises_argument_error_if_secret_is_probably_insecure
def
test_raises_argument_error_if_secret_is_probably_insecure
assert_raise
(
ArgumentError
,
"password"
.
inspect
)
{
assert_raise
(
ArgumentError
,
"password"
.
inspect
)
{
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
"password"
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
"password"
)
get
:set_signed_cookie
get
:set_signed_cookie
}
}
assert_raise
(
ArgumentError
,
"secret"
.
inspect
)
{
assert_raise
(
ArgumentError
,
"secret"
.
inspect
)
{
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
"secret"
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
"secret"
)
get
:set_signed_cookie
get
:set_signed_cookie
}
}
assert_raise
(
ArgumentError
,
"12345678901234567890123456789"
.
inspect
)
{
assert_raise
(
ArgumentError
,
"12345678901234567890123456789"
.
inspect
)
{
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
"12345678901234567890123456789"
)
@request
.
env
[
"action_dispatch.key_generator"
]
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
"12345678901234567890123456789"
)
get
:set_signed_cookie
get
:set_signed_cookie
}
}
end
end
...
...
actionpack/test/dispatch/session/cookie_store_test.rb
浏览文件 @
7c7a4273
require
'abstract_unit'
require
'abstract_unit'
require
'stringio'
require
'stringio'
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
class
CookieStoreTest
<
ActionDispatch
::
IntegrationTest
class
CookieStoreTest
<
ActionDispatch
::
IntegrationTest
SessionKey
=
'_myapp_session'
SessionKey
=
'_myapp_session'
SessionSecret
=
'b3c631c314c0bbca50c1b2843150fe33'
SessionSecret
=
'b3c631c314c0bbca50c1b2843150fe33'
Generator
=
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
SessionSecret
)
Generator
=
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
SessionSecret
)
Verifier
=
ActiveSupport
::
MessageVerifier
.
new
(
SessionSecret
,
:digest
=>
'SHA1'
)
Verifier
=
ActiveSupport
::
MessageVerifier
.
new
(
SessionSecret
,
:digest
=>
'SHA1'
)
SignedBar
=
Verifier
.
generate
(
:foo
=>
"bar"
,
:session_id
=>
SecureRandom
.
hex
(
16
))
SignedBar
=
Verifier
.
generate
(
:foo
=>
"bar"
,
:session_id
=>
SecureRandom
.
hex
(
16
))
...
...
activesupport/lib/active_support/key_generator.rb
浏览文件 @
7c7a4273
...
@@ -39,7 +39,7 @@ def generate_key(salt, key_size=64)
...
@@ -39,7 +39,7 @@ def generate_key(salt, key_size=64)
end
end
end
end
class
Dumm
yKeyGenerator
# :nodoc:
class
Legac
yKeyGenerator
# :nodoc:
SECRET_MIN_LENGTH
=
30
# Characters
SECRET_MIN_LENGTH
=
30
# Characters
def
initialize
(
secret
)
def
initialize
(
secret
)
...
...
railties/lib/rails/application.rb
浏览文件 @
7c7a4273
require
'fileutils'
require
'fileutils'
require
'active_support/core_ext/object/blank'
require
'active_support/core_ext/object/blank'
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
require
'rails/engine'
require
'rails/engine'
...
@@ -112,7 +112,7 @@ def key_generator
...
@@ -112,7 +112,7 @@ def key_generator
key_generator
=
ActiveSupport
::
KeyGenerator
.
new
(
config
.
secret_key_base
,
iterations:
1000
)
key_generator
=
ActiveSupport
::
KeyGenerator
.
new
(
config
.
secret_key_base
,
iterations:
1000
)
ActiveSupport
::
CachingKeyGenerator
.
new
(
key_generator
)
ActiveSupport
::
CachingKeyGenerator
.
new
(
key_generator
)
else
else
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
config
.
secret_token
)
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
config
.
secret_token
)
end
end
end
end
end
end
...
...
railties/test/application/middleware/remote_ip_test.rb
浏览文件 @
7c7a4273
require
'isolation/abstract_unit'
require
'isolation/abstract_unit'
# FIXME remove
Dumm
yKeyGenerator and this require in 4.1
# FIXME remove
Legac
yKeyGenerator and this require in 4.1
require
'active_support/key_generator'
require
'active_support/key_generator'
module
ApplicationTests
module
ApplicationTests
...
@@ -10,7 +10,7 @@ def remote_ip(env = {})
...
@@ -10,7 +10,7 @@ def remote_ip(env = {})
remote_ip
=
nil
remote_ip
=
nil
env
=
Rack
::
MockRequest
.
env_for
(
"/"
).
merge
(
env
).
merge!
(
env
=
Rack
::
MockRequest
.
env_for
(
"/"
).
merge
(
env
).
merge!
(
'action_dispatch.show_exceptions'
=>
false
,
'action_dispatch.show_exceptions'
=>
false
,
'action_dispatch.key_generator'
=>
ActiveSupport
::
Dumm
yKeyGenerator
.
new
(
'b3c631c314c0bbca50c1b2843150fe33'
)
'action_dispatch.key_generator'
=>
ActiveSupport
::
Legac
yKeyGenerator
.
new
(
'b3c631c314c0bbca50c1b2843150fe33'
)
)
)
endpoint
=
Proc
.
new
do
|
e
|
endpoint
=
Proc
.
new
do
|
e
|
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录