Skip to content

fix: prevent redactString RangeError and redactNumber NaN#3717

Closed
Abhishek01samal wants to merge 1 commit into
triggerdotdev:mainfrom
Abhishek01samal:fix-redact-crash
Closed

fix: prevent redactString RangeError and redactNumber NaN#3717
Abhishek01samal wants to merge 1 commit into
triggerdotdev:mainfrom
Abhishek01samal:fix-redact-crash

Conversation

@Abhishek01samal
Copy link
Copy Markdown

Summary

Fixes two bugs in redactString / redactNumber in util.ts:

  1. redactString crashes with RangeError when value.length < end
  2. redactNumber returned NaN because Number("12345*****") is invalid

Changes

  • Added Math.max(0, ...) safeguard to prevent negative repeat counts
  • Changed redactNumber to return the redacted string directly

Testing

Tested with:

redactString("abc")
redactNumber(42)
redactNumber(12345678901)

Verified:

  • No RangeError
  • No NaN output
  • Proper redaction behavior

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 23, 2026

⚠️ No Changeset found

Latest commit: 1eb53f4

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

Hi @Abhishek01samal, thanks for your interest in contributing!

This project requires that pull request authors are vouched, and you are not in the list of vouched users.

This PR will be closed automatically. See https://github.com/triggerdotdev/trigger.dev/blob/main/CONTRIBUTING.md for more details.

@github-actions github-actions Bot closed this May 23, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 23, 2026

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 52c3cc9a-4383-4354-86a1-cc5d85929c9f

📥 Commits

Reviewing files that changed from the base of the PR and between 61ca40b and 1eb53f4.

📒 Files selected for processing (1)
  • packages/core/src/v3/runEngineWorker/supervisor/util.ts

Walkthrough

This pull request updates the redaction utilities in packages/core/src/v3/runEngineWorker/supervisor/util.ts. The redactString function now guards against negative masked-character repeat counts by clamping the computation with Math.max(0, ...). The redactNumber function was changed to return the redacted string produced by redactString instead of converting the result back to a Number, which changes how numeric fields are represented when object properties are redacted.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with 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.

❤️ Share

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

Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread packages/core/src/v3/runEngineWorker/supervisor/util.ts
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