Skip to content

Commit e2e424c

Browse files
waleedlatif1myxamediyar
authored andcommitted
fix(video): check fal start frame provenance before sending it to the model
A fal start frame now passes the same opaque model-input provenance check as a Runway reference before its bytes reach the model.
1 parent 89be0a6 commit e2e424c

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

‎apps/sim/lib/internal/video/operations.test.ts‎

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,30 @@ describe('executeVideoOperation', () => {
7171
})
7272
})
7373

74-
it('fails opaque provenance before inspecting or downloading a Runway file', async () => {
75-
mocks.validateOpaqueModelInputProvenance.mockReturnValue({
76-
success: false,
77-
error: 'Model input provenance is unavailable',
78-
status: 400,
79-
})
74+
it.each(['runway', 'falai'] as const)(
75+
'fails opaque provenance before inspecting or downloading a %s file',
76+
async (provider) => {
77+
mocks.validateOpaqueModelInputProvenance.mockReturnValue({
78+
success: false,
79+
error: 'Model input provenance is unavailable',
80+
status: 400,
81+
})
8082

81-
await expect(
82-
executeVideoOperation(
83-
{
84-
provider: 'runway',
85-
apiKey: 'key',
86-
prompt: 'A cinematic sunrise',
87-
visualReference: file,
88-
},
89-
{ headers: new Headers(), requestId: 'request-1', userId: 'user-1' }
90-
)
91-
).rejects.toMatchObject({ status: 400, message: 'Model input provenance is unavailable' })
92-
expect(mockAssertToolFileAccess).not.toHaveBeenCalled()
93-
expect(mocks.generateVideo).not.toHaveBeenCalled()
94-
})
83+
await expect(
84+
executeVideoOperation(
85+
{
86+
provider,
87+
apiKey: 'key',
88+
prompt: 'A cinematic sunrise',
89+
visualReference: file,
90+
},
91+
{ headers: new Headers(), requestId: 'request-1', userId: 'user-1' }
92+
)
93+
).rejects.toMatchObject({ status: 400, message: 'Model input provenance is unavailable' })
94+
expect(mockAssertToolFileAccess).not.toHaveBeenCalled()
95+
expect(mocks.generateVideo).not.toHaveBeenCalled()
96+
}
97+
)
9598

9699
it('fails closed for model-unsafe workspace files', async () => {
97100
mockIsModelSafeWorkspaceFileKey.mockResolvedValue(false)

‎apps/sim/lib/internal/video/operations.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function validateModelInputProvenance(
7272
input: VideoOperationInput,
7373
context: VideoOperationContext
7474
): void {
75-
if (input.provider !== 'runway') return
75+
if (input.provider !== 'runway' && !input.visualReference) return
7676
const provenance = validateOpaqueModelInputProvenance({
7777
headers: context.headers,
7878
payload: input,

0 commit comments

Comments
 (0)