Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
社会瑞弟呀
brakeman
提交
dcf13205
B
brakeman
项目概览
社会瑞弟呀
/
brakeman
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
brakeman
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
dcf13205
编写于
12月 06, 2012
作者:
J
Justin Collins
浏览文件
操作
浏览文件
下载
差异文件
Merge commit '
90e7b63c
' into reduce_sexps_created2
上级
b1f7ec59
90e7b63c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
7 deletion
+19
-7
lib/brakeman/processors/base_processor.rb
lib/brakeman/processors/base_processor.rb
+5
-2
lib/brakeman/processors/template_alias_processor.rb
lib/brakeman/processors/template_alias_processor.rb
+6
-2
lib/brakeman/util.rb
lib/brakeman/util.rb
+8
-3
未找到文件。
lib/brakeman/processors/base_processor.rb
浏览文件 @
dcf13205
...
...
@@ -6,17 +6,20 @@ class Brakeman::BaseProcessor < Brakeman::SexpProcessor
include
Brakeman
::
ProcessorHelper
include
Brakeman
::
Util
attr_reader
:ignore
IGNORE
=
Sexp
.
new
:ignore
#Return a new Processor.
def
initialize
tracker
super
()
@last
=
nil
@tracker
=
tracker
@ignore
=
Sexp
.
new
:ignore
@current_template
=
@current_module
=
@current_class
=
@current_method
=
nil
end
def
ignore
IGNORE
end
def
process_class
exp
current_class
=
@current_class
@current_class
=
class_name
exp
[
1
]
...
...
lib/brakeman/processors/template_alias_processor.rb
浏览文件 @
dcf13205
require
'set'
require
'brakeman/processors/alias_processor'
require
'brakeman/processors/lib/render_helper'
require
'brakeman/tracker'
#Processes aliasing in templates.
#Handles calls to +render+.
...
...
@@ -37,6 +38,9 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
name
end
UNKNOWN_MODEL_CALL
=
Sexp
.
new
(
:call
,
Sexp
.
new
(
:const
,
Brakeman
::
Tracker
::
UNKNOWN_MODEL
),
:new
)
FORM_BUILDER_CALL
=
Sexp
.
new
(
:call
,
Sexp
.
new
(
:const
,
:FormBuilder
),
:new
)
#Looks for form methods and iterating over collections of Models
def
process_call_with_block
exp
process_default
exp
...
...
@@ -55,14 +59,14 @@ class Brakeman::TemplateAliasProcessor < Brakeman::AliasProcessor
if
model
==
target
.
target
env
[
Sexp
.
new
(
:lvar
,
arg
)]
=
Sexp
.
new
(
:call
,
model
,
:new
)
else
env
[
Sexp
.
new
(
:lvar
,
arg
)]
=
Sexp
.
new
(
:call
,
Sexp
.
new
(
:const
,
Brakeman
::
Tracker
::
UNKNOWN_MODEL
),
:new
)
env
[
Sexp
.
new
(
:lvar
,
arg
)]
=
UNKNOWN_MODEL_CALL
end
process
block
if
sexp?
block
end
elsif
FORM_METHODS
.
include?
method
if
arg
.
is_a?
Symbol
env
[
Sexp
.
new
(
:lvar
,
arg
)]
=
Sexp
.
new
(
:call
,
Sexp
.
new
(
:const
,
:FormBuilder
),
:new
)
env
[
Sexp
.
new
(
:lvar
,
arg
)]
=
FORM_BUILDER_CALL
process
block
if
sexp?
block
end
...
...
lib/brakeman/util.rb
浏览文件 @
dcf13205
...
...
@@ -96,12 +96,17 @@ module Brakeman::Util
nil
end
#These are never modified
PARAMS_SEXP
=
Sexp
.
new
(
:params
)
SESSION_SEXP
=
Sexp
.
new
(
:session
)
COOKIES_SEXP
=
Sexp
.
new
(
:cookies
)
#Adds params, session, and cookies to environment
#so they can be replaced by their respective Sexps.
def
set_env_defaults
@env
[
PARAMETERS
]
=
Sexp
.
new
(
:params
)
@env
[
SESSION
]
=
S
exp
.
new
(
:session
)
@env
[
COOKIES
]
=
Sexp
.
new
(
:cookies
)
@env
[
PARAMETERS
]
=
PARAMS_SEXP
@env
[
SESSION
]
=
S
ESSION_SEXP
@env
[
COOKIES
]
=
COOKIES_SEXP
end
#Check if _exp_ represents a hash: s(:hash, {...})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录