({ inputs, params }, context)
| 366 | ], |
| 367 | }, |
| 368 | async execute({ inputs, params }, context) { |
| 369 | const parsedParams = parameterSchema.parse(params); |
| 370 | const runnerPayload = { |
| 371 | ...inputs, |
| 372 | ...parsedParams, |
| 373 | }; |
| 374 | |
| 375 | context.logger.info( |
| 376 | `[TruffleHog] Scanning ${runnerPayload.scanType} target: ${runnerPayload.scanTarget}`, |
| 377 | ); |
| 378 | |
| 379 | const optionsSummary = { |
| 380 | scanType: runnerPayload.scanType, |
| 381 | onlyVerified: runnerPayload.onlyVerified ?? true, |
| 382 | jsonOutput: runnerPayload.jsonOutput ?? true, |
| 383 | branch: runnerPayload.branch ?? null, |
| 384 | sinceCommit: runnerPayload.sinceCommit ?? null, |
| 385 | hasFilesystemContent: !!runnerPayload.filesystemContent, |
| 386 | }; |
| 387 | |
| 388 | context.emitProgress({ |
| 389 | message: 'Launching TruffleHog scan…', |
| 390 | level: 'info', |
| 391 | data: { target: runnerPayload.scanTarget, options: optionsSummary }, |
| 392 | }); |
| 393 | |
| 394 | // Handle filesystem scanning with isolated volumes |
| 395 | let volume: IsolatedContainerVolume | undefined; |
| 396 | let effectiveInput = runnerPayload; |
| 397 | |
| 398 | const baseRunner = definition.runner; |
| 399 | if (baseRunner.kind !== 'docker') { |
| 400 | throw new ContainerError('TruffleHog runner must be docker', { |
| 401 | details: { reason: 'runner_type_mismatch', expected: 'docker', actual: baseRunner.kind }, |
| 402 | }); |
| 403 | } |
| 404 | |
| 405 | try { |
| 406 | // If filesystemContent is provided, use isolated volume |
| 407 | if ( |
| 408 | runnerPayload.filesystemContent && |
| 409 | Object.keys(runnerPayload.filesystemContent).length > 0 |
| 410 | ) { |
| 411 | if (runnerPayload.scanType !== 'filesystem') { |
| 412 | throw new ValidationError('filesystemContent can only be used with scanType=filesystem', { |
| 413 | fieldErrors: { scanType: ['Must be "filesystem" when using filesystemContent'] }, |
| 414 | }); |
| 415 | } |
| 416 | |
| 417 | const tenantId = (context as any).tenantId ?? 'default-tenant'; |
| 418 | volume = new IsolatedContainerVolume(tenantId, context.runId); |
| 419 | |
| 420 | // Initialize volume with files |
| 421 | const volumeName = await volume.initialize(runnerPayload.filesystemContent); |
| 422 | context.logger.info(`[TruffleHog] Created isolated volume: ${volumeName}`); |
| 423 | |
| 424 | // Override scanTarget to point to mounted volume |
| 425 | effectiveInput = { |
nothing calls this directly
no test coverage detected