aikido-zen 1.0.2.beta.1-x86_64-mingw-64 → 1.0.2.beta.5-x86_64-mingw-64

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 87a850ae8220f054a061b224178e250c7f8e8c734f8c3a4451a62f7ebf464377
4
- data.tar.gz: c3801386633cec931748c69ba7f66ad219e21329c59ce7486585cc324a8b7125
3
+ metadata.gz: 4052b91cc3b58179ae6d97ba79f9fa8577ebf0302b79371029194a04bf63b0a2
4
+ data.tar.gz: 70dcefe99d1eacf6fc855b4cb4e0d9a9d437d6c2939fa16f33c3d9ec5685c78b
5
5
  SHA512:
6
- metadata.gz: ff8359526cba8c500244203a3d979592813140a2685c58f81702dd89fa80faed85d43f6e76f765db1aad48b27733fc4f79cfdd51bfb97f79b5dffd7e060b1888
7
- data.tar.gz: e707a8623f2081c11031e47e1b22ba35d503ca29dfee2ea234e3379d1cbac194cc6147de5bc30a99f5534f0cfa170aea4ab9038510826c09ed3a36e7aab7415e
6
+ metadata.gz: 50f28c46252e78156401160ac9b5b10c5be975b85511c4ff5956a3d0c9338839625ea2efcd187b6164fb330db686a155489ef7947038f18ac22f484a3311efc5
7
+ data.tar.gz: fd81224aed695c7e30230967a6ccf72a51581ff731d876bb9db7a6f54498a162315d821df5b7bb77fc2f802cd6326d306a98fb29bc286d63f5cf61e72d4b2ef6
data/docs/proxy.md ADDED
@@ -0,0 +1,10 @@
1
+ # Proxy settings
2
+
3
+ We'll automatically use the `HTTP_X_FORWARDED_FOR` header to determine the client's IP address when behind a trusted proxy.
4
+
5
+ If you need to use a different header to determine the client's IP address, you can set the `AIKIDO_CLIENT_IP_HEADER` environment variable to the name of that header. This will override the default `HTTP_X_FORWARDED_FOR` header.
6
+
7
+ ```bash
8
+ # For Fly.io Platform
9
+ AIKIDO_CLIENT_IP_HEADER=HTTP_FLY_CLIENT_IP bin/rails server
10
+ ```
data/docs/rails.md CHANGED
@@ -66,7 +66,7 @@ Rails.application.config.zen.api_timeouts = 20
66
66
  You can access the configuration object both as `Aikido::Zen.config` or
67
67
  `Rails.configuration.zen`.
68
68
 
69
- See our [configuration guide](docs/config.md) for more details.
69
+ See our [configuration guide](./config.md) for more details.
70
70
 
71
71
  ## Using Rails encrypted credentials
72
72
 
@@ -67,7 +67,9 @@ module Aikido::Zen
67
67
  end
68
68
 
69
69
  def metadata
70
- {filename: filepath}
70
+ {
71
+ filename: filepath
72
+ }
71
73
  end
72
74
 
73
75
  def humanized_name
@@ -133,7 +135,10 @@ module Aikido::Zen
133
135
  end
134
136
 
135
137
  def metadata
136
- {sql: @query}
138
+ {
139
+ sql: @query,
140
+ dialect: @dialect
141
+ }
137
142
  end
138
143
 
139
144
  def exception(*)
@@ -165,7 +170,7 @@ module Aikido::Zen
165
170
 
166
171
  def metadata
167
172
  {
168
- host: @request.uri.hostname,
173
+ hostname: @request.uri.hostname,
169
174
  port: @request.uri.port
170
175
  }
171
176
  end
@@ -200,7 +205,10 @@ module Aikido::Zen
200
205
  end
201
206
 
202
207
  def metadata
203
- {}
208
+ {
209
+ hostname: @hostname,
210
+ resolvedIP: @address
211
+ }
204
212
  end
205
213
  end
206
214
  end
@@ -61,7 +61,7 @@ module Aikido::Zen
61
61
  # @return [Logger]
62
62
  attr_reader :logger
63
63
 
64
- # @return [string] Path of the socket where the detached agent will listen.
64
+ # @return [String] Path of the socket where the detached agent will listen.
65
65
  # By default, is stored under the root application path with file name
66
66
  # `aikido-detached-agent.sock`
67
67
  attr_accessor :detached_agent_socket_path
@@ -70,6 +70,9 @@ module Aikido::Zen
70
70
  attr_accessor :debugging
71
71
  alias_method :debugging?, :debugging
72
72
 
73
+ # @return [String] environment specific HTTP header providing the client IP.
74
+ attr_accessor :client_ip_header
75
+
73
76
  # @return [Integer] maximum number of timing measurements to keep in memory
74
77
  # before compressing them.
75
78
  attr_accessor :max_performance_samples
@@ -146,6 +149,12 @@ module Aikido::Zen
146
149
  # the server returns a 429 response.
147
150
  attr_accessor :server_rate_limit_deadline
148
151
 
152
+ # @return [Boolean] whether Aikido Zen should scan for stored SSSRF attacks.
153
+ # Defaults to true. Can be set through AIKIDO_FEATURE_STORED_SSRF
154
+ # environment variable.
155
+ attr_accessor :stored_ssrf
156
+ alias_method :stored_ssrf?, :stored_ssrf
157
+
149
158
  # @return [Array<String>] when checking for stored SSRF attacks, we want to
150
159
  # allow known hosts that should be able to resolve to the IMDS service.
151
160
  attr_accessor :imds_allowed_hosts
@@ -163,8 +172,9 @@ module Aikido::Zen
163
172
  self.json_decoder = DEFAULT_JSON_DECODER
164
173
  self.debugging = read_boolean_from_env(ENV.fetch("AIKIDO_DEBUG", false))
165
174
  self.logger = Logger.new($stdout, progname: "aikido", level: debugging ? Logger::DEBUG : Logger::INFO)
166
- self.max_performance_samples = 5000
167
175
  self.detached_agent_socket_path = ENV.fetch("AIKIDO_DETACHED_AGENT_SOCKET_PATH", DEFAULT_DETACHED_AGENT_SOCKET_PATH)
176
+ self.client_ip_header = ENV.fetch("AIKIDO_CLIENT_IP_HEADER", nil)
177
+ self.max_performance_samples = 5000
168
178
  self.max_compressed_stats = 100
169
179
  self.max_outbound_connections = 200
170
180
  self.max_users_tracked = 1000
@@ -179,6 +189,7 @@ module Aikido::Zen
179
189
  self.api_schema_max_samples = Integer(ENV.fetch("AIKIDO_MAX_API_DISCOVERY_SAMPLES", 10))
180
190
  self.api_schema_collection_max_depth = 20
181
191
  self.api_schema_collection_max_properties = 20
192
+ self.stored_ssrf = read_boolean_from_env(ENV.fetch("AIKIDO_FEATURE_STORED_SSRF", true))
182
193
  self.imds_allowed_hosts = ["metadata.google.internal", "metadata.goog"]
183
194
  end
184
195
 
@@ -27,7 +27,7 @@ module Aikido::Zen
27
27
  {
28
28
  payload: value.to_s,
29
29
  source: SOURCE_SERIALIZATIONS[source],
30
- pathToPayload: path.to_s
30
+ path: path.to_s
31
31
  }
32
32
  end
33
33
 
@@ -17,8 +17,9 @@ module Aikido::Zen
17
17
  # @see Aikido::Zen.track_user
18
18
  attr_accessor :actor
19
19
 
20
- def initialize(delegate, framework:, router:)
20
+ def initialize(delegate, config = Aikido::Zen.config, framework:, router:)
21
21
  super(delegate)
22
+ @config = config
22
23
  @framework = framework
23
24
  @router = router
24
25
  @body_read = false
@@ -40,6 +41,24 @@ module Aikido::Zen
40
41
  @schema ||= Aikido::Zen::Request::Schema.build
41
42
  end
42
43
 
44
+ # @api private
45
+ #
46
+ # @return [String] the IP address of the client making the request.
47
+ def client_ip
48
+ return @client_ip if @client_ip
49
+
50
+ if @config.client_ip_header
51
+ value = env[@config.client_ip_header]
52
+ if Resolv::AddressRegex.match?(value)
53
+ @client_ip = value
54
+ else
55
+ @config.logger.warn("Invalid IP address in custom client IP header `#{@config.client_ip_header}`: `#{value}`")
56
+ end
57
+ end
58
+
59
+ @client_ip ||= respond_to?(:remote_ip) ? remote_ip : ip
60
+ end
61
+
43
62
  # Map the CGI-style env Hash into "pretty-looking" headers, preserving the
44
63
  # values as-is. For example, HTTP_ACCEPT turns into "Accept", CONTENT_TYPE
45
64
  # turns into "Content-Type", and HTTP_X_FORWARDED_FOR turns into
@@ -87,7 +106,7 @@ module Aikido::Zen
87
106
  {
88
107
  method: request_method.downcase,
89
108
  url: url,
90
- ipAddress: ip,
109
+ ipAddress: client_ip,
91
110
  userAgent: user_agent,
92
111
  headers: normalized_headers.reject { |_, val| val.to_s.empty? },
93
112
  body: truncated_body,
@@ -33,7 +33,9 @@ module Aikido::Zen
33
33
  # @return [String, nil] either the offending address, or +nil+ if no
34
34
  # address is deemed dangerous.
35
35
  def attack?
36
- return false if @config.imds_allowed_hosts.include?(@hostname)
36
+ return unless @config.stored_ssrf? # Feature flag
37
+
38
+ return if @config.imds_allowed_hosts.include?(@hostname)
37
39
 
38
40
  @addresses.find do |candidate|
39
41
  DANGEROUS_ADDRESSES.any? { |address| address === candidate }
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Aikido
4
4
  module Zen
5
- VERSION = "1.0.2.beta.1"
5
+ VERSION = "1.0.2.beta.5"
6
6
 
7
7
  # The version of libzen_internals that we build against.
8
8
  LIBZEN_VERSION = "0.1.39"
data/tasklib/libzen.rake CHANGED
@@ -76,6 +76,7 @@ LIBZENS = [
76
76
  LibZen.new("arm64-darwin.dylib", "libzen_internals_aarch64-apple-darwin.dylib"),
77
77
  LibZen.new("arm64-linux.so", "libzen_internals_aarch64-unknown-linux-gnu.so"),
78
78
  LibZen.new("arm64-linux-musl.so", "libzen_internals_aarch64-unknown-linux-musl.so"),
79
+ LibZen.new("aarch64-linux.so", "libzen_internals_aarch64-unknown-linux-gnu.so"),
79
80
  LibZen.new("x86_64-darwin.dylib", "libzen_internals_x86_64-apple-darwin.dylib"),
80
81
  LibZen.new("x86_64-linux.so", "libzen_internals_x86_64-unknown-linux-gnu.so"),
81
82
  LibZen.new("x86_64-linux-musl.so", "libzen_internals_x86_64-unknown-linux-musl.so"),
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.2.beta.1
4
+ version: 1.0.2.beta.5
5
5
  platform: x86_64-mingw-64
6
6
  authors:
7
7
  - Aikido Security
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-08-27 00:00:00.000000000 Z
11
+ date: 2025-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -74,6 +74,7 @@ files:
74
74
  - benchmarks/rails7.1_sql_injection.js
75
75
  - docs/banner.svg
76
76
  - docs/config.md
77
+ - docs/proxy.md
77
78
  - docs/rails.md
78
79
  - lib/aikido-zen.rb
79
80
  - lib/aikido/zen.rb