record_store 8.0.3 → 8.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/record_store/provider/cloudflare/client.rb +6 -5
- data/lib/record_store/record/a.rb +12 -2
- data/lib/record_store/record/aaaa.rb +12 -2
- data/lib/record_store/record/ptr.rb +26 -7
- data/lib/record_store/version.rb +1 -1
- data/record_store.gemspec +1 -1
- metadata +5 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c527f647483b3ba25a8795bd1de0eebc8db895263dcaa836b36ba61d6937ede
|
4
|
+
data.tar.gz: 89aa174d951809d032d50defe287e53f348a363c68b0eadb759ee15589915b1c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5deb741718100321c6c96bdb789cb73120a1d91a24baeec672da5633805f11cc91c310d32a8bc41aead7f0c5a825bd57544272a0d1a6d1a61041896edd8f265
|
7
|
+
data.tar.gz: c041100480d8f986c5e2c5a3eb4edebc91e30759f3299c12420d9fe263e22fd359912ff3ad88936c3edb3202d5170cecd2adb3defd4213933b65e0e1214250e9
|
data/CHANGELOG.md
CHANGED
@@ -11,35 +11,30 @@ module Cloudflare
|
|
11
11
|
|
12
12
|
def get(endpoint, params = {})
|
13
13
|
uri = build_uri(endpoint, params)
|
14
|
-
|
15
14
|
response = request(:get, uri)
|
16
15
|
Cloudflare::Response.new(response)
|
17
16
|
end
|
18
17
|
|
19
18
|
def post(endpoint, body = nil)
|
20
19
|
uri = build_uri(endpoint)
|
21
|
-
|
22
20
|
response = request(:post, uri, body: body)
|
23
21
|
Cloudflare::Response.new(response)
|
24
22
|
end
|
25
23
|
|
26
24
|
def put(endpoint, body = nil)
|
27
25
|
uri = build_uri(endpoint)
|
28
|
-
|
29
26
|
response = request(:put, uri, body: body)
|
30
27
|
Cloudflare::Response.new(response)
|
31
28
|
end
|
32
29
|
|
33
30
|
def patch(endpoint, body = nil)
|
34
31
|
uri = build_uri(endpoint)
|
35
|
-
|
36
32
|
response = request(:patch, uri, body: body)
|
37
33
|
Cloudflare::Response.new(response)
|
38
34
|
end
|
39
35
|
|
40
36
|
def delete(endpoint)
|
41
37
|
uri = build_uri(endpoint)
|
42
|
-
|
43
38
|
response = request(:delete, uri)
|
44
39
|
Cloudflare::Response.new(response)
|
45
40
|
end
|
@@ -72,6 +67,12 @@ module Cloudflare
|
|
72
67
|
rescue StandardError => e
|
73
68
|
raise "HTTP error: #{e.message}"
|
74
69
|
end
|
70
|
+
|
71
|
+
if response.code.to_i >= 300
|
72
|
+
raise RecordStore::Provider::Error,
|
73
|
+
"HTTP response code: #{response.code} - #{response.message}; #{response.body}"
|
74
|
+
end
|
75
|
+
|
75
76
|
response
|
76
77
|
end
|
77
78
|
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module RecordStore
|
2
2
|
class Record::A < Record
|
3
|
-
|
3
|
+
attr_reader :address
|
4
4
|
|
5
5
|
validates_presence_of :address
|
6
6
|
validate :valid_address?
|
7
7
|
|
8
8
|
def initialize(record)
|
9
9
|
super
|
10
|
-
|
10
|
+
self.address = record.fetch(:address)
|
11
|
+
end
|
12
|
+
|
13
|
+
def address=(value)
|
14
|
+
@address = normalize_address(value)
|
11
15
|
end
|
12
16
|
|
13
17
|
def rdata
|
@@ -26,5 +30,11 @@ module RecordStore
|
|
26
30
|
rescue IPAddr::InvalidAddressError
|
27
31
|
errors.add(:address, 'is invalid')
|
28
32
|
end
|
33
|
+
|
34
|
+
def normalize_address(value)
|
35
|
+
IPAddr.new(value).to_s
|
36
|
+
rescue IPAddr::InvalidAddressError
|
37
|
+
value
|
38
|
+
end
|
29
39
|
end
|
30
40
|
end
|
@@ -1,13 +1,17 @@
|
|
1
1
|
module RecordStore
|
2
2
|
class Record::AAAA < Record
|
3
|
-
|
3
|
+
attr_reader :address
|
4
4
|
|
5
5
|
validates_presence_of :address
|
6
6
|
validate :valid_address?
|
7
7
|
|
8
8
|
def initialize(record)
|
9
9
|
super
|
10
|
-
|
10
|
+
self.address = record.fetch(:address)
|
11
|
+
end
|
12
|
+
|
13
|
+
def address=(value)
|
14
|
+
@address = normalize_address(value)
|
11
15
|
end
|
12
16
|
|
13
17
|
def rdata
|
@@ -26,5 +30,11 @@ module RecordStore
|
|
26
30
|
rescue IPAddr::InvalidAddressError
|
27
31
|
errors.add(:address, 'is invalid')
|
28
32
|
end
|
33
|
+
|
34
|
+
def normalize_address(value)
|
35
|
+
IPAddr.new(value).to_s
|
36
|
+
rescue IPAddr::InvalidAddressError
|
37
|
+
value
|
38
|
+
end
|
29
39
|
end
|
30
40
|
end
|
@@ -2,11 +2,19 @@ module RecordStore
|
|
2
2
|
class Record::PTR < Record
|
3
3
|
attr_accessor :ptrdname
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
FQDN_FORMAT_REGEX = Regexp.new(OCTET_LABEL_SEQUENCE_REGEX.source + IN_ADDR_ARPA_SUFFIX_REGEX.source)
|
5
|
+
# IPv4: 1-3 digits (0-255) followed by dots, 1-4 times
|
6
|
+
IPV4_LABEL_SEQUENCE_REGEX = /\A(?:([0-9]|[1-9][0-9]|[1-9][0-9][0-9])\.){1,4}/
|
8
7
|
|
9
|
-
|
8
|
+
# IPv6: single hex digit followed by dots, exactly 32 times
|
9
|
+
IPV6_LABEL_SEQUENCE_REGEX = /\A(?:[0-9a-f]\.){32}/i
|
10
|
+
|
11
|
+
IN_ADDR_ARPA_SUFFIX_REGEX = /(in-addr|ip6)\.arpa\.\z/
|
12
|
+
|
13
|
+
# Combine with suffix for full validation
|
14
|
+
IPV4_FORMAT_REGEX = Regexp.new(IPV4_LABEL_SEQUENCE_REGEX.source + 'in-addr\.arpa\.\z')
|
15
|
+
IPV6_FORMAT_REGEX = Regexp.new(IPV6_LABEL_SEQUENCE_REGEX.source + 'ip6\.arpa\.\z')
|
16
|
+
|
17
|
+
validates_format_of :fqdn, with: Regexp.union(IPV4_FORMAT_REGEX, IPV6_FORMAT_REGEX)
|
10
18
|
|
11
19
|
validate :validate_fqdn_octets_in_range
|
12
20
|
validate :validate_fqdn_is_in_addr_arpa_subzone
|
@@ -26,9 +34,20 @@ module RecordStore
|
|
26
34
|
end
|
27
35
|
|
28
36
|
def validate_fqdn_octets_in_range
|
29
|
-
|
30
|
-
|
31
|
-
|
37
|
+
if fqdn.end_with?('in-addr.arpa.')
|
38
|
+
# IPv4 validation: each octet must be 0-255
|
39
|
+
IPV4_LABEL_SEQUENCE_REGEX.match(fqdn) do |m|
|
40
|
+
unless m.captures.all? { |o| o.to_i.between?(0, 255) }
|
41
|
+
errors.add(:fqdn, 'IPv4 octet labels must be within the range 0-255')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
elsif fqdn.end_with?('ip6.arpa.')
|
45
|
+
# IPv6 validation: each nibble must be a valid hex digit
|
46
|
+
IPV6_LABEL_SEQUENCE_REGEX.match(fqdn) do |m|
|
47
|
+
nibbles = m[0].split('.').reject(&:empty?)
|
48
|
+
unless nibbles.all? { |n| n.match?(/\A[0-9a-f]\z/i) }
|
49
|
+
errors.add(:fqdn, 'IPv6 labels must be single hexadecimal digits (0-9, a-f)')
|
50
|
+
end
|
32
51
|
end
|
33
52
|
end
|
34
53
|
end
|
data/lib/record_store/version.rb
CHANGED
data/record_store.gemspec
CHANGED
@@ -46,7 +46,7 @@ Gem::Specification.new do |spec|
|
|
46
46
|
spec.add_development_dependency 'mocha'
|
47
47
|
spec.add_development_dependency 'pry'
|
48
48
|
spec.add_development_dependency 'rake'
|
49
|
-
spec.add_development_dependency 'rubocop', '~> 1.
|
49
|
+
spec.add_development_dependency 'rubocop', '~> 1.69.0'
|
50
50
|
spec.add_development_dependency 'rubocop-shopify', '~> 2.15.1'
|
51
51
|
spec.add_development_dependency 'vcr'
|
52
52
|
spec.add_development_dependency 'webmock'
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.0.
|
4
|
+
version: 8.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Willem van Bergen
|
8
8
|
- Emil Stolarsky
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2025-01-09 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: activemodel
|
@@ -305,14 +304,14 @@ dependencies:
|
|
305
304
|
requirements:
|
306
305
|
- - "~>"
|
307
306
|
- !ruby/object:Gem::Version
|
308
|
-
version: 1.
|
307
|
+
version: 1.69.0
|
309
308
|
type: :development
|
310
309
|
prerelease: false
|
311
310
|
version_requirements: !ruby/object:Gem::Requirement
|
312
311
|
requirements:
|
313
312
|
- - "~>"
|
314
313
|
- !ruby/object:Gem::Version
|
315
|
-
version: 1.
|
314
|
+
version: 1.69.0
|
316
315
|
- !ruby/object:Gem::Dependency
|
317
316
|
name: rubocop-shopify
|
318
317
|
requirement: !ruby/object:Gem::Requirement
|
@@ -440,7 +439,6 @@ licenses:
|
|
440
439
|
- MIT
|
441
440
|
metadata:
|
442
441
|
allowed_push_host: https://rubygems.org
|
443
|
-
post_install_message:
|
444
442
|
rdoc_options: []
|
445
443
|
require_paths:
|
446
444
|
- lib
|
@@ -455,8 +453,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
455
453
|
- !ruby/object:Gem::Version
|
456
454
|
version: '0'
|
457
455
|
requirements: []
|
458
|
-
rubygems_version: 3.
|
459
|
-
signing_key:
|
456
|
+
rubygems_version: 3.6.2
|
460
457
|
specification_version: 4
|
461
458
|
summary: Manage DNS using git
|
462
459
|
test_files: []
|