reputable 0.1.23 → 0.1.25
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/Gemfile.lock +1 -1
- data/README.md +4 -0
- data/lib/reputable/middleware.rb +27 -0
- data/lib/reputable/version.rb +1 -1
- data/reputable.gemspec +38 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 71bd7ca4b8c5f9ed7587e464ae373eb944a54e51c5fb2ba119c32e8e6337336a
|
|
4
|
+
data.tar.gz: 2061b0c777149a2a689eed5dfa6c1ee429f4aa433d02fce31be31b200b46c93c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9faf4fe50a95dc50a5e13d33c215ea3894de64dace21176f5cbfd0f8794f6365ca53edb34b4fbabf0a7a8136bdea109b1d9519856c9197a45d2bfdcd43077310
|
|
7
|
+
data.tar.gz: bda70059416410192c65851f2ab96169958b87912c7e462fc350f866d59379d0e153419297c5c2b90aa26e9e65acab5c5f32ed293ce3bc30b878609b29823c90
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -260,6 +260,10 @@ config.middleware.use Reputable::Middleware
|
|
|
260
260
|
config.middleware.use Reputable::Middleware,
|
|
261
261
|
# Skip certain paths (health checks, assets, etc.)
|
|
262
262
|
skip_paths: ['/health', '/healthz', '/assets', '/packs'],
|
|
263
|
+
|
|
264
|
+
# Skip all requests under a path prefix
|
|
265
|
+
# Example: /bot_verifications/new, /bot_verifications/123, etc.
|
|
266
|
+
skip_path_prefixes: ['/bot_verifications'],
|
|
263
267
|
|
|
264
268
|
# Skip by file extension
|
|
265
269
|
skip_extensions: ['.js', '.css', '.png', '.jpg', '.svg'],
|
data/lib/reputable/middleware.rb
CHANGED
|
@@ -41,8 +41,12 @@ module Reputable
|
|
|
41
41
|
def initialize(app, options = {})
|
|
42
42
|
@app = app
|
|
43
43
|
@skip_paths = options.fetch(:skip_paths, DEFAULT_SKIP_PATHS)
|
|
44
|
+
@skip_path_prefixes = Array(options[:skip_path_prefixes])
|
|
44
45
|
@skip_extensions = options.fetch(:skip_extensions, DEFAULT_SKIP_EXTENSIONS)
|
|
45
46
|
@skip_if = options[:skip_if]
|
|
47
|
+
@skip_ips = Array(options[:skip_ips])
|
|
48
|
+
@skip_user_agents = Array(options[:skip_user_agents]).map(&:downcase)
|
|
49
|
+
@skip_query_params = Array(options[:skip_query_params]).map(&:downcase)
|
|
46
50
|
@tag_builder = options[:tag_builder]
|
|
47
51
|
@async = options.fetch(:async, true)
|
|
48
52
|
@track_request = options.key?(:track_request) ? options[:track_request] : nil
|
|
@@ -398,10 +402,33 @@ module Reputable
|
|
|
398
402
|
# Skip exact path matches
|
|
399
403
|
return true if @skip_paths.include?(path)
|
|
400
404
|
|
|
405
|
+
# Skip by path prefix (e.g. /bot_verifications, /internal/)
|
|
406
|
+
if @skip_path_prefixes.any?
|
|
407
|
+
return true if @skip_path_prefixes.any? { |prefix| path.start_with?(prefix.to_s) }
|
|
408
|
+
end
|
|
409
|
+
|
|
401
410
|
# Skip by extension
|
|
402
411
|
ext = File.extname(path).downcase
|
|
403
412
|
return true if @skip_extensions.include?(ext)
|
|
404
413
|
|
|
414
|
+
# Skip by IP prefix (e.g. known crawler IP ranges)
|
|
415
|
+
if @skip_ips.any?
|
|
416
|
+
ip = env["reputable.ip"] || extract_ip(env)
|
|
417
|
+
return true if @skip_ips.any? { |prefix| ip.start_with?(prefix) }
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
# Skip by User-Agent substring (e.g. known crawlers)
|
|
421
|
+
if @skip_user_agents.any?
|
|
422
|
+
ua = (env["HTTP_USER_AGENT"] || "").downcase
|
|
423
|
+
return true if @skip_user_agents.any? { |sig| ua.include?(sig) }
|
|
424
|
+
end
|
|
425
|
+
|
|
426
|
+
# Skip by query parameter presence (e.g. paid traffic: gclid, utm_*)
|
|
427
|
+
if @skip_query_params.any?
|
|
428
|
+
qs = (env["QUERY_STRING"] || "").downcase
|
|
429
|
+
return true if @skip_query_params.any? { |param| qs.include?(param) }
|
|
430
|
+
end
|
|
431
|
+
|
|
405
432
|
false
|
|
406
433
|
rescue StandardError
|
|
407
434
|
# If skip logic fails, default to skipping (safer)
|
data/lib/reputable/version.rb
CHANGED
data/reputable.gemspec
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative "lib/reputable/version"
|
|
4
|
+
|
|
5
|
+
Gem::Specification.new do |spec|
|
|
6
|
+
spec.name = "reputable"
|
|
7
|
+
spec.version = Reputable::VERSION
|
|
8
|
+
spec.authors = ["Reputable"]
|
|
9
|
+
spec.email = ["support@reputable.click"]
|
|
10
|
+
|
|
11
|
+
spec.summary = "Ruby client for Reputable - bot detection and reputation scoring"
|
|
12
|
+
spec.description = "Track requests and manage IP reputation through Redis/Dragonfly integration with Reputable"
|
|
13
|
+
spec.homepage = "https://github.com/reputable-click/reputable-rb"
|
|
14
|
+
spec.license = "MIT"
|
|
15
|
+
spec.required_ruby_version = ">= 2.7.0"
|
|
16
|
+
|
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
18
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
|
19
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/blob/main/CHANGELOG.md"
|
|
20
|
+
|
|
21
|
+
spec.files = Dir.chdir(__dir__) do
|
|
22
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
|
23
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)}) || f.end_with?(".gem")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
spec.bindir = "exe"
|
|
27
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
|
28
|
+
spec.require_paths = ["lib"]
|
|
29
|
+
|
|
30
|
+
spec.add_dependency "redis", ">= 4.0", "< 6.0"
|
|
31
|
+
spec.add_dependency "connection_pool", "~> 2.2"
|
|
32
|
+
|
|
33
|
+
spec.add_development_dependency "bundler", "~> 2.0"
|
|
34
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
|
35
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
|
36
|
+
spec.add_development_dependency "rack", "~> 2.0"
|
|
37
|
+
spec.add_development_dependency "rubocop", "~> 1.0"
|
|
38
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: reputable
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.25
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Reputable
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-02-
|
|
11
|
+
date: 2026-02-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: redis
|
|
@@ -137,6 +137,7 @@ files:
|
|
|
137
137
|
- lib/reputable/reputation.rb
|
|
138
138
|
- lib/reputable/tracker.rb
|
|
139
139
|
- lib/reputable/version.rb
|
|
140
|
+
- reputable.gemspec
|
|
140
141
|
homepage: https://github.com/reputable-click/reputable-rb
|
|
141
142
|
licenses:
|
|
142
143
|
- MIT
|