fix: rename signatureEncoding to signatureMethod for OAuth1 in opencollection types#7724
fix: rename signatureEncoding to signatureMethod for OAuth1 in opencollection types#7724lohit-bruno wants to merge 1 commit intousebruno:mainfrom
signatureEncoding to signatureMethod for OAuth1 in opencollection types#7724Conversation
…llection types Align with @opencollection/types 0.9.1 which renamed the OAuth1 field from signatureEncoding to signatureMethod. Update converters, filestore, and all YML test fixtures. Increase OAuth1 UI test timeouts from 30s to 60s.
WalkthroughThis PR renames the OAuth1 signature method field from Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/bruno-filestore/src/formats/yml/common/auth.ts (1)
266-285:⚠️ Potential issue | 🟠 MajorAdd fallback for legacy OAuth1
signatureEncodingfield to prevent silent behavior change.Line 275 only reads
auth.signatureMethodwith fallback to'HMAC-SHA1'. Existing YAML files saved before the recent field rename may containsignatureEncoding—when deserialized, this legacy field will be absent from theAuthobject, causing non-SHA1 signature methods to silently downgrade to HMAC-SHA1. While new writes only usesignatureMethod, the read path must support both fields during the migration window.Proposed fix
- case 'oauth1': + case 'oauth1': { + const oauth1Auth = auth as AuthOAuth1 & { + signatureEncoding?: BrunoAuthOauth1['signatureMethod']; + }; + brunoAuth.mode = 'oauth1'; brunoAuth.oauth1 = { consumerKey: auth.consumerKey || null, consumerSecret: auth.consumerSecret || null, accessToken: auth.accessToken || null, accessTokenSecret: auth.accessTokenSecret || null, callbackUrl: auth.callbackUrl || null, verifier: auth.verifier || null, - signatureMethod: (auth.signatureMethod as BrunoAuthOauth1['signatureMethod']) || 'HMAC-SHA1', + signatureMethod: (oauth1Auth.signatureMethod || oauth1Auth.signatureEncoding || 'HMAC-SHA1') as BrunoAuthOauth1['signatureMethod'], privateKey: (typeof auth.privateKey === 'object' && auth.privateKey ? auth.privateKey.value : auth.privateKey) || null, privateKeyType: (typeof auth.privateKey === 'object' && auth.privateKey ? auth.privateKey.type : 'text') as BrunoAuthOauth1['privateKeyType'], timestamp: auth.timestamp || null, nonce: auth.nonce || null, version: auth.version || '1.0', realm: auth.realm || null, placement: (auth.placement as BrunoAuthOauth1['placement']) || 'header', includeBodyHash: auth.includeBodyHash || false }; break; + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/bruno-filestore/src/formats/yml/common/auth.ts` around lines 266 - 285, The oauth1 branch currently only reads auth.signatureMethod and falls back to 'HMAC-SHA1', which ignores older YAML files that used signatureEncoding; update the brunoAuth.oauth1.signatureMethod assignment to prefer auth.signatureMethod, then fall back to auth.signatureEncoding, then 'HMAC-SHA1' (and cast to BrunoAuthOauth1['signatureMethod'] as before) so legacy signatureEncoding values are honored during reads; ensure the same fallback pattern is used where BrunoAuthOauth1['signatureMethod'] is referenced.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@packages/bruno-filestore/src/formats/yml/common/auth.ts`:
- Around line 266-285: The oauth1 branch currently only reads
auth.signatureMethod and falls back to 'HMAC-SHA1', which ignores older YAML
files that used signatureEncoding; update the brunoAuth.oauth1.signatureMethod
assignment to prefer auth.signatureMethod, then fall back to
auth.signatureEncoding, then 'HMAC-SHA1' (and cast to
BrunoAuthOauth1['signatureMethod'] as before) so legacy signatureEncoding values
are honored during reads; ensure the same fallback pattern is used where
BrunoAuthOauth1['signatureMethod'] is referenced.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 657d6d9c-61fb-4a0d-806b-53cce70479ff
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (28)
package.jsonpackages/bruno-converters/package.jsonpackages/bruno-converters/src/opencollection/common/auth.tspackages/bruno-filestore/src/formats/yml/common/auth.tstests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 401.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 Body 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 Body JSON 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 POST 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA1 Query Params 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA256 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA256 401.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA256 Body 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA512 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 HMAC-SHA512 401.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 PLAINTEXT 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 PLAINTEXT 401.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 PLAINTEXT Body 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 PLAINTEXT Query Params 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 Body 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 Body formurlencoded 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 File Key 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 Query Params 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA1 Variable Key 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA256 200.ymltests/auth/oauth1/fixtures/collections/yml/OAuth1 RSA-SHA512 200.ymltests/auth/oauth1/oauth1.spec.ts
sid-bruno
left a comment
There was a problem hiding this comment.
LGTM, except the version concern since it isn't released yet
Description
Align with @opencollection/types 0.9.1 which renamed the OAuth1 field from signatureEncoding to signatureMethod. Update converters, filestore, and all YML test fixtures. Increase OAuth1 UI test timeouts from 30s to 60s.
Contribution Checklist:
Note: Keeping the PR small and focused helps make it easier to review and merge. If you have multiple changes you want to make, please consider submitting them as separate pull requests.
Publishing to New Package Managers
Please see here for more information.
Summary by CodeRabbit
Chores
@opencollection/typesdependency to version 0.9.1Bug Fixes
Tests