Skip to content

refactor: update Trigger.dev configuration and encryption strategy - #116

Merged
Marfuen merged 1 commit into
mainfrom
mariano/deel-import
Mar 7, 2025
Merged

Marfuen merged 1 commit into
mainfrom
mariano/deel-import

Conversation

@Marfuen

@Marfuen Marfuen commented Mar 7, 2025 •

Copy link
Copy Markdown
Contributor
  • Update trigger configs to include new trigger directories
  • Modify encryption method to use Node.js native scrypt instead of argon2
  • Remove Deel-specific tasks and update workflow to include trigger directory
  • Add SECRET_KEY to deployment workflow
  • Simplify key derivation and remove external dependency

Summary by CodeRabbit

  • Chores

    • Enhanced deployment processes by expanding change triggers and adding an extra secret for improved robustness.
    • Updated background job configurations to monitor additional directories for smoother operations.
  • Refactor

    • Optimized encryption handling by switching to a built-in synchronous method for more efficient key generation.
    • Refined access token management with clearer error reporting and improved fallback compatibility.
  • Bug Fixes

    • Corrected integration query parameters to ensure accurate scheduling.

- Update trigger configs to include new trigger directories
- Modify encryption method to use Node.js native scrypt instead of argon2
- Remove Deel-specific tasks and update workflow to include trigger directory
- Add SECRET_KEY to deployment workflow
- Simplify key derivation and remove external dependency
@vercel

vercel Bot commented Mar 7, 2025 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 2:56pm
comp-portal 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 2:56pm
web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 7, 2025 2:56pm

@coderabbitai

coderabbitai Bot commented Mar 7, 2025 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

Walkthrough

This update modifies several components across the repository. The workflow configuration now triggers on pushes affecting additional file patterns and includes an extra secret environment variable for deployment. The encryption module switches from an asynchronous Argon2-based key derivation to a synchronous scrypt-based method, updating function signatures and imports accordingly. In the Deel trigger logic, the access token retrieval now includes decryption with enhanced error handling, while a minor case sensitivity change is applied in the schedule query. Finally, the trigger configuration files are updated with added directory paths and clarifying comments.

Changes

File(s) Change Summary
.github/workflows/trigger-tasks-deploy.yml Added new path trigger **/src/trigger/** and a new environment variable SECRET_KEY for the deployment job.
apps/app/src/lib/encryption.ts Replaced the async key derivation using argon2 with a synchronous implementation using Node's built-in scryptSync; updated function signature and modified imports accordingly.
apps/app/src/trigger/deel/index.ts Updated the syncDeelEmployees logic: now checks if api_key is encrypted, attempts decryption via the decrypt function with improved error handling, and falls back to using the unencrypted value if necessary.
apps/app/src/trigger/deel/schedule.ts Modified the integration query by updating the integration_id value from "Deel" to "deel" to address case sensitivity.
apps/app/trigger.config.ts, apps/web/trigger.config.ts Updated configuration: added ./src/trigger to the directory list and inserted clarifying comments on the maxDuration properties in the respective trigger config files.

Sequence Diagram(s)

sequenceDiagram
    participant S as syncDeelEmployees
    participant C as Check API Key
    participant D as Decrypt Function
    participant E as Error Logger

    S->>C: Retrieve api_key from integration settings
    alt api_key contains "encrypted" property
        C->>D: Attempt decryption of accessToken
        alt Decryption succeeds
            D->>S: Return decrypted token
        else Decryption fails
            D->>E: Log decryption error
            E->>S: Return error & check SECRET_KEY fallback
        end
    else
        C->>S: Use api_key as plain token
    end
Loading

Poem

Hop, hop, I’m the coding bunny,
Skipping through config changes sunny.
New triggers, secrets, and scrypt in play,
Decrypting tokens in a clever way.
With each update I cheer and bound—
In this code garden, joy is found!
🐰💻🌟


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 82c25b6 and b46d138.

📒 Files selected for processing (6)
  • .github/workflows/trigger-tasks-deploy.yml (2 hunks)
  • apps/app/src/lib/encryption.ts (4 hunks)
  • apps/app/src/trigger/deel/index.ts (2 hunks)
  • apps/app/src/trigger/deel/schedule.ts (1 hunks)
  • apps/app/trigger.config.ts (1 hunks)
  • apps/web/trigger.config.ts (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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

@Marfuen
Marfuen merged commit c280a75 into main Mar 7, 2025
Marfuen added a commit that referenced this pull request Jul 15, 2026
…3411)

Fixes CodeQL js/request-forgery (alert #116, critical). callEnterpriseApi
builds `new URL(endpoint, enterpriseApiUrl)` then fetches it; getAutomationRunStatus
interpolated a user-provided runId straight into the endpoint path
(`/api/tasks-automations/runs/${runId}`), so a crafted runId could inject
path segments into the request URL.

- Encode the user value in the path (encodeURIComponent(runId)).
- Add an origin allowlist guard in callEnterpriseApi: resolve the URL against
  the configured enterprise API base and reject anything whose origin differs,
  so no caller can redirect the request to another host.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
claudfuen pushed a commit that referenced this pull request Jul 15, 2026
# [3.102.0](v3.101.2...v3.102.0) (2026-07-15)

### Bug Fixes

* **ci:** pin Syft 1.46.0 in SBOM action (1.42.3 can't parse bun.lock) ([#3415](#3415)) ([5f47024](5f47024))
* **ci:** scan bun.lock via file: input so the SBOM isn't empty ([#3414](#3414)) ([e47e6fd](e47e6fd))
* **deps:** override uuid to ^11.1.1 (Dependabot [#85](#85)) ([#3418](#3418)) ([598ff8c](598ff8c))
* **deps:** patch tmp and js-yaml in mcp-server (Dependabot [#58](https://github.com/trycompai/comp/issues/58)/[#59](https://github.com/trycompai/comp/issues/59)/[#71](https://github.com/trycompai/comp/issues/71)) ([#3412](#3412)) ([59a6b0f](59a6b0f))
* **deps:** remediate dependency security vulnerabilities ([#3403](#3403)) ([7577a37](7577a37))
* **deps:** remediate dependency security vulnerabilities (165→16, 4 critical→0) ([#3406](#3406)) ([d403e9c](d403e9c))
* **device-agent:** implement the installer-cleanup fix ([#3381](#3381)) ([0f7581b](0f7581b))
* **security:** prevent SSRF in task-automation enterprise API calls ([#3411](#3411)) ([dcec288](dcec288)), closes [#116](#116)
* **security:** resolve open CodeQL alerts (XSS, sanitization, workflow perms) ([#3419](#3419)) ([32329be](32329be)), closes [#108](#108) [js/xss-throu#dom](https://github.com/js/xss-throu/issues/dom) [#95](#95) [84/#85](#85)

### Features

* **framework-editor:** raise requirement description limit to 100,000 chars (FRAME-2) ([67c9f4a](67c9f4a))

This branch was successfully deployed

3 active deployments
Preview – app — b46d1388 Deployed Mar 7, 2025 by vercel[bot]
Preview – comp-portal — b46d1388 Deployed Mar 7, 2025 by vercel[bot]
Preview – web — b46d1388 Deployed Mar 7, 2025 by vercel[bot]
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