@@ -293,6 +293,42 @@ describe('POST /api/v2/credentials', () => {
293293 } )
294294 } )
295295
296+ it ( 'forwards OCI Object Storage credential fields without returning secrets' , async ( ) => {
297+ const request = new NextRequest ( 'http://localhost:3000/api/v2/credentials' , {
298+ method : 'POST' ,
299+ headers : { 'content-type' : 'application/json' } ,
300+ body : JSON . stringify ( {
301+ workspaceId : WORKSPACE_ID ,
302+ type : 'service_account' ,
303+ providerId : 'oci-object-storage-service-account' ,
304+ credentials : JSON . stringify ( {
305+ accessKeyId : 'access-key-canary' ,
306+ secretAccessKey : 'secret-key-canary' ,
307+ namespace : 'namespace1' ,
308+ region : 'us-ashburn-1' ,
309+ } ) ,
310+ } ) ,
311+ } )
312+ const response = await POST ( request )
313+ const body = await response . text ( )
314+
315+ expect ( response . status ) . toBe ( 201 )
316+ expect ( body ) . not . toContain ( 'key-canary' )
317+ expect ( body ) . not . toContain ( 'namespace1' )
318+ expect ( mocks . create ) . toHaveBeenCalledWith ( {
319+ principal : { kind : 'personal_api_key' , userId : 'user-1' , keyId : 'key-1' } ,
320+ input : expect . objectContaining ( {
321+ workspaceId : WORKSPACE_ID ,
322+ providerId : 'oci-object-storage-service-account' ,
323+ accessKeyId : 'access-key-canary' ,
324+ secretAccessKey : 'secret-key-canary' ,
325+ namespace : 'namespace1' ,
326+ region : 'us-ashburn-1' ,
327+ } ) ,
328+ request,
329+ } )
330+ } )
331+
296332 it ( 'rejects an unknown service-account provider before the use case' , async ( ) => {
297333 const response = await POST (
298334 new NextRequest ( 'http://localhost:3000/api/v2/credentials' , {
0 commit comments