immunio 1.0.14 → 1.0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/immunio/agent.rb +15 -8
- data/lib/immunio/plugins/action_view.rb +23 -0
- data/lib/immunio/version.rb +1 -1
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df076162b48fc75f6e04a46db9118579b1107e53
|
4
|
+
data.tar.gz: 64d31948b83cae4e3c3c847224a24c9520a51b27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4264cc06b7cce23856abda0680db53a5cfe7a2fcb39e175e0e58884a869ed0e0253f16aff6be6cdf3330c45671c25af03649f2a6fcb2bc189a328347b7b7701f
|
7
|
+
data.tar.gz: 343a25d95f60caa65993f3397d08f06a7e43a67b0994367b9355f9b62a0b7025e46a57c3c33921f3aefafa5a587ff91939bb3eafb0f9d743454e0b950299a101
|
data/lib/immunio/agent.rb
CHANGED
@@ -4,8 +4,6 @@ require "yaml"
|
|
4
4
|
require_relative "channel"
|
5
5
|
require_relative "processor"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
7
|
module Immunio
|
10
8
|
@agent = nil
|
11
9
|
|
@@ -156,16 +154,14 @@ module Immunio
|
|
156
154
|
locations << File.join("config", CONFIG_FILENAME)
|
157
155
|
|
158
156
|
locations.each do |location|
|
159
|
-
Immunio.logger.debug { "Trying to find config file at #{location}" }
|
160
157
|
begin
|
161
|
-
|
162
|
-
Immunio.logger.debug { "Found config file at #{realpath}" }
|
163
|
-
options = YAML.load_file(realpath).symbolize_keys
|
164
|
-
config.update options
|
158
|
+
config.update load_config_at_location(location)
|
165
159
|
Immunio.logger.debug { "Configuration after loading from file: #{config}" }
|
166
160
|
break
|
167
161
|
rescue SystemCallError => e
|
168
|
-
Immunio.logger.
|
162
|
+
Immunio.logger.error { "Failed to open config: #{e}" }
|
163
|
+
rescue => e
|
164
|
+
Immunio.logger.error { "Bad immunio configuration file: #{e.inspect}" }
|
169
165
|
end
|
170
166
|
end
|
171
167
|
|
@@ -197,7 +193,18 @@ module Immunio
|
|
197
193
|
config.plugins_active.subtract(config.plugins_disabled)
|
198
194
|
config.plugins_active.merge(config.plugins_enabled)
|
199
195
|
Immunio.logger.info { "Active plugins: #{config.plugins_active.to_a}" }
|
196
|
+
end
|
200
197
|
|
198
|
+
# Loads the configuration file.
|
199
|
+
# Raises:
|
200
|
+
# - Errno::ENOENT if it doesn't exist;
|
201
|
+
# - NoMethodError if the config is invalid, `YAML.load_file` will return
|
202
|
+
# a `String`, and `symbolize_keys` will be called on it.
|
203
|
+
def load_config_at_location(location)
|
204
|
+
Immunio.logger.debug { "Trying to find config file at #{location}" }
|
205
|
+
realpath = File.realpath(location) # Raises exception if file doesn't exist
|
206
|
+
Immunio.logger.debug { "Found config file at #{realpath}" }
|
207
|
+
YAML.load_file(realpath).symbolize_keys
|
201
208
|
end
|
202
209
|
|
203
210
|
def plugin_enabled?(plugin)
|
@@ -506,6 +506,27 @@ module Immunio
|
|
506
506
|
content
|
507
507
|
end
|
508
508
|
end
|
509
|
+
|
510
|
+
# Hook for the `ActiveSupport::Hash#to_query`.
|
511
|
+
# Use case: building a url within a decorator that renders a partial with an interpolation.
|
512
|
+
module ActiveSupportHooks
|
513
|
+
extend ActiveSupport::Concern
|
514
|
+
|
515
|
+
included do
|
516
|
+
Immunio::Utils.alias_method_chain self, :to_query, :immunio
|
517
|
+
end
|
518
|
+
|
519
|
+
def to_query_with_immunio(namespace = nil)
|
520
|
+
escaped_string = to_query_without_immunio(namespace)
|
521
|
+
Request.time "plugin", "#{Module.nesting[0]}::#{__method__}" do
|
522
|
+
# Our markers got escaped, so un-unescaped them back.
|
523
|
+
escaped_string.gsub!(
|
524
|
+
Immunio::Template::ENCODED_IMMUNIO_TOKENS_RE,
|
525
|
+
"{immunio-\\1:\\2:\\3}\\4{/immunio-\\1:\\2:\\3}")
|
526
|
+
end
|
527
|
+
escaped_string
|
528
|
+
end
|
529
|
+
end
|
509
530
|
end
|
510
531
|
|
511
532
|
# Add XSS hooks if enabled
|
@@ -518,6 +539,8 @@ if Immunio::agent.plugin_enabled?("xss") then
|
|
518
539
|
if defined? Haml::Compiler
|
519
540
|
Haml::Compiler.send :include, Immunio::HamlHooks
|
520
541
|
end
|
542
|
+
|
543
|
+
Hash.send :include, Immunio::ActiveSupportHooks
|
521
544
|
end
|
522
545
|
|
523
546
|
# Hook into rendering process of Rails.
|
data/lib/immunio/version.rb
CHANGED
metadata
CHANGED
@@ -1,41 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immunio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Immunio
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: thor
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 0.14.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 0.14.6
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,56 +56,56 @@ dependencies:
|
|
56
56
|
name: msgpack
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.5'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.5'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faraday
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - ~>
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.8'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - ~>
|
80
|
+
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.8'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday_middleware
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ~>
|
87
|
+
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.9'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - ~>
|
94
|
+
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.9'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: binding_of_caller
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - ~>
|
101
|
+
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.7'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - ~>
|
108
|
+
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.7'
|
111
111
|
description: |
|
@@ -124,6 +124,9 @@ extensions:
|
|
124
124
|
- ext/immunio/Rakefile
|
125
125
|
extra_rdoc_files: []
|
126
126
|
files:
|
127
|
+
- LICENSE
|
128
|
+
- README.md
|
129
|
+
- bin/immunio
|
127
130
|
- ext/immunio/Rakefile
|
128
131
|
- lib/immunio.rb
|
129
132
|
- lib/immunio/agent.rb
|
@@ -420,10 +423,7 @@ files:
|
|
420
423
|
- lua-hooks/ext/sha1/sha1.c
|
421
424
|
- lua-hooks/ext/sha2/luasha256.c
|
422
425
|
- lua-hooks/ext/sha2/sha256.c
|
423
|
-
- README.md
|
424
|
-
- LICENSE
|
425
426
|
- lua-hooks/lib/boot.lua
|
426
|
-
- bin/immunio
|
427
427
|
homepage: http://immun.io/
|
428
428
|
licenses:
|
429
429
|
- Immunio
|
@@ -435,17 +435,17 @@ require_paths:
|
|
435
435
|
- lib
|
436
436
|
required_ruby_version: !ruby/object:Gem::Requirement
|
437
437
|
requirements:
|
438
|
-
- -
|
438
|
+
- - ">="
|
439
439
|
- !ruby/object:Gem::Version
|
440
440
|
version: 1.9.3
|
441
441
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
442
442
|
requirements:
|
443
|
-
- -
|
443
|
+
- - ">="
|
444
444
|
- !ruby/object:Gem::Version
|
445
445
|
version: '0'
|
446
446
|
requirements: []
|
447
447
|
rubyforge_project:
|
448
|
-
rubygems_version: 2.
|
448
|
+
rubygems_version: 2.4.5
|
449
449
|
signing_key:
|
450
450
|
specification_version: 4
|
451
451
|
summary: Immunio Ruby agent
|