Repository navigation
Conversation
Summary by CodeRabbit
WalkthroughAdds global Salesforce OAuth credentials CLIENT_ID and CLIENT_SECRET to config and switches utils token request to use these constants instead of per-destination credentials. No other logic, error handling, or control flow changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Caller as Auth Flow (utils.js)
participant Config as Salesforce Config
participant SF as Salesforce Token Endpoint
Caller->>Config: Read CLIENT_ID, CLIENT_SECRET
Caller->>SF: POST /token with CLIENT_ID, CLIENT_SECRET, grant_type=password
SF-->>Caller: Access token / error
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Suggested reviewers
Suggestions
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
Allure Test reports for this run are available at:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #4565 +/- ##
===========================================
+ Coverage 91.63% 91.79% +0.16%
===========================================
Files 643 642 -1
Lines 34020 33889 -131
Branches 8048 8028 -20
===========================================
- Hits 31174 31110 -64
+ Misses 2588 2527 -61
+ Partials 258 252 -6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
src/v0/destinations/salesforce/utils.js (1)
178-183: Add proper encoding and fallback for Salesforce auth params, and define fallback config keysTo prevent unencoded secrets from breaking when they contain special characters—and to support existing per-destination credentials—please update both the URL builder in
utils.jsand the destination schema inconfig.js:• In
src/v0/destinations/salesforce/utils.js, replace the currentauthUrlblock with:const clientId = CLIENT_ID || destination.Config.consumerKey; const clientSecret = CLIENT_SECRET || destination.Config.consumerSecret; if (!clientId || !clientSecret) { throw new AbortedError( 'Missing Salesforce connected app credentials. ' + 'Set SALESFORCE_CLIENT_ID/SALESFORCE_CLIENT_SECRET or ' + 'consumerKey/consumerSecret in destination config.' ); } const authUrl = `${SF_TOKEN_URL}?username=${encodeURIComponent(destination.Config.userName)}` + `&password=${encodeURIComponent(destination.Config.password)}` + `${encodeURIComponent(destination.Config.initialAccessToken || '')}` + `&client_id=${encodeURIComponent(clientId)}` + `&client_secret=${encodeURIComponent(clientSecret)}` + `&grant_type=password`; const { httpResponse, processedResponse } = await handleHttpRequest( authUrl, /* … */ );• In
src/v0/destinations/salesforce/config.js, add the optional fallback fields so they’re available underdestination.Config:// inside your mapping/schema definition consumerKey: { label: 'Connected App Consumer Key', type: 'string', required: false }, consumerSecret: { label: 'Connected App Consumer Secret', type: 'string', required: false, sensitive: true },• Update your destination documentation to note that credentials can come from either ENV vars or these new config properties.
These changes will ensure all query params are safely URL-encoded and that we remain backward-compatible with existing per-destination settings.
🧹 Nitpick comments (3)
src/v0/destinations/salesforce/config.js (2)
7-9: Global Salesforce client credentials: add guardrails for missing env varsIf these env vars aren’t set, downstream token requests will silently send client_id/client_secret=undefined and receive 400s. Consider trimming and validating here, or at least in the caller, to fail fast with a clear config error.
Would you like me to add a small helper that validates presence and provides a concise AbortedError when unset?
-const CLIENT_ID = process.env.SALESFORCE_CLIENT_ID; -const CLIENT_SECRET = process.env.SALESFORCE_CLIENT_SECRET; +const CLIENT_ID = process.env.SALESFORCE_CLIENT_ID?.trim(); +const CLIENT_SECRET = process.env.SALESFORCE_CLIENT_SECRET?.trim();
36-38: Avoid accidental leakage: exporting secrets via shared config increases logging riskExporting CLIENT_SECRET alongside other config increases the chance it gets logged if the whole object is printed. Consider exporting accessor functions or a dedicated credentials object that your logging filters can reliably redact.
I can refactor to export getters like getSalesforceClientId()/getSalesforceClientSecret() and update call sites.
src/v0/destinations/salesforce/utils.js (1)
16-18: Switch to global CLIENT_ID/CLIENT_SECRET — verify rollout and multi-tenant implicationsThis removes per-destination consumerKey/consumerSecret and depends on env-wide credentials. Confirm:
- All deployments set SALESFORCE_CLIENT_ID/SALESFORCE_CLIENT_SECRET.
- No tenants require different connected apps (e.g., sandbox vs prod, or customer-specific apps).
If either is a concern, fall back to per-destination keys when env vars are absent (see next comment).
I can add a guarded fallback and a telemetry log for visibility.
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
⛔ Files ignored due to path filters (3)
CHANGELOG.mdis excluded by!**/*.mdpackage-lock.jsonis excluded by!**/package-lock.json,!**/*.jsonpackage.jsonis excluded by!**/*.json
📒 Files selected for processing (2)
src/v0/destinations/salesforce/config.js(2 hunks)src/v0/destinations/salesforce/utils.js(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.js
⚙️ CodeRabbit Configuration File
Focus on ESLint errors (max 3) and warnings (max 5).
Files:
src/v0/destinations/salesforce/utils.jssrc/v0/destinations/salesforce/config.js
🧬 Code Graph Analysis (1)
src/v0/destinations/salesforce/utils.js (1)
src/v0/destinations/salesforce/config.js (2)
CLIENT_ID(7-7)CLIENT_SECRET(8-8)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
- GitHub Check: Code Coverage
- GitHub Check: UT Tests
- GitHub Check: test_and_publish
- GitHub Check: Analyze (go)
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Analyze (javascript-typescript)
|



👑 An automated PR