record_store 8.0.4 → 8.0.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/CHANGELOG.md +6 -0
- data/lib/record_store/provider/cloudflare/client.rb +6 -5
- data/lib/record_store/provider/cloudflare.rb +3 -2
- data/lib/record_store/record/ptr.rb +26 -7
- data/lib/record_store/record/txt.rb +1 -1
- 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: 0ea2231f371be0d7bc9f308ccaec17a1b27c410cea7972a8e3e3f7a066ba9042
|
4
|
+
data.tar.gz: dbd3fd8c7622660afd23443245c0a350a0bdec1ad2d26bd15951e8db182df751
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ca85b2b49dd23799a9ab95cc60e2e0575b55dc07defb9f6c0b039ff2ef02e5c55b20a7d092aebefedf727e33dd02ca3f2b34ffa5dd758e5d8050b902672caad9
|
7
|
+
data.tar.gz: 7435df6101ac759bbf5b980aeb3eaf9b33c8fb4eaf02bccd087c60b74ebae600162fc53a9dc8ecb5eb812e9aa1f50aa37c1f2e91b7fbf3d2fdef9950de1270ce
|
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
|
@@ -128,7 +128,7 @@ module RecordStore
|
|
128
128
|
api_body[:content] = record.exchange
|
129
129
|
api_body[:priority] = record.preference
|
130
130
|
when Record::TXT, Record::SPF
|
131
|
-
api_body[:content] = record.txtdata.gsub('\;', ';')
|
131
|
+
api_body[:content] = Record.quote(record.txtdata.gsub('\;', ';'))
|
132
132
|
when Record::CAA
|
133
133
|
api_body[:data] = record.rdata
|
134
134
|
when Record::SRV
|
@@ -166,7 +166,8 @@ module RecordStore
|
|
166
166
|
record.merge!(cname: api_response['content'])
|
167
167
|
end
|
168
168
|
when 'TXT'
|
169
|
-
|
169
|
+
content = Record.unquote(api_response['content'])
|
170
|
+
record.merge!(txtdata: content.gsub(';', '\;'))
|
170
171
|
when 'MX'
|
171
172
|
record.merge!(preference: api_response['priority'], exchange: api_response['content'])
|
172
173
|
when 'PTR'
|
@@ -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
|
@@ -22,7 +22,7 @@ module RecordStore
|
|
22
22
|
|
23
23
|
def escaped_semicolons
|
24
24
|
if txtdata =~ /([^\\]|\A);/
|
25
|
-
errors.add(:txtdata, 'has unescaped semicolons
|
25
|
+
errors.add(:txtdata, 'has unescaped semicolons, which begins comment portion of record per RFC 1035.')
|
26
26
|
end
|
27
27
|
end
|
28
28
|
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.6
|
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-02-27 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.3
|
460
457
|
specification_version: 4
|
461
458
|
summary: Manage DNS using git
|
462
459
|
test_files: []
|