immunio 0.15.3 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d880d5388c94ed09e79a43988fed3d48e466d827
4
- data.tar.gz: fe7b3fd9a7dcd19547e3f50f97935d98da72cb5a
3
+ metadata.gz: f7e8d810e6100c0e9264d9c8527a9afd7a8cf024
4
+ data.tar.gz: e72b700204840a28c6c226b788c8bc2be6c4ce98
5
5
  SHA512:
6
- metadata.gz: 54d760cdd8b7a6aba0688d5150c88c2b2a282f04a1f2e8e811fa6ae00dded74f0620613fe4cf5777ec885662e3d2c902a44c2531286d837c96771c5e46d7f626
7
- data.tar.gz: 5f213d23612d15c9a577bab502f1f283365f459a61ec809df24777426a4b3db907a1404bde340fc9884e8ed59b5742a5d707ce39291d733100129b5d20bb82b7
6
+ metadata.gz: a5d26c3a038a7d761733a78aed1f0930b4aee57c4ea5b2468f0bd1b2d629a474231778c8eeba761f6e4d236d0762d242ac106f059885c8a40095ad4f3edc9cf3
7
+ data.tar.gz: ae779440e8c573cc90004e8ac39f3d92d2f93f0a7db72e8c751b9c68731e5bf2a736b56f107558ba6f40a3f46e4a380fb30786378b4d3cb1f2de6d39eb32f55d
@@ -89,7 +89,7 @@ module Immunio
89
89
  template_sha: template_sha,
90
90
  template_id: template_id.to_s,
91
91
  nonce: nonce,
92
- code: code,
92
+ code: wrap_code(code, escape: escape),
93
93
  file: file,
94
94
  line: line
95
95
  }
@@ -120,7 +120,7 @@ module Immunio
120
120
  else
121
121
  content = "" if content.nil?
122
122
  # See comment above
123
- if content =~ /\{immunio-var:\\d+:#{nonce}\}/ then
123
+ if content =~ /\{immunio-var:\d+:#{nonce}\}/ then
124
124
  # don't add markers.
125
125
  Immunio.logger.debug {"WARNING: ActionView not marking interpolation which already contains markers: \"#{content}\""}
126
126
  rval = content.html_safe
@@ -238,6 +238,17 @@ module Immunio
238
238
  Thread.current["immunio.rendering_stack"] ||= []
239
239
  end
240
240
 
241
+ def wrap_code(code, options = {})
242
+ case
243
+ when @template.handler.is_a?(ActionView::Template::Handlers::ERB)
244
+ modifier = options[:escape] ? '=' : '=='
245
+ "<%#{modifier} #{code} %>"
246
+ when defined?(Haml::Plugin) && @template.handler == Haml::Plugin
247
+ modifier = options[:escape] ? '=' : '!='
248
+ "#{modifier} #{code}"
249
+ end
250
+ end
251
+
241
252
  def rendering_stack
242
253
  self.class.rendering_stack
243
254
  end
@@ -46,7 +46,7 @@ module Immunio
46
46
 
47
47
  # Unwrap the innermost original exception.
48
48
  def unwrap_exception(e)
49
- while e.respond_to? :original_exception
49
+ while e.respond_to?(:original_exception) && e.original_exception.is_a?(Exception)
50
50
  e = e.original_exception
51
51
  end
52
52
  e
@@ -19,13 +19,25 @@ if defined?(Warden)
19
19
  info = {plugin: "warden"}
20
20
 
21
21
  # Devise uses these specific form fields for authentication by default
22
+ user_found = false
22
23
  [:username, :email].each do |attr|
23
24
  value = env.fetch("rack.request.form_hash", {}).fetch("user", {})[attr.to_s]
24
- info[attr] = value if value
25
+ if value
26
+ info[attr] = value
27
+ user_found = true
28
+ end
25
29
  end
26
30
 
27
- Immunio.logger.debug "Warden instrumentation fired for before_failure"
28
- Immunio.failed_login info
31
+ # before_failure is called under many circumstances, but unfortunately
32
+ # there's no easy way to tell why. If we can't figure out who the
33
+ # attempted user was, don't report it as a failed login.
34
+ if user_found
35
+ Immunio.logger.debug "Warden instrumentation fired for before_failure"
36
+ Immunio.failed_login info
37
+ else
38
+ Immunio.logger.debug "Failed to find user info for Warden failure, "\
39
+ "ignoring instead of reporting as failed login"
40
+ end
29
41
  end
30
42
  end
31
43
 
@@ -1,5 +1,5 @@
1
1
  module Immunio
2
2
  AGENT_TYPE = "agent-ruby"
3
- VERSION = "0.15.3"
3
+ VERSION = "0.15.4"
4
4
  VM_VERSION = "2.2.0"
5
5
  end
@@ -17,9 +17,15 @@ local ws = l.space^1
17
17
  -- This is broad to both accept our placeholders and be very liberal about what may be
18
18
  -- interpreted as an attribute to ensure we escape attributes fairly aggressively.
19
19
  local element_chars = (l.any - '<' - '>' - '=' - '"' - "'" - ws)^1
20
+
20
21
  -- Comments.
21
- local comment = token(l.COMMENT, '<!--' * (l.any - '-->')^0 * P('-->')^-1)
22
- -- XXX add h5 bogus comment 1 and bogus comment 2?
22
+ local comment = token(l.COMMENT, '<!--' * (l.any - '-->')^0 * P('-->'))
23
+
24
+ -- IE Conditional Comments.
25
+ local ie_condcomment_hidden_open = token(l.COMMENT, P('<!--[') * (l.any - ']>')^0 * P(']>'))
26
+ local ie_condcomment_hidden_close = token(l.COMMENT, P('<![') * (l.any - ']-->')^0 * P(']-->'))
27
+ local ie_condcomment_revealed = token(l.COMMENT, P('<![') * (l.any - '>')^0 * P('>'))
28
+ local condcomment = token('condcomment', ie_condcomment_hidden_open + ie_condcomment_hidden_close + ie_condcomment_revealed)
23
29
 
24
30
  -- Strings.
25
31
  local sq_str = l.delimited_range("'")
@@ -69,6 +75,7 @@ local doctype = token('doctype', '<!' *
69
75
  local data = token('data', (l.any - '<')^1)
70
76
 
71
77
  M._rules = {
78
+ {'condcomment', condcomment}, -- must preceed comment
72
79
  {'comment', comment},
73
80
  {'doctype', doctype},
74
81
  {'tag', tag},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: immunio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.3
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Immunio
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-28 00:00:00.000000000 Z
11
+ date: 2015-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -300,7 +300,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
300
300
  version: '0'
301
301
  requirements: []
302
302
  rubyforge_project:
303
- rubygems_version: 2.4.5.1
303
+ rubygems_version: 2.4.5
304
304
  signing_key:
305
305
  specification_version: 4
306
306
  summary: Immunio Ruby agent