Skip to content

[FSSDK-13474] Fix Arnica findings: artipacked workflows, MD5 hash, test class false positive - #412

Merged
Esra Kartal (esrakartalOpt) merged 3 commits into
masterfrom
fssdk-13474-fix-arnica-findings
Nov 20, 2026
Merged

Esra Kartal (esrakartalOpt) merged 3 commits into
masterfrom
fssdk-13474-fix-arnica-findings

Conversation

@esrakartalOpt

@esrakartalOpt Esra Kartal (esrakartalOpt) commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add persist-credentials: false to the actions/checkout steps in .github/workflows/ruby.yml (line 30) and .github/workflows/integration_test.yml (line 18), so the GitHub token is not left in .git/config (Arnica artipacked findings). No later step needs git credentials: ruby.yml only runs bundler, rubocop, rspec and coveralls, and the integration_test.yml trigger script passes its token to curl through env vars and does not use git.
  • Keep Digest::MD5 in Optimizely::CmabService#hash_attributes (Arnica weak MD5 finding), but document it and add a nosemgrep suppression directly above the call. The hash is only a fast fingerprint for detecting changed attribute values in the local CMAB cache, computed on every CMAB evaluation. It is not used for security and never leaves the SDK, so a cryptographic hash is not needed (per review feedback from Raju Ahmed (@raju-opti)).
  • Add a nosemgrep comment on TestBucketer in spec/bucketing_holdout_spec.rb. The attr_accessible rule is for Rails models, and this is a plain test double, so the finding is a false positive.
  • Use Ruby series versions (3.0, 3.1, 3.2, 3.3) in the ruby.yml CI matrix. ubuntu-latest is now Ubuntu 26.04, which only provides the latest patch of each Ruby series, so exact versions like 3.1.0 failed at setup-ruby. The rubocop condition for Ruby 3.0 is updated to match. This was a pre-existing CI failure, not caused by the other changes.

Arnica may need the MD5 and TestBucketer findings dismissed there with the reasons above if the nosemgrep comments are not honored.

Test plan

  • bundle exec rake spec: 1131 examples, 0 failures
  • bundle exec rubocop: no offenses
  • Both workflow files parse as valid YAML
  • All CI jobs pass (unit_tests on Ruby 3.0, 3.1, 3.2 and 3.3, plus the integration tests)

Issues

  • FSSDK-13474

🤖 Generated with Claude Code

…st class false positive

- Add persist-credentials: false to the actions/checkout steps in ruby.yml and
  integration_test.yml so the GitHub token is not left in .git/config.
- Use SHA256 instead of MD5 for the CMAB attributes cache fingerprint.
- Add a nosemgrep comment on the TestBucketer test class (not a Rails model).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
ubuntu-latest is now Ubuntu 26.04, which only provides the latest patch of
each Ruby series, so exact versions like 3.1.0 fail in setup-ruby. Use 3.0,
3.1, 3.2 and 3.3 so the latest patch is always selected, and update the
rubocop condition for Ruby 3.0 to match.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Comment thread lib/optimizely/cmab/cmab_service.rb Resolved
…suppress

Revert the SHA256 change per review. The hash only detects changed attribute
values in the local CMAB cache and is computed on every CMAB evaluation, so a
fast non-cryptographic hash is preferable. Add a comment and nosemgrep
suppression explaining that it is not used for security.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@raju-opti Raju Ahmed (raju-opti) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Human validation is needed because the unavailable external trigger script’s credential requirements remain unverified, and passing PR integration runs use @master rather than the changed workflow.

No open issues 🎉

What changed in this PR

This PR addresses Arnica findings by disabling persisted checkout credentials and documenting two scanner suppressions. It also updates the Ruby CI matrix without changing SDK runtime behavior.

Changes:

  • Disable credential persistence in the unit-test and integration workflows.
  • Add explanatory comments and nosemgrep suppressions for the existing MD5 cache fingerprint and the plain Ruby test double.
  • Use Ruby series versions in CI and align the Ruby 3.0 RuboCop condition.
File Description
spec/​bucketing_holdout_spec.rb Documents and suppresses the Rails-specific false positive on TestBucketer.
lib/​optimizely/​cmab/​cmab_service.rb Explains the existing MD5 fingerprint use and adds a scanner suppression.
.github/​workflows/​ruby.yml Disables persisted credentials and updates Ruby versions and the RuboCop condition.
.github/​workflows/​integration_test.yml Disables persisted checkout credentials and documents the intended token usage.

Review effort: Balanced

@esrakartalOpt

Copy link
Copy Markdown
Contributor Author

Following up on the Copilot review note about the two items that needed human validation:

  1. Trigger script credentials: I read both scripts in optimizely/travisci-tools that the integration workflow runs (trigger-script-with-status-update.sh and generic-trigger/generic-trigger.sh). Neither uses git. They only call curl with a token passed in through env vars (GITHUB_TOKEN and TRAVIS_COM_TOKEN, which the workflow sets explicitly on that step). They do not need credentials stored in .git/config, so persist-credentials: false on the travisci-tools checkout is safe.
  2. @master workflow reference: correct. ruby.yml calls the reusable workflow as optimizely/ruby-sdk/.github/workflows/integration_test.yml@master, so the integration jobs on this PR ran the existing master version and not the edited file. The change to integration_test.yml will first run after this PR is merged. Based on the check above I don't expect a problem, and if one appears it is a one-line revert.

@esrakartalOpt
Esra Kartal (esrakartalOpt) merged commit e1ec690 into master Nov 20, 2026
11 of 12 checks passed
@esrakartalOpt
Esra Kartal (esrakartalOpt) deleted the fssdk-13474-fix-arnica-findings branch November 20, 2026 19:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants