Repository navigation
v0.5.56: batch operations, access control and permission groups, billing fixes - #2759
Conversation
Co-authored-by: icecrasher321 <icecrasher321@users.noreply.github.com>
…d, and edge operations (#2738) * improvement(canvas): add multi-block select, add batch handle, enabled, and edge operations * feat(i18n): update translations (#2732) Co-authored-by: icecrasher321 <icecrasher321@users.noreply.github.com> * don't allow flip handles for subflows * ack PR comments * more * fix missing handler * remove dead subflow-specific ops * remove unused code * fixed subflow ops * keep edges on subflow actions intact * fix subflow resizing * fix remove from subflow bulk * improvement(canvas): add multi-block select, add batch handle, enabled, and edge operations * don't allow flip handles for subflows * ack PR comments * more * fix missing handler * remove dead subflow-specific ops * remove unused code * fixed subflow ops * fix subflow resizing * keep edges on subflow actions intact * fixed copy from inside subflow * types improvement, preview fixes * fetch varible data in deploy modal * moved remove from subflow one position to the right * fix subflow issues * address greptile comment * fix test * improvement(preview): ui/ux * fix(preview): subflows * added batch add edges * removed recovery * use consolidated consts for sockets operations * more --------- Co-authored-by: icecrasher321 <icecrasher321@users.noreply.github.com> Co-authored-by: Vikhyath Mondreti <vikhyath@simstudio.ai> Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
* improvement(billng): team upgrade + session management * remove comments * session updates should be atomic * make consistent for onSubscritionUpdate * plan upgrade to refresh session * fix var name * remove dead code * preserve params
…ecated posthog route, remove deprecated templates & console helpers (#2753) * fix(tools): updated memory block to throw better errors, removed deprecated posthog route, remove deprecated templates & console helpers * remove isDeployed in favor of deploymentStatus * ack PR comments
* expanded metadata fields for google drive * added tag dropdown support * fixed greptile * added utils func * removed comments * updated docs * greptile comments * fixed output schema * reverted back to bas64 string
…rams, inject at runtime like all other tools (#2750) * fix(tools): fixed wrokflow tool for agent to respect user provided params, inject at runtime like all other tools * ack comments * remove redunant if-else * added tests
* fix(docs): new router * update image
… added missing docs for various blocks and triggers (#2754) * feat(sidebar): context menu for nav items in sidebar * added toolbar context menu, fixed incorrect access pattern in old context menus and added docs for missing blocks * fixed links
* added wand configs * fixed greptile comments
* feat(permission-groups): integration/model access controls for enterprise * feat: enterprise gating for BYOK, SSO, credential sets with org admin/owner checks * execution time enforcement of mcp and custom tools * add admin routes to cleanup permission group data * fix not being on enterprise checks * separate out orgs from billing system * update the docs * add custom tool blockers based on perm configs * add migrations * fix * address greptile comments * regen migrations * fix default model picking based on user config * cleaned up UI
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
|
Too many files changed for review. ( |
* fix(sockets): broadcast handles and enabled/disabled state * made all ops batched, removed all individual ops * fix subflow resizing on exit * removed unused custom event * fix failing tests, update testing * fix test mock
* feat(deployed-form): added deployed form input * styling consolidation, finishing touches on form * updated docs * remove unused files with knip * added more form fields * consolidated more test utils * remove unused/unneeded zustand stores, refactored stores for consistency * improvement(files): uncolorized plan name * feat(emcn): button-group * feat(emcn): tag input, tooltip shortcut * improvement(emcn): modal padding, api, chat, form * fix: deleted migrations * feat(form): added migrations * fix(emcn): tag input * fix: failing tests on build * add suplementary hover and fix bg color in date picker * fix: build errors --------- Co-authored-by: Emir Karabeg <emirkarabeg@berkeley.edu>
| */ | ||
|
|
||
| function hashPassword(encryptedPassword: string): string { | ||
| return createHash('sha256').update(encryptedPassword).digest('hex').substring(0, 8) |
Check failure
Code scanning / CodeQL
Use of password hash with insufficient computational effort
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 11 months ago
General approach: Replace the current fast, truncated SHA-256 hash used in hashPassword with a password hashing scheme that has configurable computational effort (e.g., PBKDF2). Because this hash is only used to bind the auth cookie/token to the current deployment password (and not to store passwords in a database), we can keep the same interface by deterministically deriving a fixed-length string from the encryptedPassword using PBKDF2 with a constant salt and a high iteration count. This preserves behavior (token is invalidated when the stored password value changes) while making brute-force and offline attacks much harder.
Best concrete fix with minimal functional change:
- In
apps/sim/lib/core/security/deployment.ts:- Change
hashPasswordto use Node’scrypto.pbkdf2Syncwith a strong iteration count instead ofcreateHash('sha256'). - Keep the function synchronous and returning a short hex string to avoid changing callers. We can still truncate if desired; from a compatibility perspective, matching the length (8 hex chars) ensures cookie payload size stays very similar and avoids needing to touch any parsing logic.
- We need access to
pbkdf2Sync. Since the file currently imports onlycreateHashfromcrypto, we will replace that import with one that includespbkdf2Sync(we do not otherwise usecreateHashin the shown snippet).
- Change
Implementation details:
- Update the import at the top of
deployment.ts:- From:
import { createHash } from 'crypto' - To:
import { pbkdf2Sync } from 'crypto'
- From:
- Update
hashPasswordimplementation:- From using:
createHash('sha256').update(encryptedPassword).digest('hex').substring(0, 8) - To something like:
const salt = 'deployment-auth-token-salt' const iterations = 100_000 const keylen = 32 const digest = 'sha256' const derived = pbkdf2Sync(encryptedPassword, salt, iterations, keylen, digest).toString('hex') return derived.substring(0, 8)
- This keeps the return type and length unchanged, but substantially increases the computational cost of deriving the hash from the underlying password value.
- From using:
- All other files (
chatandformroutes/utils) callsetDeploymentAuthCookieandvalidateAuthTokenbut need no changes: they will automatically use the stronger hashing when creating and validating cookies. The token format (deploymentId:type:timestamp:pwHash) remains identical, except thatpwHashnow comes from PBKDF2 instead of raw SHA-256. Existing cookies will become invalid after deployment (since theirpwHashno longer matches), which is acceptable and even desirable from a security perspective.
Only apps/sim/lib/core/security/deployment.ts requires code edits.
| @@ -1,4 +1,4 @@ | ||
| import { createHash } from 'crypto' | ||
| import { pbkdf2Sync } from 'crypto' | ||
| import type { NextRequest, NextResponse } from 'next/server' | ||
| import { isDev } from '@/lib/core/config/feature-flags' | ||
|
|
||
| @@ -8,7 +8,15 @@ | ||
| */ | ||
|
|
||
| function hashPassword(encryptedPassword: string): string { | ||
| return createHash('sha256').update(encryptedPassword).digest('hex').substring(0, 8) | ||
| // Derive a short, deterministic hash from the (encrypted) password using a | ||
| // computationally expensive KDF instead of a single fast hash. | ||
| const salt = 'deployment-auth-token-salt' | ||
| const iterations = 100_000 | ||
| const keylen = 32 | ||
| const digest = 'sha256' | ||
| const derived = pbkdf2Sync(encryptedPassword, salt, iterations, keylen, digest).toString('hex') | ||
| // Keep the length short to preserve the existing token structure. | ||
| return derived.substring(0, 8) | ||
| } | ||
|
|
||
| function encryptAuthToken( |
Uh oh!
There was an error while loading. Please reload this page.