Skip to content

fix: resolve Blocker and High SonarCloud findings - #548

Draft
arjun-rajappa wants to merge 1 commit into
masterfrom
fix/sonarcloud-blocker-high-findings
Draft

arjun-rajappa wants to merge 1 commit into
masterfrom
fix/sonarcloud-blocker-high-findings

Conversation

@arjun-rajappa

@arjun-rajappa arjun-rajappa commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Why

SonarCloud reports 99 open Blocker and High findings on master (1 Blocker, 98 High). The Blocker is a script-injection risk in the release Slack workflow, so these need clearing.

What

  • release-notification-on-slack.yml: pass github.event_name and inputs.github_ref through env: instead of interpolating them into the shell script (Blocker, S7630).
  • S7836 Thread.current (14): the Lambda function ARN uses Fiber[] storage (gem requires Ruby >= 3.2). The gRPC and Sidekiq test boot files use local variables.
  • S7865 (18): ENV[] reads use ENV.fetch(KEY, nil), same behavior as before.
  • S131 (4): added an explicit else to case statements. .rubocop.yml sets Style/EmptyElse to EnforcedStyle: empty so else nil passes RuboCop without inline disables.
  • S1186 (5): added comments explaining why the methods are empty.
  • S1192 (4): extracted constants (DISABLE_SERVER_TIMING_KEY, gRPC metadata keys, EXECUTE_GRAPHQL).
  • S8424 (3): the Sinatra and Rails tests parse into a local variable and assign APP once.
  • S7816 (6 of 50): moved requires to the top of the file in trace.rb, util.rb and grpc_server.rb.

The other 44 S7816 findings are not changed. They are lazy or conditional requires (the activators, begin/rescue LoadError, version-dependent test requires), and moving them would change behavior. They should be marked as false positives in SonarCloud.

Testing: RuboCop is clean on the changed files, and bundle exec rake test passes (651 tests, 0 failures). The Rails, gRPC, GraphQL and SQS suites were not run locally, so CI should confirm those.

- Pass workflow inputs to the Slack release script via env vars
  instead of interpolating them in the shell (script injection)
- Replace Thread.current with Fiber[] for the Lambda function ARN
  and with local variables in the gRPC and Sidekiq test boot files
- Use ENV.fetch instead of ENV[] for reads without a default
- Add explicit else branches to case statements and set
  Style/EmptyElse to EnforcedStyle: empty in .rubocop.yml
- Comment intentionally empty methods
- Extract duplicated string literals into constants
- Assign APP once in the Sinatra and Rails tests
- Move requires to the top of the file in trace.rb, util.rb and
  grpc_server.rb

No behavior change intended. The remaining S7816 findings are lazy
or conditional requires and are to be marked as false positives.

Signed-off-by: Arjun Rajappa <arjun.rajappa@ibm.com>
@arjun-rajappa arjun-rajappa self-assigned this Nov 25, 2026
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant