File tree Expand file tree Collapse file tree 4 files changed +27
-13
lines changed
app/credential-account/[token] Expand file tree Collapse file tree 4 files changed +27
-13
lines changed Original file line number Diff line number Diff line change @@ -221,12 +221,10 @@ export default function CredentialAccountInvitePage() {
221221 label : 'Create an account' ,
222222 onClick : ( ) =>
223223 router . push ( `/signup?callbackUrl=${ callbackUrl } &invite_flow=true&new=true` ) ,
224- variant : 'outline' as const ,
225224 } ,
226225 {
227226 label : 'Return to Home' ,
228227 onClick : ( ) => router . push ( '/' ) ,
229- variant : 'ghost' as const ,
230228 } ,
231229 ] }
232230 />
@@ -260,7 +258,6 @@ export default function CredentialAccountInvitePage() {
260258 {
261259 label : 'Return to Home' ,
262260 onClick : ( ) => router . push ( '/' ) ,
263- variant : 'ghost' as const ,
264261 } ,
265262 ] }
266263 />
Original file line number Diff line number Diff line change @@ -351,7 +351,10 @@ describe('API key lifecycle', () => {
351351
352352 it ( 'should reject key if storage is tampered' , async ( ) => {
353353 const key = generateApiKey ( )
354- const tamperedStorage = `${ key . slice ( 0 , - 1 ) } X` // Change last character
354+ const lastChar = key . slice ( - 1 )
355+ // Ensure tampered character is different from original (handles edge case where key ends in 'X')
356+ const tamperedChar = lastChar === 'X' ? 'Y' : 'X'
357+ const tamperedStorage = `${ key . slice ( 0 , - 1 ) } ${ tamperedChar } `
355358 const result = await authenticateApiKey ( key , tamperedStorage )
356359 expectApiKeyInvalid ( result )
357360 } )
Original file line number Diff line number Diff line change 11import { createLogger } from '@sim/logger'
22import JSZip from 'jszip'
3- import { sanitizeForExport } from '@/lib/workflows/sanitization/json-sanitizer'
3+ import {
4+ type ExportWorkflowState ,
5+ sanitizeForExport ,
6+ } from '@/lib/workflows/sanitization/json-sanitizer'
7+ import { regenerateWorkflowIds } from '@/stores/workflows/utils'
48import type { Variable , WorkflowState } from '@/stores/workflows/workflow/types'
59
610const logger = createLogger ( 'WorkflowImportExport' )
@@ -431,19 +435,27 @@ export function generateWorkflowJson(
431435 workflowState : WorkflowState ,
432436 options : GenerateWorkflowJsonOptions
433437) : string {
434- const stateWithMetadata = {
438+ const variablesRecord : Record < string , Variable > | undefined = options . variables ?. reduce (
439+ ( acc , v ) => {
440+ acc [ v . id ] = {
441+ id : v . id ,
442+ name : v . name ,
443+ type : v . type ,
444+ value : v . value ,
445+ }
446+ return acc
447+ } ,
448+ { } as Record < string , Variable >
449+ )
450+
451+ const stateWithMetadata : WorkflowState = {
435452 ...workflowState ,
436453 metadata : {
437454 name : options . name ,
438455 description : options . description ,
439456 exportedAt : new Date ( ) . toISOString ( ) ,
440457 } ,
441- variables : options . variables ?. map ( ( v ) => ( {
442- id : v . id ,
443- name : v . name ,
444- type : v . type ,
445- value : v . value ,
446- } ) ) ,
458+ variables : variablesRecord ,
447459 }
448460
449461 const exportState : ExportWorkflowState = sanitizeForExport ( stateWithMetadata )
Original file line number Diff line number Diff line change @@ -34,7 +34,9 @@ import {
3434 updateOllamaProviderModels ,
3535} from '@/providers/utils'
3636
37- const isHostedSpy = vi . spyOn ( environmentModule , 'isHosted' , 'get' )
37+ const isHostedSpy = vi . spyOn ( environmentModule , 'isHosted' , 'get' ) as unknown as {
38+ mockReturnValue : ( value : boolean ) => void
39+ }
3840const mockGetRotatingApiKey = vi . fn ( ) . mockReturnValue ( 'rotating-server-key' )
3941const originalRequire = module . require
4042
You can’t perform that action at this time.
0 commit comments