Skip to content

Fix oauth_* accessors to unwrap array values from wrap_values#353

Merged
pboling merged 2 commits intoruby-oauth:mainfrom
davefej:fix/wrap-values-scalar-accessors
Apr 2, 2026
Merged

Fix oauth_* accessors to unwrap array values from wrap_values#353
pboling merged 2 commits intoruby-oauth:mainfrom
davefej:fix/wrap-values-scalar-accessors

Conversation

@davefej
Copy link
Copy Markdown
Contributor

@davefej davefej commented Apr 2, 2026

Parameters stored via wrap_values are arrays, but callers expect scalar strings from oauth_timestamp, oauth_nonce, oauth_consumer_key etc. Only oauth_signature had the [...].flatten.first unwrap; all other accessors returned arrays when params came from POST body or query string, causing NoMethodError (e.g. Array#to_i on timestamp).

Apply the same unwrap pattern to all oauth_* accessors for consistency.

davefej added 2 commits April 2, 2026 12:42
Parameters stored via wrap_values are arrays, but callers
expect scalar strings from oauth_timestamp, oauth_nonce,
oauth_consumer_key etc. Only oauth_signature had the
[...].flatten.first unwrap; all other accessors returned
arrays when params came from POST body or query string,
causing NoMethodError (e.g. Array#to_i on timestamp).

Apply the same unwrap pattern to all oauth_* accessors
for consistency.
Base already defines oauth_signature with array-safe
unwrapping and aliases it as signature. The override in
RackRequest duplicated that logic without the safety,
making it a latent bug for array-valued params and a
broken inherited method for ActionDispatchRequest which
wraps all params via wrap_values.
Copy link
Copy Markdown
Member

@pboling pboling left a comment

Choose a reason for hiding this comment

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

This looks good.

@pboling pboling merged commit f6890c7 into ruby-oauth:main Apr 2, 2026
28 of 31 checks passed
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (b19eb9d) to head (1a13817).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff     @@
##   main   #353   +/-   ##
===========================
===========================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

2 participants