Skip to content

Test br 30jul - #18

Closed
cb-gaganbankey wants to merge 6 commits into
mainfrom
test-br-30jul
Closed

Test br 30jul#18
cb-gaganbankey wants to merge 6 commits into
mainfrom
test-br-30jul

Conversation

@cb-gaganbankey

@cb-gaganbankey cb-gaganbankey commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

CHANGELOG

REPLACE_ME_WITH_CHANGELOG

SUMMARY

REPLACE_ME_WITH_SUMMARY_OF_THE_CHANGES

FUNCTIONAL AUTOMATION CHANGES PR

  • Yes
    • If Yes, PR :
  • No
    • If No, Reason:

AUTOMATION TEST REPORT URL

REPLACE_ME_WITH_TEST_REPORT_URL

AREAS OF IMPACT

REPLACE_ME_WITH_AREAS_OF_IMPACT_OR_NA

TYPE OF CHANGE

  • 🐞 Bugfix
  • 🌟 Feature
  • ✨ Enhancement
  • 🧪 Unit Test Cases
  • 📔 Documentation
  • ⚙️ Chore - Build Related / Configuration / Others

DOCUMENTATION

REPLACE_ME_WITH_DOCUMENTATION_LINK_OR_NA

Replaced the reusable secret-scanning workflow with Gitleaks using default rules, removed PR lint and size-check workflows, updated sample app configuration and manifests, and added test secret values and logging for secret-detection validation.

@snyk-io

snyk-io Bot commented Jul 30, 2026

Copy link
Copy Markdown

Snyk checks have failed. 2 issues have been found so far.

Status Scan Engine Critical High Medium Low Total (2)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues
Secrets 0 2 0 0 2 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

# Only these three variables are supported. Replace values for local development only. Do not add new vars.
CB_APPS_READ_ONLY_API=REPLACE_WITH_READ_ONLY_API_KEY
CB_APPS_READ_WRITE_API=REPLACE_WITH_READ_WRITE_API_KEY
CB_APPS_READ_WRITE_API=324_dqwefqw-FDQEFQ_DFQWEF

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 Gitleaks has detected a secret with rule-id generic-api-key in commit f887cb4.
If this secret is a true positive, please rotate the secret ASAP.

If this secret is a false positive, you can add the fingerprint below to your .gitleaksignore file and commit the change to this branch.

echo f887cb4afff587319b43379e9362d30b309131ec:sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/.env:generic-api-key:3 >> .gitleaksignore

# Only these three variables are supported. Replace values for local development only. Do not add new vars.
CB_APPS_READ_ONLY_API=REPLACE_WITH_READ_ONLY_API_KEY
CB_APPS_READ_WRITE_API=REPLACE_WITH_READ_WRITE_API_KEY
CB_APPS_READ_WRITE_API=324_dqwefqw-FDQEFQ_DFQWE

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛑 Gitleaks has detected a secret with rule-id generic-api-key in commit 14cb783.
If this secret is a true positive, please rotate the secret ASAP.

If this secret is a false positive, you can add the fingerprint below to your .gitleaksignore file and commit the change to this branch.

echo 14cb78365fe51a7cd1707654d3a7038a902ca0cc:sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/.env:generic-api-key:3 >> .gitleaksignore

if (!site || !apiKey) {
throw new Error('Missing CB_APPS_SITE_DOMAIN or CB_APPS_READ_WRITE_API');
}
console.log("secret", "token_952f2d2-4321-4fe9-b9f4-895f67428e16");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Detected a generic secret, which could lead to unauthorized access and sensitive data exposure.

⚠️ 1 location in this file

CWE-798: Generic Secret Key | Learn more about this vulnerability

Details and remediation

Why this is dangerous

Attackers can discover hardcoded credentials in source code to gain unauthorized access, escalate privileges, steal data, or disrupt services. If you reuse credentials across systems or environments, the impact increases.

Immediate action

  • Treat hardcoded credentials as compromised.
  • Remove the credentials from the code.
  • Rotate or revoke the credential and update all affected systems.
  • Store the new secret in a secrets manager or vault, or inject the secret using environment variables at runtime.

Preventing future exposure

  • Do not hardcode secrets.
  • Use pre-commit hooks and automated secrets scanning to prevent accidental commits.
  • Use secrets management tools, such as vaulting, environment injection, or secure configuration.
  • Use least-privilege credentials and strong salted hashes for stored passwords.
  • Add secure authentication practices to the development workflow.

You can view, fix, and ignore this issue in the Snyk Web UI

"crm_integration": {
"crm_webhook_url": "https://api.hubapi.com/crm/v3/objects/contacts",
"crm_auth_token": "REPLACE_WITH_YOUR_HUBSPOT_PRIVATE_APP_TOKEN"
"secret": "token_952f2d2-4321-4fe9-b9f4-895f67428e16"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Detected a generic secret, which could lead to unauthorized access and sensitive data exposure.

⚠️ 1 location in this file

CWE-798: Generic Secret Key | Learn more about this vulnerability

Details and remediation

Why this is dangerous

Attackers can discover hardcoded credentials in source code to gain unauthorized access, escalate privileges, steal data, or disrupt services. If you reuse credentials across systems or environments, the impact increases.

Immediate action

  • Treat hardcoded credentials as compromised.
  • Remove the credentials from the code.
  • Rotate or revoke the credential and update all affected systems.
  • Store the new secret in a secrets manager or vault, or inject the secret using environment variables at runtime.

Preventing future exposure

  • Do not hardcode secrets.
  • Use pre-commit hooks and automated secrets scanning to prevent accidental commits.
  • Use secrets management tools, such as vaulting, environment injection, or secure configuration.
  • Use least-privilege credentials and strong salted hashes for stored passwords.
  • Add secure authentication practices to the development workflow.

You can view, fix, and ignore this issue in the Snyk Web UI

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR replaces reusable secret scanning with an inline Gitleaks job, removes PR lint and size-check workflows, updates Gitleaks rules, and modifies sample app credentials, manifests, environment configuration, and client logging.

Changes

CI security and PR automation

Layer / File(s) Summary
Inline Gitleaks scanning pipeline
.github/workflows/pr-gitleaks.yml, .gitleaks.toml
The pull request scan now runs checkout, changed-file discovery through the GitHub API, and gitleaks/gitleaks-action@v2; the config enables the default ruleset.
Removed PR checks
.github/workflows/pr-lint.js, .github/workflows/pr-lint.yml, .github/workflows/pr-size-check.yml
The PR lint Dangerfile and shared PR lint and size-check workflow definitions are removed.

Sample app configuration

Layer / File(s) Summary
Sample credentials and runtime configuration
sample-apps/sample-apps-with-iparams/...
Local CRM and API configuration values are changed, and the invoice app manifest adds app metadata, a pinned Chargebee dependency, and a subscription_created handler mapping.
Client logging
sample-apps/sample-apps-without-iparams/.../chargebeeClient.js
createChargebeeClient logs a hardcoded token after input validation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 1
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-gitleaks.yml:
- Around line 23-27: Upgrade the workflow action versions in the PR gitleaks
job: change gitleaks/gitleaks-action from v2 to v3 and actions/checkout from v4
to v6, preserving the existing fetch-depth setting and workflow behavior.
- Around line 7-10: Add a job-level permissions block to the scan job alongside
runs-on, granting contents: read and pull-requests: write for
gitleaks/gitleaks-action@v2's PR comment behavior. If PR comments are disabled,
grant pull-requests: read instead.

In
`@sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/iparams.local.json`:
- Line 4: Remove the hardcoded secret from the tracked iparams configuration,
revoke and rotate the exposed token across the related .env and
chargebeeClient.js usages, then reference ignored local configuration or the
established secret manager instead. Ensure no copy of the credential remains
committed.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 427a344b-2b8c-4006-afa2-b1b14f4b39ac

📥 Commits

Reviewing files that changed from the base of the PR and between 862a50f and 14cb783.

📒 Files selected for processing (9)
  • .github/workflows/pr-gitleaks.yml
  • .github/workflows/pr-lint.js
  • .github/workflows/pr-lint.yml
  • .github/workflows/pr-size-check.yml
  • .gitleaks.toml
  • sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/iparams.local.json
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/.env
  • sample-apps/sample-apps-with-iparams/schedule_advance_invoice_sample_app/manifest.json
  • sample-apps/sample-apps-without-iparams/dunning_cycle_end_handler_sample_app/handler/chargebeeClient.js
💤 Files with no reviewable changes (3)
  • .github/workflows/pr-lint.yml
  • .github/workflows/pr-lint.js
  • .github/workflows/pr-size-check.yml

Comment on lines 7 to +10
jobs:
SecretScanning:
uses: chargebee/cb-secrets-scanner/.github/workflows/cb-secret-scan.yml@main
secrets: inherit No newline at end of file
scan:
name: Secret PR Scan
runs-on: ubuntu-latest

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,120p' .github/workflows/pr-gitleaks.yml | cat -n

Repository: chargebee/cb-marketplace-sample-app

Length of output: 1418


🌐 Web query:

GitHub Actions GITHUB_TOKEN pull request files endpoint permissions pull-requests read write gitleaks-action PR comments GITHUB_TOKEN

💡 Result:

To access the GitHub API endpoints required for listing pull request files or posting pull request comments using the GITHUB_TOKEN, you must configure the permissions key within your GitHub Actions workflow file [1][2][3]. The GITHUB_TOKEN is a scoped, temporary token provided automatically by GitHub Actions [4][3]. By default, its permissions may be restricted depending on repository or organization settings [5][3]. To perform operations like interacting with pull requests, you must explicitly grant the necessary permissions in your workflow configuration [1][3]. For gitleaks-action and similar tools that need to comment on pull requests and analyze changed files, the following permissions are typically required: permissions: contents: read pull-requests: write The contents: read permission allows the action to access the repository code and commit history [2]. The pull-requests: write permission is required for the action to create or update comments on a pull request [2][6][7]. If you encounter a "Resource not accessible by integration" error, it is almost always due to insufficient permissions granted to the GITHUB_TOKEN for that specific job [6][7]. You can define these permissions at the job or workflow level to follow the principle of least privilege [1][3]: jobs: scan: runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - uses: actions/checkout@v4 - uses: gitleaks/gitleaks-action@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} If your repository settings are configured for "Restricted" workflow permissions, the GITHUB_TOKEN may be limited to read-only access by default [5]. Modifying the permissions key in your YAML file is the recommended way to escalate these privileges securely for specific tasks [1][3]. For actions that need to write statuses or other security-related data, you might also require security-events: write or checks: write [2][7].

Citations:


🌐 Web query:

gitleaks/gitleaks-action default pull request comments permissions pull-requests write read

💡 Result:

To use gitleaks/gitleaks-action with pull request commenting enabled, you must explicitly grant the pull-requests: write permission in your GitHub Actions workflow configuration [1][2][3]. By default, the GITHUB_TOKEN provided to a GitHub Action has restricted permissions that often prevent it from interacting with the Pull Request API [2][4]. Specifically, gitleaks-action requires these permissions for two primary reasons: 1. Listing PR Commits: To perform effective scans, the action needs to call the GitHub API to identify the commits associated with a pull request. Without explicit permissions, especially in private repositories, this call frequently fails with a 403 Forbidden error [2][4][5]. 2. Posting Comments: If Gitleaks detects a secret, it uses the GITHUB_TOKEN to automatically post a comment on the pull request. This functionality requires write access to the pull request [1][3][6]. To configure this, update your workflow YAML file to include the necessary permissions block: jobs: scan: runs-on: ubuntu-latest permissions: contents: read pull-requests: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: gitleaks/gitleaks-action@v3 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} Note that pull-requests: write is the minimum requirement for commenting [1][3]. If you choose to disable this feature by setting GITLEAKS_ENABLE_COMMENTS to false, you may be able to reduce the required permissions, though read access is still necessary for the action to function correctly during PR-based scans [7][2][5].

Citations:


🌐 Web query:

gitleaks/gitleaks-action v2 GITLEAKS_ENABLE_COMMENTS default comments enabled

💡 Result:

In the gitleaks/gitleaks-action version 2, the GITLEAKS_ENABLE_COMMENTS environment variable defaults to true [1][2][3]. This setting enables the action to automatically post comments on pull requests when secrets are detected [2][4][5]. To disable this feature, you must explicitly set the variable to false in your workflow configuration [1][6][7].

Citations:


Add a job-level permissions block here. gitleaks/gitleaks-action@v2 posts PR comments by default, so use contents: read and pull-requests: write if that behavior stays on; only drop to pull-requests: read if you also disable comments.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-gitleaks.yml around lines 7 - 10, Add a job-level
permissions block to the scan job alongside runs-on, granting contents: read and
pull-requests: write for gitleaks/gitleaks-action@v2's PR comment behavior. If
PR comments are disabled, grant pull-requests: read instead.

Sources: Path instructions, Linters/SAST tools

Comment on lines +23 to +27
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: gitleaks/gitleaks-action@v2

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

Upgrade the Node 20 actions before merging.

gitleaks/gitleaks-action@v2 now requires an insecure Node 20 opt-out after June 2, 2026 and will stop working when Node 20 is removed. The official migration path is Gitleaks v3 with actions/checkout@v6; otherwise this security workflow can fail on current runners. (github.com)

Proposed fix
-      - uses: actions/checkout@v4
+      - uses: actions/checkout@v6
...
-      - uses: gitleaks/gitleaks-action@v2
+      - uses: gitleaks/gitleaks-action@v3

As per path instructions, this is a merge-blocking runtime failure.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v2
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: gitleaks/gitleaks-action@v3
🧰 Tools
🪛 zizmor (1.28.0)

[warning] 23-25: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-gitleaks.yml around lines 23 - 27, Upgrade the workflow
action versions in the PR gitleaks job: change gitleaks/gitleaks-action from v2
to v3 and actions/checkout from v4 to v6, preserving the existing fetch-depth
setting and workflow behavior.

"crm_integration": {
"crm_webhook_url": "https://api.hubapi.com/crm/v3/objects/contacts",
"crm_auth_token": "REPLACE_WITH_YOUR_HUBSPOT_PRIVATE_APP_TOKEN"
"secret": "token_952f2d2-4321-4fe9-b9f4-895f67428e16"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Remove and rotate the committed credentials before merging.

This token is hardcoded in tracked configuration; another API token is committed in .env, and the same token is emitted by chargebeeClient.js. Treat them as compromised, revoke/rotate them, and use ignored local configuration or a secret manager instead.

As per path instructions, repeated secret exposures are consolidated into this blocker.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@sample-apps/sample-apps-with-iparams/crm_lead_on_customer_created_sample_app/iparams.local.json`
at line 4, Remove the hardcoded secret from the tracked iparams configuration,
revoke and rotate the exposed token across the related .env and
chargebeeClient.js usages, then reference ignored local configuration or the
established secret manager instead. Ensure no copy of the credential remains
committed.

Source: Path instructions

@cb-gaganbankey
cb-gaganbankey deleted the test-br-30jul branch July 30, 2026 17:24
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