auth-centric-firewall 0.2.5 → 0.2.6
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/.rubocop.yml +5 -1
- data/CHANGELOG.md +8 -0
- data/lib/auth/centric/captcha/check_code.rb +5 -5
- data/lib/auth/centric/captcha/delete.rb +3 -3
- data/lib/auth/centric/captcha/retrieve.rb +3 -3
- data/lib/auth/centric/common/settings.rb +8 -4
- data/lib/auth/centric/firewall/capture_request.rb +0 -1
- data/lib/auth/centric/firewall/version.rb +1 -1
- data/lib/auth/centric/firewall.rb +12 -3
- data/sig/auth/centric/common/settings.rbs +3 -0
- data/sig/auth/centric/firewall/capture_request.rbs +2 -0
- data/sig/auth/centric/firewall/internet_protocol.rbs +2 -0
- 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: fb8230fdd49a57f083aa3559b2fa45be4e86c8892582b629f33f336be1d5b916
|
|
4
|
+
data.tar.gz: 4c7241c2131193a93b941a23060c2bfec96840bf5176b7d6c2402ea4c652b2dc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d34e88880858b2f60754d6c54e85dbdd683ce60bc87b772a449c453d09d183599c62e0ec063ed1323de635d12092581e875b87f2b7336762cbbb05999a87b0b2
|
|
7
|
+
data.tar.gz: a43ae597272bc13758333261ef6172a9e0825a7942ff657a7343c75f75cca2f79d7271f914ea64b2fc191c52828500c4834ebb4552f511f111186d7d47426bd3
|
data/.rubocop.yml
CHANGED
|
@@ -2,6 +2,9 @@ AllCops:
|
|
|
2
2
|
TargetRubyVersion: 3.1
|
|
3
3
|
NewCops: enable
|
|
4
4
|
|
|
5
|
+
Style/Documentation:
|
|
6
|
+
Enabled: false
|
|
7
|
+
|
|
5
8
|
Style/StringLiterals:
|
|
6
9
|
EnforcedStyle: single_quotes
|
|
7
10
|
|
|
@@ -11,7 +14,7 @@ Style/StringLiteralsInInterpolation:
|
|
|
11
14
|
Layout/IndentationConsistency:
|
|
12
15
|
EnforcedStyle: indented_internal_methods
|
|
13
16
|
|
|
14
|
-
Naming/
|
|
17
|
+
Naming/PredicatePrefix:
|
|
15
18
|
AllowedMethods:
|
|
16
19
|
- has_access?
|
|
17
20
|
- is_ipv6?
|
|
@@ -19,6 +22,7 @@ Naming/PredicateName:
|
|
|
19
22
|
- is_
|
|
20
23
|
- has_
|
|
21
24
|
- have_
|
|
25
|
+
- does_
|
|
22
26
|
MethodDefinitionMacros:
|
|
23
27
|
- define_method
|
|
24
28
|
- define_singleton_method
|
data/CHANGELOG.md
CHANGED
|
@@ -16,15 +16,15 @@ module Auth
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
http = HTTP
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
.timeout(timeout_seconds)
|
|
20
|
+
.headers(apikey:)
|
|
21
|
+
.post(check_code_path(id), json: payload)
|
|
22
22
|
|
|
23
23
|
case http.status
|
|
24
24
|
when 202
|
|
25
|
-
|
|
25
|
+
true
|
|
26
26
|
when 404, 406
|
|
27
|
-
|
|
27
|
+
false
|
|
28
28
|
else
|
|
29
29
|
raise Error, "#{http.status}: #{http.body}"
|
|
30
30
|
end
|
|
@@ -15,9 +15,9 @@ module Auth
|
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
http = HTTP
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
.timeout(timeout_seconds)
|
|
19
|
+
.headers(apikey:)
|
|
20
|
+
.post(find_or_create_path, json: payload)
|
|
21
21
|
|
|
22
22
|
case http.status
|
|
23
23
|
when 200..202
|
|
@@ -5,19 +5,23 @@ module Auth
|
|
|
5
5
|
module Common
|
|
6
6
|
module Settings
|
|
7
7
|
def host
|
|
8
|
-
@host ||= ENV
|
|
8
|
+
@host ||= ENV.fetch('AUTH_CENTRIC_HOST', 'http://localhost:3003')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def app_id
|
|
12
|
+
@app_id ||= ENV.fetch('AUTH_CENTRIC_APP_ID', '019c2077-7fb0-766b-b6cd-2a28700fd9b6')
|
|
9
13
|
end
|
|
10
14
|
|
|
11
15
|
def apikey
|
|
12
|
-
@apikey ||= ENV
|
|
16
|
+
@apikey ||= ENV.fetch('AUTH_CENTRIC_API_KEY', 'EsRx0-rLseNPjXuXj_FEa-xxzY0isi26')
|
|
13
17
|
end
|
|
14
18
|
|
|
15
19
|
def timeout_seconds
|
|
16
|
-
@timeout_seconds ||= (
|
|
20
|
+
@timeout_seconds ||= ENV.fetch('AUTH_CENTRIC_TIMEOUT_SECONDS', 3).to_i
|
|
17
21
|
end
|
|
18
22
|
|
|
19
23
|
def enabled?
|
|
20
|
-
@enabled ||= %w[true 1 yes on enabled].include?(ENV
|
|
24
|
+
@enabled ||= %w[true 1 yes on enabled].include?(ENV.fetch('AUTH_CENTRIC_ENABLED', 'false')&.downcase)
|
|
21
25
|
end
|
|
22
26
|
|
|
23
27
|
def ip(request)
|
|
@@ -44,10 +44,16 @@ module Auth
|
|
|
44
44
|
ip_address = InternetProtocol.new(request).ip
|
|
45
45
|
return true if !forced && IGNORE_IP.include?(ip_address)
|
|
46
46
|
|
|
47
|
+
original_fullpath = if request.original_fullpath.length == 1
|
|
48
|
+
request.original_fullpath
|
|
49
|
+
else
|
|
50
|
+
request.original_fullpath[1...]
|
|
51
|
+
end
|
|
52
|
+
|
|
47
53
|
http = HTTP
|
|
48
54
|
.timeout(timeout_seconds)
|
|
49
55
|
.headers(apikey:)
|
|
50
|
-
.get(ip_status_path(ip_address))
|
|
56
|
+
.get(ip_status_path(ip_address, app_id, original_fullpath))
|
|
51
57
|
|
|
52
58
|
case http.status
|
|
53
59
|
when 200, 202
|
|
@@ -63,8 +69,11 @@ module Auth
|
|
|
63
69
|
|
|
64
70
|
private
|
|
65
71
|
|
|
66
|
-
def ip_status_path(ip_address)
|
|
67
|
-
[
|
|
72
|
+
def ip_status_path(ip_address, app_id, url)
|
|
73
|
+
[
|
|
74
|
+
host,
|
|
75
|
+
"api/v1/internet_protocols/status?ip=#{ip_address}&app_id=#{app_id}&url=#{url}"
|
|
76
|
+
].join('/')
|
|
68
77
|
end
|
|
69
78
|
|
|
70
79
|
def capture_path
|
|
@@ -3,12 +3,15 @@ module Auth
|
|
|
3
3
|
module Common
|
|
4
4
|
module Settings
|
|
5
5
|
@apikey: string
|
|
6
|
+
@app_id: string
|
|
6
7
|
@enabled: bool
|
|
7
8
|
@host: string
|
|
8
9
|
@ip: string
|
|
9
10
|
@timeout_seconds: int
|
|
10
11
|
|
|
12
|
+
def app_id: -> string
|
|
11
13
|
def apikey: -> string
|
|
14
|
+
|
|
12
15
|
def enabled?: -> bool
|
|
13
16
|
def host: -> string
|
|
14
17
|
def ip: -> string
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: auth-centric-firewall
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Saimon Lovell
|
|
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
92
92
|
- !ruby/object:Gem::Version
|
|
93
93
|
version: '0'
|
|
94
94
|
requirements: []
|
|
95
|
-
rubygems_version:
|
|
95
|
+
rubygems_version: 4.0.5
|
|
96
96
|
specification_version: 4
|
|
97
97
|
summary: Use artificial intelligence to find hackers.
|
|
98
98
|
test_files: []
|