diff --git a/.github/workflows/integration_test.yml b/.github/workflows/integration_test.yml index 0b8d086e..d86e33be 100644 --- a/.github/workflows/integration_test.yml +++ b/.github/workflows/integration_test.yml @@ -19,6 +19,9 @@ jobs: with: # You should create a personal access token and store it in your repository token: ${{ secrets.CI_USER_TOKEN }} + # The token is only needed for this checkout. Later steps pass it explicitly via env + # and do not use git, so do not leave it in .git/config. + persist-credentials: false repository: 'optimizely/travisci-tools' path: 'home/runner/travisci-tools' ref: 'master' diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 971eea92..94bedd58 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -25,18 +25,20 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby: [ '3.0.0', '3.1.0', '3.2.0', '3.3.0' ] + ruby: [ '3.0', '3.1', '3.2', '3.3' ] steps: - uses: actions/checkout@v3 + with: + persist-credentials: false - name: Set up Ruby ${{ matrix.ruby }} uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Install rubocop 1.78.0 for Ruby 3.0.0 - if: matrix.ruby == '3.0.0' + - name: Install rubocop 1.78.0 for Ruby 3.0 + if: matrix.ruby == '3.0' run: | - echo "Installing rubocop 1.78.0 for Ruby 3.0.0" + echo "Installing rubocop 1.78.0 for Ruby 3.0" bundle add rubocop --version 1.78.0 || true bundle install bundle exec rubocop -A Gemfile || true diff --git a/lib/optimizely/cmab/cmab_service.rb b/lib/optimizely/cmab/cmab_service.rb index 88f2825f..71c3957a 100644 --- a/lib/optimizely/cmab/cmab_service.rb +++ b/lib/optimizely/cmab/cmab_service.rb @@ -214,6 +214,9 @@ def hash_attributes(attributes) # @param attributes [Hash] The attributes to be hashed. # @return [String] The MD5 hash of the sorted and serialized attributes. sorted_attrs = JSON.generate(attributes.sort.to_h) + # MD5 is intentional: this is only a fast fingerprint to detect changed attribute values in the local + # CMAB cache (computed on every CMAB evaluation). It is not used for security, so a cryptographic hash is not needed. + # nosemgrep: ruby.lang.security.weak-hashes-md5.weak-hashes-md5 Digest::MD5.hexdigest(sorted_attrs) end end diff --git a/spec/bucketing_holdout_spec.rb b/spec/bucketing_holdout_spec.rb index 4ddf1f67..cd26176f 100644 --- a/spec/bucketing_holdout_spec.rb +++ b/spec/bucketing_holdout_spec.rb @@ -21,6 +21,8 @@ require 'optimizely/logger' # Helper class for testing with controlled bucket values +# This is a plain Ruby test double, not a Rails model, so the mass assignment (attr_accessible) rule does not apply. +# nosemgrep: ruby.lang.security.model-attributes-attr-accessible.model-attributes-attr-accessible class TestBucketer < Optimizely::Bucketer def initialize(logger) super(logger)