Skip to content

Commit 8922713

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(oracle-fusion): confine request origin
1 parent 91d34b3 commit 8922713

2 files changed

Lines changed: 14 additions & 0 deletions

File tree

apps/sim/lib/internal/oracle-fusion-financials/client.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ export interface OracleFusionRequest {
229229

230230
function buildRequestUrl(origin: string, request: OracleFusionRequest): string {
231231
const url = new URL(request.path, origin)
232+
if (url.origin !== origin || url.username || url.password) {
233+
throw new Error('Oracle Fusion request path must remain on the credential-bound origin')
234+
}
232235
for (const [key, value] of Object.entries(request.query ?? {})) {
233236
if (value !== undefined) url.searchParams.set(key, String(value))
234237
}

apps/sim/lib/internal/oracle-fusion-financials/oracle-fusion-financials.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,6 +849,17 @@ describe('Oracle Fusion Financials provider', () => {
849849
expect(url.searchParams.has('totalResults')).toBe(false)
850850
})
851851

852+
it.each([
853+
'https://attacker.example/fscmRestApi/resources/11.13.18.05/invoices',
854+
'//attacker.example/fscmRestApi/resources/11.13.18.05/invoices',
855+
`https://user:password@vision.fa.us2.oraclecloud.com${RESOURCE_PATH}/invoices`,
856+
])('rejects request paths that leave the credential-bound origin: %s', async (path) => {
857+
await expect(requestOracleFusionJson(AUTH, { path })).rejects.toThrow(
858+
'Oracle Fusion request path must remain on the credential-bound origin'
859+
)
860+
expect(mockSecureFetch).not.toHaveBeenCalled()
861+
})
862+
852863
it('encodes every opaque parent key in nested resource paths', async () => {
853864
const invoiceUniqId = 'INVOICE key+1'
854865
const invoiceLineUniqId = 'LINE key+2'

0 commit comments

Comments
 (0)