Skip to content

v0.5.49: hitl improvements, new email styles, imap trigger, logs context menu - #2672

Merged
waleedlatif1 merged 9 commits into
mainfrom
staging
Jan 3, 2026
Merged

waleedlatif1 merged 9 commits into
mainfrom
staging

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

waleedlatif1 and others added 9 commits January 1, 2026 13:47
* feat(email): welcome email; improvement(emails): ui/ux

* improvement(emails): links, accounts, preview

* refactor(emails): file structure and wrapper components

* added envvar for personal emails sent, added isHosted gate

* fixed failing tests, added env mock

* fix: removed comment

---------

Co-authored-by: waleed <walif6@gmail.com>
* hitl gaps

* deal with trigger worker crashes

* cleanup import strcuture
* feat(tools): added support for imap trigger

* feat(imap): added parity, tested

* ack PR comments

* final cleanup
Co-authored-by: waleedlatif1 <waleedlatif1@users.noreply.github.com>
* feat(admin): routes to manage deployments

* fix naming fo deployed by
…nd, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date (#2668)

* feat(time-picker): added timepicker emcn component, added to playground, added searchable prop for dropdown, added more timezones for schedule, updated license and notice date

* removed unused params, cleaned up redundant utils
* improvement(invite): aligned with rest of app

* fix(invite): error handling

* fix: addressed comments
@greptile-apps

greptile-apps Bot commented Jan 3, 2026

Copy link
Copy Markdown
Contributor

Skipped: This PR changes more files than the configured file change limit: (157 files found, 100 file limit)

@vercel

vercel Bot commented Jan 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 3, 2026 8:34pm

Comment on lines +691 to +698
const grainResponse = await fetch(grainApiUrl, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
'Public-Api-Version': '2025-10-31',
},
})

Check failure

Code scanning / CodeQL

Server-side request forgery

The [URL](1) of this request depends on a [user-provided value](2).

Copilot Autofix

AI 11 months ago

In general, to fix this type of problem you should sanitize or validate any user-controlled data before using it as part of a URL, especially for path components. For identifiers like externalId, the safest approach is to enforce that they match a strict, expected format (for example, alphanumeric plus a few safe punctuation characters) and reject or skip operations when they do not.

The best fix here, without changing overall functionality, is to validate externalId inside deleteGrainWebhook right after reading it from config. The Grain API’s hook IDs are identifiers, not arbitrary URLs, so we can reasonably constrain them to a safe character set (e.g. /^[A-Za-z0-9_-]+$/). If externalId fails this validation, we log a warning and skip the cleanup call rather than sending a possibly malformed path to fetch. This keeps the external behavior for valid IDs unchanged, while preventing attacker-controlled, unexpected path strings from being used.

Concretely, in apps/sim/lib/webhooks/provider-subscriptions.ts, within deleteGrainWebhook:

  • Introduce a local regular expression (e.g. const externalIdPattern = /^[A-Za-z0-9_-]+$/) or inline check.
  • After the if (!externalId) early-return, add a block that checks externalId against this pattern.
  • If the check fails, log a warning (similar style to existing warnings, including requestId and webhook.id) and return early.
  • Leave the grainApiUrl construction and fetch call unchanged for valid IDs.

No changes are needed in apps/sim/app/api/webhooks/route.ts or apps/sim/lib/webhooks/env-resolver.ts, since they do not need to know about Grain-specific ID constraints and already only pass the configuration through.


Suggested changeset 1
apps/sim/lib/webhooks/provider-subscriptions.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/apps/sim/lib/webhooks/provider-subscriptions.ts b/apps/sim/lib/webhooks/provider-subscriptions.ts
--- a/apps/sim/lib/webhooks/provider-subscriptions.ts
+++ b/apps/sim/lib/webhooks/provider-subscriptions.ts
@@ -686,6 +686,16 @@
       return
     }
 
+    // Validate externalId to ensure it is a safe identifier before using it in the URL path
+    const externalIdPattern = /^[A-Za-z0-9_-]+$/
+    if (!externalIdPattern.test(externalId)) {
+      grainLogger.warn(
+        `[${requestId}] Invalid externalId format for Grain webhook deletion ${webhook.id}, skipping cleanup`,
+        { externalId }
+      )
+      return
+    }
+
     const grainApiUrl = `https://api.grain.com/_/public-api/v2/hooks/${externalId}`
 
     const grainResponse = await fetch(grainApiUrl, {
EOF
@@ -686,6 +686,16 @@
return
}

// Validate externalId to ensure it is a safe identifier before using it in the URL path
const externalIdPattern = /^[A-Za-z0-9_-]+$/
if (!externalIdPattern.test(externalId)) {
grainLogger.warn(
`[${requestId}] Invalid externalId format for Grain webhook deletion ${webhook.id}, skipping cleanup`,
{ externalId }
)
return
}

const grainApiUrl = `https://api.grain.com/_/public-api/v2/hooks/${externalId}`

const grainResponse = await fetch(grainApiUrl, {
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@waleedlatif1
waleedlatif1 merged commit 3792bdd into main Jan 3, 2026

This branch was successfully deployed

1 active deployment
Preview — 8d15219c Deployed Jan 3, 2026 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.

5 participants