Skip to content

Commit

Permalink
Merge branch 'main' into issue-264
Browse files Browse the repository at this point in the history
  • Loading branch information
tuxmea authored Feb 20, 2024
2 parents 41e36b6 + c968bc6 commit 530565b
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 31 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,6 @@ jobs:
tags: 'ci/hdm:${{ github.sha }}'
push: false

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ci/hdm:${{ github.sha }}'
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'

tests:
needs:
- shellcheck
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/trivy-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Trivy

on:
push:
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches:
- main


jobs:
analyze:
name: 'Analyze'
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build Docker image
uses: docker/build-push-action@v5
with:
context: .
tags: 'ci/hdm:${{ github.sha }}'
push: false

- name: Run Trivy vulnerability scanner
uses: aquasecurity/trivy-action@master
with:
image-ref: 'ci/hdm:${{ github.sha }}'
format: 'sarif'
output: 'trivy-results.sarif'

- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: 'trivy-results.sarif'
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ gem 'stimulus-rails'
gem 'bootstrap', '~> 5.3.0'
gem 'bootstrap-icons-helper'

# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 5.0'
# Use Active Model has_secure_password
gem 'bcrypt', '~> 3.1.20'

Expand Down
25 changes: 10 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ GEM
mini_portile2 (2.8.5)
mini_racer (0.8.0)
libv8-node (~> 18.16.0.0)
minitest (5.21.2)
minitest (5.22.2)
multi_json (1.15.0)
multi_xml (0.6.0)
mutex_m (0.2.0)
Expand All @@ -253,14 +253,14 @@ GEM
net-smtp (0.4.0.1)
net-protocol
nio4r (2.7.0)
nokogiri (1.16.0)
nokogiri (1.16.2)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.0-arm64-darwin)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.0-x86_64-darwin)
nokogiri (1.16.2-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.0-x86_64-linux)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
octokit (4.25.1)
faraday (>= 1, < 3)
Expand Down Expand Up @@ -309,7 +309,7 @@ GEM
puppetdb-ruby (1.2.0)
httparty
racc (1.7.3)
rack (3.0.8)
rack (3.0.9)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
Expand Down Expand Up @@ -354,20 +354,16 @@ GEM
rchardet (1.8.0)
rdoc (6.6.2)
psych (>= 4.0.0)
redis (5.0.8)
redis-client (>= 0.17.0)
redis-client (0.18.0)
connection_pool
regexp_parser (2.9.0)
reline (0.4.2)
io-console (~> 0.5)
rexml (3.2.6)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-openapi (0.11.0)
rspec-core (3.13.0)
rspec-support (~> 3.13.0)
rspec-openapi (0.12.0)
actionpack (>= 5.2.0)
rspec-core
rspec-support (3.12.1)
rspec-support (3.13.0)
rubocop (1.60.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
Expand Down Expand Up @@ -501,7 +497,6 @@ DEPENDENCIES
puppet
puppetdb-ruby
rails (~> 7.1.3)
redis (~> 5.0)
rspec-openapi
rubocop (~> 1.60.2)
rubocop-capybara (~> 2.20.0)
Expand Down
2 changes: 1 addition & 1 deletion app/models/hiera_data/hierarchy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def determine_backend
value = raw_hash[lookup_function]
backends = BACKENDS
custom_mappings = Rails.configuration.hdm[:custom_lookup_function_mapping]
backends = backends.deep_merge({ "lookup_key" => custom_mappings }) if custom_mappings.present?
backends = backends.deep_merge({ "lookup_key" => custom_mappings.stringify_keys }) if custom_mappings.present?
backends.fetch(key).fetch(value).to_sym
rescue KeyError
raise Hdm::Error, "unknown backend #{value}"
Expand Down
2 changes: 1 addition & 1 deletion test/models/hiera_data/hierarchy_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ class HierarchyForCustomBackend < ActiveSupport::TestCase

test "custom lookup function mapped to eyaml" do
Rails.configuration.hdm[:custom_lookup_function_mapping] = {
"custom_eyaml_function" => "eyaml"
custom_eyaml_function: "eyaml"
}
hierarchy = HieraData::Hierarchy.new(raw_hash:, base_path: ".")
assert_equal :eyaml, hierarchy.backend
Expand Down

0 comments on commit 530565b

Please sign in to comment.