Skip to content

Commit 5d6c47d

Browse files
committed
test(v2-api): align upload concealment test with cross-tenant-only semantics
#6557 narrowed `createV2ResourceConcealmentPolicy` to conceal only the three cross-tenant authorization classes, deliberately letting a same-workspace policy denial keep its 403 so the caller learns why. My test predated that and asserted a workspace-key denial was concealed as 404. Split into two cases that pin the distinction rather than paper over it: a cross-tenant reach conceals, a workspace-key policy denial does not.
1 parent f633e79 commit 5d6c47d

1 file changed

Lines changed: 15 additions & 8 deletions

File tree

apps/sim/app/api/v2/files/uploads/[uploadId]/route.test.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,14 +99,8 @@ describe('DELETE /api/v2/files/uploads/[uploadId]', () => {
9999
expect(await response.json()).toMatchObject({ data: { id: UPLOAD_ID, status: 'aborted' } })
100100
})
101101

102-
it.each([
103-
['no workspace access', () => new NoWorkspaceAccessError()],
104-
[
105-
'a workspace API key barred from the operation',
106-
() => new WorkspaceApiKeyAuthorizationError(),
107-
],
108-
])('conceals %s as a missing upload session', async (_label, makeError) => {
109-
mocks.abort.mockRejectedValueOnce(makeError())
102+
it('conceals a cross-tenant reach as a missing upload session', async () => {
103+
mocks.abort.mockRejectedValueOnce(new NoWorkspaceAccessError())
110104

111105
const response = await DELETE(abortRequest(), context)
112106

@@ -116,6 +110,19 @@ describe('DELETE /api/v2/files/uploads/[uploadId]', () => {
116110
})
117111
})
118112

113+
/**
114+
* Only cross-tenant reaches are concealed. A workspace key barred from this
115+
* operation is a same-workspace policy denial — the caller owns the session
116+
* and needs to be told why, not handed a misleading 404.
117+
*/
118+
it('keeps a workspace-key policy denial as a 403', async () => {
119+
mocks.abort.mockRejectedValueOnce(new WorkspaceApiKeyAuthorizationError())
120+
121+
const response = await DELETE(abortRequest(), context)
122+
123+
expect(response.status).toBe(403)
124+
})
125+
119126
it('does not conceal a workspace-policy denial behind a not-found', async () => {
120127
mocks.abort.mockRejectedValueOnce(new InsufficientWorkspacePermissionsError())
121128

0 commit comments

Comments
 (0)