Skip to content

chore(release): pull main into develop post release v1.106.1 - #4565

Merged
koladilip merged 3 commits into
developfrom
main
Aug 16, 2025
Merged

koladilip merged 3 commits into
developfrom
main

Conversation

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

👑 An automated PR

@coderabbitai

coderabbitai Bot commented Aug 15, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added support for global Salesforce credentials, enabling centralized configuration via environment variables.
    • Streamlined authentication for Salesforce connections, reducing per-destination setup.
  • Refactor

    • Unified Salesforce OAuth flow to use centrally managed credentials for consistency across destinations.

Walkthrough

Adds 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

Cohort / File(s) Summary
Config surface update
src/v0/destinations/salesforce/config.js
Adds top-level constants CLIENT_ID and CLIENT_SECRET sourced from environment variables; exports them via module.exports.
OAuth utils change
src/v0/destinations/salesforce/utils.js
Imports CLIENT_ID and CLIENT_SECRET from config and replaces use of destination.Config.consumerKey/consumerSecret in OAuth token URL with the new globals.

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
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers

  • krishna2020
  • koladilip
  • sandeepdsvs
  • manish339k
  • sivashanmukh

Suggestions

  • Validate presence of CLIENT_ID/CLIENT_SECRET at startup to fail fast.
  • Add tests covering token request construction with global creds.
  • Document migration from per-destination creds to global config and any rollback path.

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 Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch main

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor Author

Allure Test reports for this run are available at:

@codecov

codecov Bot commented Aug 15, 2025 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.79%. Comparing base (7ae313f) to head (a0d4325).
⚠️ Report is 38 commits behind head on develop.

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.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot 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.

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 keys

To 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.js and the destination schema in config.js:

• In src/v0/destinations/salesforce/utils.js, replace the current authUrl block 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 under destination.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 vars

If 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 risk

Exporting 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 implications

This 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 5fba787 and a0d4325.

⛔ Files ignored due to path filters (3)
  • CHANGELOG.md is excluded by !**/*.md
  • package-lock.json is excluded by !**/package-lock.json, !**/*.json
  • package.json is 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.js
  • src/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)

@sonarqubecloud

Copy link
Copy Markdown

@koladilip
koladilip merged commit 31f8e54 into develop Aug 16, 2025
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.

4 participants