aikido-zen 1.0.1.beta.3 → 1.0.1.beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/aikido/zen/rails_engine.rb +1 -15
- data/lib/aikido/zen/version.rb +1 -1
- data/lib/aikido/zen.rb +26 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 77f21724c518120f8babf2de99cb851ca3883c7f30486c55f85b2e50fccda388
|
4
|
+
data.tar.gz: 60991be90b49872e9d31d3c84c5482a9e57191964bfc890478c876a89b18d848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8537a8ca813cd0480141b47976bed6a0577ef5c06ed07db0dcfa59c77cd2061954ffad805ea8daad3e2549cb73558f06e6d34a67f3ebec024ddc40b18958fc5c
|
7
|
+
data.tar.gz: d6f99986334e8435118e1516ae93152bf2f6f6f2a96e306c3649016eb878e1454885ef45fecf04875b57c3d6b89f6e73e7063db02780fe126c92f8a02f9b5a7f
|
@@ -10,8 +10,6 @@ module Aikido::Zen
|
|
10
10
|
end
|
11
11
|
|
12
12
|
initializer "aikido.add_middleware" do |app|
|
13
|
-
next unless config.zen.protect?
|
14
|
-
|
15
13
|
app.middleware.use Aikido::Zen::Middleware::SetContext
|
16
14
|
app.middleware.use Aikido::Zen::Middleware::CheckAllowedAddresses
|
17
15
|
# Request Tracker stats do not consider failed request or 40x, so the middleware
|
@@ -51,20 +49,8 @@ module Aikido::Zen
|
|
51
49
|
end
|
52
50
|
|
53
51
|
config.after_initialize do
|
54
|
-
|
55
|
-
|
56
|
-
# Make sure this is run at the end of the initialization process, so
|
57
|
-
# that any gems required after aikido-zen are detected and patched
|
58
|
-
# accordingly.
|
59
|
-
Aikido::Zen.load_sinks!
|
60
|
-
|
61
|
-
# It's important we start after loading sinks, so we can report the installed packages
|
52
|
+
# Start the Aikido Agent only once the application starts.
|
62
53
|
Aikido::Zen.start!
|
63
|
-
|
64
|
-
# Agent's bootstrap process has finished —Controllers are patched to block
|
65
|
-
# unwanted requests, sinks are loaded, scanners are running—, so we mark
|
66
|
-
# the agent as installed.
|
67
|
-
Aikido::Zen.middleware_installed!
|
68
54
|
end
|
69
55
|
end
|
70
56
|
end
|
data/lib/aikido/zen/version.rb
CHANGED
data/lib/aikido/zen.rb
CHANGED
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
# IMPORTANT: Any files that load sinks or start the Aikido Agent should
|
4
|
-
# be required in `Aikido::Zen.protect!`.
|
5
|
-
|
6
3
|
require_relative "zen/version"
|
7
4
|
require_relative "zen/errors"
|
8
5
|
require_relative "zen/actor"
|
@@ -29,6 +26,9 @@ module Aikido
|
|
29
26
|
# Enable protection. Until this method is called no sinks are loaded
|
30
27
|
# and the Aikido Agent does not start.
|
31
28
|
#
|
29
|
+
# This method should be called only once, in the application after the
|
30
|
+
# initialization process is complete.
|
31
|
+
#
|
32
32
|
# @return [void]
|
33
33
|
def self.protect!
|
34
34
|
if config.disabled?
|
@@ -36,16 +36,14 @@ module Aikido
|
|
36
36
|
return
|
37
37
|
end
|
38
38
|
|
39
|
-
|
40
|
-
# should be required here only.
|
39
|
+
return unless config.protect?
|
41
40
|
|
42
|
-
|
43
|
-
|
41
|
+
unless load_sources! && load_sinks!
|
42
|
+
config.logger.warn "Zen could not find any supported libraries or frameworks. Visit https://github.com/AikidoSec/firewall-ruby for more information."
|
43
|
+
return
|
44
44
|
end
|
45
45
|
|
46
|
-
|
47
|
-
warn "Zen could not find any supported libraries or frameworks. Visit https://github.com/AikidoSec/firewall-ruby for more information."
|
48
|
-
end
|
46
|
+
middleware_installed!
|
49
47
|
end
|
50
48
|
|
51
49
|
# @!visibility private
|
@@ -173,15 +171,28 @@ module Aikido
|
|
173
171
|
collector.middleware_installed!
|
174
172
|
end
|
175
173
|
|
176
|
-
#
|
177
|
-
#
|
178
|
-
# at the end of the initialization process).
|
174
|
+
# @!visibility private
|
175
|
+
# Load all sources.
|
179
176
|
#
|
180
|
-
#
|
177
|
+
# @return [Boolean] true if any sources were loaded
|
178
|
+
def self.load_sources!
|
179
|
+
if Aikido::Zen.satisfy("rails", ">= 7.0")
|
180
|
+
require_relative "zen/rails_engine"
|
181
|
+
|
182
|
+
return true
|
183
|
+
end
|
184
|
+
|
185
|
+
false
|
186
|
+
end
|
187
|
+
|
188
|
+
# @!visibility private
|
189
|
+
# Load all sinks.
|
181
190
|
#
|
182
|
-
# @return [
|
191
|
+
# @return [Boolean] true if any sinks were loaded
|
183
192
|
def self.load_sinks!
|
184
193
|
require_relative "zen/sinks"
|
194
|
+
|
195
|
+
!Aikido::Zen::Sinks.registry.empty?
|
185
196
|
end
|
186
197
|
|
187
198
|
# @!visibility private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aikido-zen
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.1.beta.
|
4
|
+
version: 1.0.1.beta.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aikido Security
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-08-
|
11
|
+
date: 2025-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|