Skip to content

chore: use internal build-scan-push for security scans - #4044

Merged
vinayteki95 merged 12 commits into
developfrom
chore.github-action-build-scan-push
Apr 4, 2025
Merged

vinayteki95 merged 12 commits into
developfrom
chore.github-action-build-scan-push

Conversation

@vinayteki95

@vinayteki95 vinayteki95 commented Feb 4, 2025 •

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

We are moving to a custom docker-build-scan-push workflow which takes care of scaning the repo for secrets using trufflehog before building the image.

What is the related Linear task?

Resolves INT-3167

Please explain the objectives of your changes below

Improving security

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

No

Any new dependencies introduced with this change?

rudderlabs/docker-scan-build-push

Any new generic utility introduced or modified. Please explain the changes.

No

Any technical or performance related pointers to consider with the change?

No

@coderabbitai review


Developer checklist

  • My code follows the style guidelines of this project

  • No breaking changes are being introduced.

  • All related docs linked with the PR?

  • All changes manually tested?

  • Any documentation changes needed with this change?

  • Is the PR limited to 10 file changes?

  • Is the PR limited to one linear task?

  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?

  • Verified that there are no credentials or confidential data exposed with the changes.

Summary by CodeRabbit

  • Chores

    • Enhanced CI/CD workflows by refining permissions, execution environments, and the Docker image build process.
    • Introduced a configuration file to streamline the build process by excluding unnecessary files.
  • Tests

    • Standardized authentication headers and other test constants to improve consistency in error handling and data management.
    • Replaced specific tokens and identifiers with generic placeholders across integrations for enhanced reliability.

@vinayteki95
vinayteki95 requested a review from a team February 4, 2025 08:10
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@codecov

codecov Bot commented Feb 4, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.06%. Comparing base (3a86a75) to head (984ed33).
Report is 34 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4044   +/-   ##
========================================
  Coverage    91.06%   91.06%           
========================================
  Files          635      635           
  Lines        33172    33172           
  Branches      7832     7836    +4     
========================================
  Hits         30208    30208           
  Misses        2747     2747           
  Partials       217      217           

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

yashasvibajpai
yashasvibajpai previously approved these changes Feb 4, 2025
krishna2020
krishna2020 previously approved these changes Feb 6, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@vinayteki95
vinayteki95 dismissed stale reviews from krishna2020 and yashasvibajpai via db9492a March 5, 2025 11:11
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

2 similar comments
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

Comment thread .truffleignore Resolved
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

1 similar comment
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

ItsSudip
ItsSudip previously approved these changes Mar 13, 2025
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

1 similar comment
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@coderabbitai

coderabbitai Bot commented Mar 20, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes update the GitHub Actions workflow with new permissions, runner environment specifications, and a custom Docker build action. A new .truffleignore file has been added to streamline file processing. Multiple test files in the integrations for Emarsys, HS, OneSignal, and Refiner have been updated to replace hardcoded strings with imported constants and generic placeholders, standardizing header values, error messages, and UUIDs for improved maintainability and consistency.

Changes

File(s) Change Summary
.github/workflows/build-push-docker-image.yml Updated GitHub Actions workflow: added id-token write and contents read permissions, included ubuntu-22 in runner specs for ARM64 job, and replaced docker/[email protected] with rudderlabs/[email protected] with multi-platform parameters.
.truffleignore New file added specifying directories and patterns (e.g., Yarn, system libraries, node_modules) to ignore during Truffle operations.
test/integrations/destinations/emarsys/* Introduced constants (e.g., HEADER_BLOCK, NONCE, TIMESTAMP, TIMESTAMP_2) to replace hardcoded authentication values, update buffer initialization, and modify date mocks across constants.ts, dataDelivery, deleteUsers, network, processor, and router files.
test/integrations/destinations/hs/* Standardized error responses by replacing specific UUIDs in correlation IDs and anonymous IDs with generic placeholders in network, processor, and router files.
test/integrations/destinations/one_signal/processor/data.ts Replaced hardcoded external player ID in externalId and endpoint with a generic placeholder (external-player-id).
test/integrations/sources/refiner/data.ts Replaced specific UUIDs in uuid and formUuid fields with a generic placeholder (form-uuid).

Sequence Diagram(s)

sequenceDiagram
    participant Repo as Repository
    participant GH as GitHub Actions
    participant Env as Runner (ubuntu-22)
    participant Docker as Docker Builder
    participant Reg as Image Registry

    Repo->>GH: Trigger workflow on push event
    GH->>GH: Request OIDC (id-token write, contents read)
    GH->>Env: Set up environment (ubuntu-22 for ARM64 job)
    GH->>Docker: Execute custom build action (rudderlabs/build-scan-push-action)
    Docker->>Reg: Build and push multi-platform Docker images
Loading

Suggested reviewers

  • sivashanmukh
  • vinayteki95

Poem

Oh, I'm a rabbit, hopping with glee,
Changes in code, as clear as can be.
Constants now dance in every test and file,
Workflows sing with new permissions in style.
With placeholders and updates, we cheer and play,
Hoppy days ahead on this bright coding day!
🐰✨

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Generate unit testing code for this file.
    • 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. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

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

@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

🧹 Nitpick comments (4)
test/integrations/destinations/hs/network.ts (2)

594-598: Standardize correlationId for Rate-Limit Error Response
The error response for the rate limit condition now uses the generic placeholder 'correlation-id' instead of a hardcoded UUID. This change improves consistency and avoids exposing specific internal correlation IDs in test fixtures. Please verify that any tests comparing this value have been updated accordingly.


675-683: Standardize correlationId for Invalid API Key Error Response
The error response for an invalid API key has been updated to use the generic 'correlation-id'. This ensures a consistent error format across various error scenarios. Consider extracting this placeholder into a shared constant if it’s used across multiple test files to aid future maintenance.

.truffleignore (1)

1-6: LGTM!
The ignore entries are comprehensive and appropriately target system directories, package-management areas, and metadata files that do not require security scanning. For added clarity and future maintainability, consider including a brief header comment at the top of the file explaining its purpose (e.g., “Ignore paths for Trufflehog security scanning”).

🧰 Tools
🪛 GitHub Check: Check for formatting & lint errors

[warning] 1-1:
File ignored by default.

.github/workflows/build-push-docker-image.yml (1)

95-95: Runner Label Verification: 'ubuntu-22'
Static analysis warns that the label ubuntu-22 is not recognized by default. If this is intended as a custom label for your self-hosted runner, please update your actionlint configuration accordingly. Otherwise, consider switching to a standard label such as ubuntu-22.04 for more predictable behavior.
For example:

-    runs-on: [self-hosted, Linux, ARM64, ubuntu-22]
+    runs-on: [self-hosted, Linux, ARM64, ubuntu-22.04]
🧰 Tools
🪛 actionlint (1.7.4)

95-95: label "ubuntu-22" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0073502 and 32dd3ee94986a5e757658b6974c8d2ea76cad51c.

📒 Files selected for processing (13)
  • .github/workflows/build-push-docker-image.yml (6 hunks)
  • .truffleignore (1 hunks)
  • test/integrations/destinations/emarsys/constants.ts (1 hunks)
  • test/integrations/destinations/emarsys/dataDelivery/data.ts (1 hunks)
  • test/integrations/destinations/emarsys/deleteUsers/data.ts (1 hunks)
  • test/integrations/destinations/emarsys/network.ts (2 hunks)
  • test/integrations/destinations/emarsys/processor/data.ts (2 hunks)
  • test/integrations/destinations/emarsys/router/data.ts (7 hunks)
  • test/integrations/destinations/hs/network.ts (3 hunks)
  • test/integrations/destinations/hs/processor/data.ts (4 hunks)
  • test/integrations/destinations/hs/router/data.ts (2 hunks)
  • test/integrations/destinations/one_signal/processor/data.ts (2 hunks)
  • test/integrations/sources/refiner/data.ts (8 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
test/integrations/destinations/emarsys/router/data.ts (1)
test/integrations/destinations/emarsys/constants.ts (3) (3)
  • NONCE (3-3)
  • TIMESTAMP (4-4)
  • HEADER_BLOCK (9-9)
test/integrations/destinations/emarsys/deleteUsers/data.ts (1)
test/integrations/destinations/emarsys/constants.ts (2) (2)
  • NONCE (3-3)
  • TIMESTAMP_2 (14-14)
test/integrations/destinations/emarsys/dataDelivery/data.ts (2)
test/integrations/destinations/emarsys/network.ts (2) (2)
  • headerBlockWithCorrectAccessToken (3-7)
  • headerBlockWithWrongAccessToken (9-13)
test/integrations/destinations/emarsys/constants.ts (2) (2)
  • HEADER_BLOCK (9-9)
  • WRONG_HEADER_BLOCK (12-12)
test/integrations/destinations/emarsys/network.ts (2)
test/integrations/destinations/emarsys/dataDelivery/data.ts (2) (2)
  • headerBlockWithCorrectAccessToken (6-10)
  • headerBlockWithWrongAccessToken (12-16)
test/integrations/destinations/emarsys/constants.ts (3) (3)
  • HEADER_BLOCK (9-9)
  • WRONG_HEADER_BLOCK (12-12)
  • COMMON_HEADER_BLOCK (16-16)
🪛 GitHub Check: Check for formatting & lint errors
.truffleignore

[warning] 1-1:
File ignored by default.

🪛 actionlint (1.7.4)
.github/workflows/build-push-docker-image.yml

95-95: label "ubuntu-22" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Code Coverage
  • GitHub Check: test_and_publish
  • GitHub Check: UT Tests
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (26)
test/integrations/destinations/hs/router/data.ts (2)

3498-3505: Standardization of correlation IDs in error responses is a good practice.

Replacing specific UUIDs with a generic placeholder "correlation-id" improves test maintainability and consistency across the codebase, making the tests more robust against changes in actual API responses.


3557-3564: Consistency maintained across multiple error response objects.

The same correlation ID standardization has been applied here as well, ensuring all error responses follow the same pattern, which is a good practice for maintainable tests.

test/integrations/destinations/hs/processor/data.ts (5)

834-835: Standardized correlation ID in error message.

The change replaces a specific UUID with a generic placeholder "correlation-id" in the error message, enhancing consistency and removing potential sensitive information from test data.


947-947: Standardized correlation ID in error message.

Similar to the previous change, this one replaces a specific correlation ID with a generic placeholder for consistency across error messages.


4814-4814: Standardized correlation ID in error message.

Consistent with other changes, replaced a specific correlation ID with the generic placeholder "correlation-id" in the rate limit error message.


4876-4877: Standardized anonymousId value.

Replaced a specific identifier with the generic placeholder "anonymous-id" for improved consistency and security in test data.


4883-4883: Standardized anonymousId value.

Replaced another specific anonymousId with the generic placeholder "anonymous-id", maintaining consistency with the other standardization changes.

.github/workflows/build-push-docker-image.yml (5)

39-42: Permissions Block Configured Correctly
The new permissions for id-token (write) and contents (read) are set correctly, ensuring the workflow can request the OIDC JWT and properly checkout the repository contents.


113-123: Custom Docker Build Action for ARM64
The transition to rudderlabs/[email protected] aligns well with the PR’s objective to integrate internal security scans. The parameters (including push: true and the specified platform) look appropriate. Please verify that these settings meet all desired build and scan requirements.


133-142: Multi-platform Image Build Step for ARM64
The multi-platform build step utilizing the custom action is correctly configured. Ensure that the build arguments and tagging conventions integrate smoothly with your downstream deployment processes.


169-177: Custom Docker Build Action for AMD64
The AMD64 build step mirrors the ARM64 configuration and appropriately employs the updated custom action. This change supports the enhanced security scanning workflow while maintaining consistency across architectures.


190-197: Multi-platform Build Step for AMD64
The multi-platform section for the AMD64 build is clear and consistent with its ARM64 counterpart. The use of the custom action here further solidifies adherence to the improved build-scan-push process.

test/integrations/sources/refiner/data.ts (1)

95-95: Good refactoring to use consistent placeholder values instead of UUIDs.

Using the standardized 'form-uuid' placeholder across all instances of form UUIDs in the test data improves maintainability and makes the test's intent clearer. This approach makes it easier to understand the relationship between related fields without relying on specific UUID values.

Also applies to: 149-149, 165-165, 183-183, 311-311, 372-372, 385-385, 403-403

test/integrations/destinations/one_signal/processor/data.ts (1)

557-557: Good standardization of player ID placeholder.

Replacing the hardcoded UUID ('85be324d-6dab-4293-ad1f-42199d4c455b') with the descriptive placeholder 'external-player-id' in both the external ID definition and API endpoint URL improves test readability and maintainability.

Also applies to: 601-601

test/integrations/destinations/emarsys/router/data.ts (3)

2-3: Good modularization using imported constants.

Importing shared constants from a dedicated constants file is a good practice that improves maintainability by centralizing values used across multiple test files.


53-53: Improved test reliability with standardized constants.

Using the imported constants for NONCE and mocked timestamps ensures consistent test behavior and makes maintenance easier when these values need to be updated.

Also applies to: 57-57


427-427: Good refactoring of header values to use constants.

Replacing all instances of the hardcoded X-WSSE header with the imported HEADER_BLOCK constant improves consistency and reduces duplication across the codebase. This centralization makes it easier to update authentication headers if needed.

Also applies to: 475-475, 517-517, 552-552, 616-616

test/integrations/destinations/emarsys/processor/data.ts (2)

3-4: Good modularization using imported constants.

Importing shared constants (NONCE, COMMON_HEADER_BLOCK, TIMESTAMP_2) and using them for Buffer initialization improves code maintainability by centralizing important values.


8-8: Improved consistency by using constants for date mocking and headers.

Using the imported constants for mocked timestamps and the X-WSSE header ensures consistent behavior across tests and makes it easier to update these values when needed.

Also applies to: 17-17

test/integrations/destinations/emarsys/network.ts (2)

1-1: Good refactoring: Using imported constants instead of hardcoded values

Importing the header block constants from a centralized location improves maintainability and consistency across the codebase.


6-6: Excellent improvement: Replacing hardcoded X-WSSE header values with constants

Replacing the hardcoded X-WSSE header values with imported constants from the central constants file eliminates duplication and makes future updates easier and less error-prone. This is aligned with the DRY principle.

Also applies to: 12-12, 99-99

test/integrations/destinations/emarsys/dataDelivery/data.ts (2)

4-5: Good practice: Importing constants from a centralized location

Importing authentication constants from a central location is a good practice that promotes consistency and maintainability.


9-9: Well done: Using standardized header values

Replacing hardcoded authentication headers with centralized constants ensures consistency across all test files and makes future updates easier.

Also applies to: 15-15

test/integrations/destinations/emarsys/deleteUsers/data.ts (2)

2-3: Good refactoring: Using predefined constants for test values

Importing and using the NONCE constant for the buffer initialization enhances consistency and maintainability by centralizing these values.


6-6: Good practice: Using centralized timestamp constant in mocks

Using the TIMESTAMP_2 constant for mocking the Date.prototype.toISOString method ensures consistency with other tests using the same timestamp value.

test/integrations/destinations/emarsys/constants.ts (1)

1-17:

Details

❓ Verification inconclusive

Well-structured constants file with good organization

This new constants file effectively centralizes authentication-related values used across multiple test files. The organization is logical, with basic constants declared first, followed by derived values.

The file appropriately:

  • Imports the required utility function
  • Defines base constants (NONCE, TIMESTAMP, USERNAME, SECRET)
  • Creates derived constants using the base64Sha function
  • Follows consistent naming conventions

This refactoring will make maintenance easier and reduce duplication across test files.


🌐 Web query:

What are best practices for managing test credentials in TypeScript projects?

💡 Result:

When managing test credentials in TypeScript projects, prioritizing security while maintaining accessibility for testing workflows is critical. Below are key best practices informed by industry standards and security-focused development patterns:

Avoid Hardcoding Credentials

  • Never store credentials in source code (as shown in vulnerable code examples where username and password were hardcoded) [1][8].
  • Use environment variables (e.g., process.env.USERNAME) to decouple sensitive data from code [1][5][16]. Configure .env files with dotenv for local development [5][16].

Secure Storage and Retrieval

  • Leverage secret management tools:
    • Use Azure Key Vault or AWS Secrets Manager for automation workflows to securely store and retrieve credentials [13].
    • For CI/CD pipelines, integrate with platform-native secret storage (e.g., GitHub Secrets, GitLab CI variables).
  • Encrypt sensitive data: Hash passwords with libraries like bcryptjs before storage [5][8].

Testing-Specific Practices

  • Isolate test credentials:
    • Use separate accounts/credentials for automated tests vs. manual testing to prevent interference [13].
    • Mock authentication flows in unit tests to avoid exposing real credentials [4][12].
  • Validate credential integrity:
    • Write tests to ensure weak passwords are rejected (e.g., using Zod schema validation) [14][17].
    • Verify secure transmission (HTTPS) and storage (hashed) of credentials in integration tests [14].

TypeScript-Specific Safeguards

  • Enforce type safety:
    interface TestCredentials {
      username: string;
      password: string;
    }
    Use strict interfaces to validate credential shapes at compile time [17].
  • Enable strict compiler flags:
    {
      "compilerOptions": {
        "strict": true,
        "strictNullChecks": true
      }
    }
    Prevent null/undefined credential values from slipping through [2][6].

Credential Lifecycle Management

  • Rotate credentials regularly: Automate rotation for test accounts using tools like HashiCorp Vault [13][17].
  • Audit access: Restrict test credential permissions to minimize blast radius if compromised [13].

By combining environment variables, secret managers, type-safe validation, and isolated testing workflows, teams can balance security and practicality. This approach aligns with fixes demonstrated in code samples that replaced hardcoded credentials with secure retrieval mechanisms [1][8][16].

Citations:


Review Update: Maintainable Structure with Credential Security Consideration

The constants file is well-organized—centralizing base values and computed derived constants in a clear, maintainable manner. The logical ordering and consistent naming enhance readability and reduce duplication across tests.

However, in light of industry best practices for test credential management, please verify that:

  • The hardcoded dummy credentials (e.g., "dummy", "dummy2") remain strictly for testing purposes and do not risk confusing production data.
  • As the trend shifts toward never hardcoding even test credentials, consider externalizing sensitive information (using environment variables or a secure secrets manager) if these values evolve or if similar patterns are replicated elsewhere.

Overall, this refactoring is solid, but double-check that our testing workflows properly isolate these constants from production configurations.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

1 similar comment
@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@krishna2020
krishna2020 force-pushed the chore.github-action-build-scan-push branch from d12c27b to 984ed33 Compare March 27, 2025 06:19

@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: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 32dd3ee94986a5e757658b6974c8d2ea76cad51c and 984ed33.

📒 Files selected for processing (13)
  • .github/workflows/build-push-docker-image.yml (6 hunks)
  • .truffleignore (1 hunks)
  • test/integrations/destinations/emarsys/constants.ts (1 hunks)
  • test/integrations/destinations/emarsys/dataDelivery/data.ts (1 hunks)
  • test/integrations/destinations/emarsys/deleteUsers/data.ts (1 hunks)
  • test/integrations/destinations/emarsys/network.ts (2 hunks)
  • test/integrations/destinations/emarsys/processor/data.ts (2 hunks)
  • test/integrations/destinations/emarsys/router/data.ts (7 hunks)
  • test/integrations/destinations/hs/network.ts (3 hunks)
  • test/integrations/destinations/hs/processor/data.ts (4 hunks)
  • test/integrations/destinations/hs/router/data.ts (2 hunks)
  • test/integrations/destinations/one_signal/processor/data.ts (2 hunks)
  • test/integrations/sources/refiner/data.ts (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • test/integrations/destinations/emarsys/router/data.ts
  • test/integrations/destinations/emarsys/dataDelivery/data.ts
  • test/integrations/destinations/emarsys/network.ts
  • test/integrations/destinations/emarsys/deleteUsers/data.ts
  • test/integrations/destinations/hs/network.ts
  • test/integrations/destinations/one_signal/processor/data.ts
  • test/integrations/destinations/emarsys/constants.ts
  • test/integrations/destinations/hs/processor/data.ts
  • test/integrations/sources/refiner/data.ts
  • test/integrations/destinations/hs/router/data.ts
🧰 Additional context used
🧬 Code Definitions (1)
test/integrations/destinations/emarsys/processor/data.ts (1)
test/integrations/destinations/emarsys/constants.ts (3)
  • NONCE (3-3)
  • TIMESTAMP_2 (14-14)
  • COMMON_HEADER_BLOCK (16-16)
🪛 actionlint (1.7.4)
.github/workflows/build-push-docker-image.yml

95-95: label "ubuntu-22" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

🪛 GitHub Check: Check for formatting & lint errors
.truffleignore

[warning] 1-1:
File ignored by default.

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: Build Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image AMD64
  • GitHub Check: Build User Transformer Docker Image - PR / Build Transformer Docker Image ARM64
  • GitHub Check: Code Coverage
  • GitHub Check: ingestion-service-test
  • GitHub Check: test_and_publish
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (9)
test/integrations/destinations/emarsys/processor/data.ts (3)

3-4: Clean refactoring: Using imported constants instead of hardcoded values

Replacing the hardcoded hex string with the imported NONCE constant improves maintainability and consistency across the codebase.


8-8: Good practice: Using standardized timestamp constant

Using the imported TIMESTAMP_2 constant for mocking the Date.prototype.toISOString return value ensures consistency in tests and makes it easier to update the timestamp value across multiple test files if needed.


17-17: Improved maintainability: Using common header block constant

Replacing the hardcoded header string with the imported COMMON_HEADER_BLOCK constant is a good refactoring that centralizes authentication header formatting, making it consistent across all Emarsys integration test files.

.truffleignore (1)

1-6: LGTM: Appropriate ignore patterns for Trufflehog.

This configuration correctly excludes system directories, package management paths, and node_modules from Trufflehog secret scanning, which will help reduce false positives while still ensuring proper security scanning of relevant application code.

🧰 Tools
🪛 GitHub Check: Check for formatting & lint errors

[warning] 1-1:
File ignored by default.

.github/workflows/build-push-docker-image.yml (5)

39-41: LGTM: Appropriate permissions for OIDC integration.

The added permissions provide the minimal required access for:

  • JWT token generation from GitHub's OIDC provider
  • Repository content access for the checkout action

These permissions are essential for the security scanning workflow.


114-124: LGTM: Enhanced security with custom build-scan-push action.

The switch to rudderlabs/[email protected] implements the security scanning with Trufflehog as mentioned in the PR objectives. The addition of push: true and platform specification is necessary for cosign functionality to work properly.


134-143: LGTM: Consistent usage of build-scan-push action.

The same custom action is correctly applied to the multi-platform build step for ARM64.


170-180: LGTM: Consistent implementation for AMD64 builds.

The security scanning implementation is consistently applied to the AMD64 build process, maintaining parity with the ARM64 configuration.


190-203: LGTM: Consistent usage of build-scan-push action.

The custom action is correctly applied to the multi-platform build step for AMD64 as well.

@devops-github-rudderstack

Copy link
Copy Markdown
Contributor

Allure Test reports for this run are available at:

@sonarqubecloud

Copy link
Copy Markdown

@vinayteki95
vinayteki95 merged commit 960a49e into develop Apr 4, 2025
@vinayteki95
vinayteki95 deleted the chore.github-action-build-scan-push branch April 4, 2025 03:18
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.

5 participants