record_store 8.0.11 → 9.0.0

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: 43d93495d6304ff99a4c2335be9452a7dd8a222580d702536e21d3cf836e0607
4
- data.tar.gz: f1f948d4136c09ecca1a6199eda17aea70bb726a3a75e8aa224d0ee3b2df13a3
3
+ metadata.gz: ce291e6fbcef26df114b7bbf86e5e2ebd21bfdccf8734f5a9c68976ef92bdf2b
4
+ data.tar.gz: 2138a7322d533f1de25e2bd7dc69a5046acfda2f352520a64cbccf209f8a7b35
5
5
  SHA512:
6
- metadata.gz: 7e143587f1505ee799b3849d1fdcec2e58563fd5ffb9e75154e4277bef465bf8e76aec116aeb9e418eb81441a46132ab34c8806c39266cc4c7db4f92c6125907
7
- data.tar.gz: c92a3b36d67f4cec13ba82aa3c7679803188c1e56e79917fadccc82cd0c856d6bdefd0beb4892ca050c7005579d4e0ec888fe35cc5e9850c464d3cde23a5c542
6
+ metadata.gz: ec4b883bb2bde7c4803ddd623a4ff95866a7d0505e1493f76af61abd6d904f2f81f40791a7902bbb380def97e82320cc0d1c57ba54fe02d87c726f41e6cb7f51
7
+ data.tar.gz: 5f2e9b36f150961bbb40df71c3aa917e8572d509ecb28aa547b75442adacba8c2f3cc7d642469a0b63402b09334d747c7bdf3245b264b233dae37daea22fc96c
@@ -14,7 +14,7 @@ jobs:
14
14
  ruby: [ 3.2, 3.3, 3.4 ]
15
15
  name: Test Ruby ${{ matrix.ruby }}
16
16
  steps:
17
- - uses: actions/checkout@v6
17
+ - uses: actions/checkout@v7
18
18
  - name: Install dependencies
19
19
  run: |
20
20
  sudo apt-get update && sudo apt-get install build-essential libcurl4-openssl-dev
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 9.0.0
4
+ - Only load implicit record templates by plain file name from directly inside `implicit_records_templates_path`. Template names containing path separators, `.` or `..`, and symlinks that resolve outside that directory now raise an error. Zone definitions that referenced templates this way must move them into the templates directory and use the plain file name.
5
+
3
6
  ## 8.0.11
4
7
  - Modified Zone#fetch_authority to handle SOA answer sections from authoritative servers
5
8
 
data/README.md CHANGED
@@ -135,6 +135,8 @@ Record Store supports injecting implicit records into a zone based on templates.
135
135
 
136
136
  Templates can help reduce zone file bloat where instead of defining many generic literals within the zone file for a given criteria zone record, these generic records can be implicitly injected into the `Zone` at the time of initialization based on information provided within the template.
137
137
 
138
+ Zone definitions reference templates by plain file name (for example `implicit_records_templates: [acme-challenge.yml.erb]`), and only files directly inside `implicit_records_templates_path` can be loaded. Names containing path separators, `.` or `..`, and symlinks that resolve outside that directory are rejected. Templates are rendered as ERB, so treat the templates directory as code: restrict who can change it to people you would trust to change Record Store itself.
139
+
138
140
  ----
139
141
 
140
142
  # Development
@@ -1,3 +1,3 @@
1
1
  module RecordStore
2
- VERSION = '8.0.11'.freeze
2
+ VERSION = '9.0.0'.freeze
3
3
  end
@@ -25,6 +25,8 @@ module RecordStore
25
25
  end
26
26
 
27
27
  class ImplicitRecordTemplate
28
+ class InvalidTemplateFilename < ArgumentError; end
29
+
28
30
  class << self
29
31
  def from_file(filename:)
30
32
  filepath = template_filepath_for(filename: filename)
@@ -43,8 +45,26 @@ module RecordStore
43
45
 
44
46
  private
45
47
 
48
+ # Templates are rendered as ERB, so only files directly inside the
49
+ # configured templates directory may be loaded. Zone definitions name a
50
+ # template by its plain file name; anything that could resolve elsewhere
51
+ # (path separators, `.`/`..`, or a symlink out of the directory) is rejected.
46
52
  def template_filepath_for(filename:)
47
- "#{RecordStore.implicit_records_templates_path}/#{filename}"
53
+ name = filename.to_s
54
+ base = Pathname.new(RecordStore.implicit_records_templates_path).realpath
55
+
56
+ if name.empty? || name == '.' || name == '..' || name != File.basename(name)
57
+ raise InvalidTemplateFilename,
58
+ "implicit record template #{filename.inspect} must be a plain file name in #{base}"
59
+ end
60
+
61
+ path = base.join(name).realpath
62
+ unless path.dirname == base
63
+ raise InvalidTemplateFilename,
64
+ "implicit record template #{filename.inspect} resolves outside #{base}"
65
+ end
66
+
67
+ path.to_s
48
68
  end
49
69
  end
50
70
 
@@ -80,7 +80,7 @@ module RecordStore
80
80
 
81
81
  def initialize(name:, records: [], config: {}, abstract_syntax_trees: {})
82
82
  @name = Record.ensure_ends_with_dot(name)
83
- @config = RecordStore::Zone::Config.new(**config.deep_symbolize_keys)
83
+ @config = build_config(config)
84
84
  @records = build_records(records)
85
85
  @abstract_syntax_trees = abstract_syntax_trees
86
86
  end
@@ -224,6 +224,12 @@ module RecordStore
224
224
  end
225
225
  end
226
226
 
227
+ def build_config(config)
228
+ RecordStore::Zone::Config.new(**config.deep_symbolize_keys)
229
+ rescue Config::ImplicitRecordTemplate::InvalidTemplateFilename => e
230
+ raise e.exception("zone #{unrooted_name}: #{e.message}")
231
+ end
232
+
227
233
  def build_records(records)
228
234
  all_records = records.map { |record| Record.build_from_yaml_definition(record) }
229
235
 
data/record_store.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.add_runtime_dependency 'ejson'
33
33
  spec.add_runtime_dependency 'thor', '>= 1.4.0'
34
34
 
35
- spec.add_runtime_dependency 'dnsimple', '>= 4.4', '< 11.2'
35
+ spec.add_runtime_dependency 'dnsimple', '>= 4.4', '< 12.3'
36
36
  spec.add_runtime_dependency 'fog-dynect', '>= 0.4', '< 0.6'
37
37
  spec.add_runtime_dependency 'fog-json'
38
38
  spec.add_runtime_dependency 'fog-xml'
@@ -47,7 +47,7 @@ Gem::Specification.new do |spec|
47
47
  spec.add_development_dependency 'mocha'
48
48
  spec.add_development_dependency 'pry'
49
49
  spec.add_development_dependency 'rake'
50
- spec.add_development_dependency 'rubocop', '~> 1.82.1'
50
+ spec.add_development_dependency 'rubocop', '~> 1.88.0'
51
51
  spec.add_development_dependency 'rubocop-shopify', '~> 2.15.1'
52
52
  spec.add_development_dependency 'vcr'
53
53
  spec.add_development_dependency 'webmock'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: record_store
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.11
4
+ version: 9.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Willem van Bergen
@@ -89,7 +89,7 @@ dependencies:
89
89
  version: '4.4'
90
90
  - - "<"
91
91
  - !ruby/object:Gem::Version
92
- version: '11.2'
92
+ version: '12.3'
93
93
  type: :runtime
94
94
  prerelease: false
95
95
  version_requirements: !ruby/object:Gem::Requirement
@@ -99,7 +99,7 @@ dependencies:
99
99
  version: '4.4'
100
100
  - - "<"
101
101
  - !ruby/object:Gem::Version
102
- version: '11.2'
102
+ version: '12.3'
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: fog-dynect
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -312,14 +312,14 @@ dependencies:
312
312
  requirements:
313
313
  - - "~>"
314
314
  - !ruby/object:Gem::Version
315
- version: 1.82.1
315
+ version: 1.88.0
316
316
  type: :development
317
317
  prerelease: false
318
318
  version_requirements: !ruby/object:Gem::Requirement
319
319
  requirements:
320
320
  - - "~>"
321
321
  - !ruby/object:Gem::Version
322
- version: 1.82.1
322
+ version: 1.88.0
323
323
  - !ruby/object:Gem::Dependency
324
324
  name: rubocop-shopify
325
325
  requirement: !ruby/object:Gem::Requirement
@@ -461,7 +461,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
461
461
  - !ruby/object:Gem::Version
462
462
  version: '0'
463
463
  requirements: []
464
- rubygems_version: 3.7.2
464
+ rubygems_version: 4.0.21
465
465
  specification_version: 4
466
466
  summary: Manage DNS using git
467
467
  test_files: []