A proxy connects two separate trust boundaries
The incoming request authenticates a user to your application. The outgoing request authenticates your application to AISwapLab. Those identities and protocols are related by your authorization logic, not by copying every header across. OWASP's authorization and logging guidance supports deliberate boundaries and limited sensitive-data exposure. This guide concerns your proxy implementation and does not claim that AISwapLab accepts arbitrary forwarded authentication or user identity headers.
What to do next
- 01
Specify headers by operation
For each supported outbound method, identify the required content type, server-side Authorization and request-specific idempotency header where documented. Let the multipart implementation construct its own boundary when uploading. Exclude incoming Cookie, Host, unrelated Authorization and internal application headers. Build the set from named values rather than copying an object and attempting to delete a growing list of dangerous fields afterward.
- 02
Validate the source of each value
Bind the upstream secret to the authorized server-side connection, not a browser-supplied bearer string. Bind a creation request's idempotency value to the approved application action rather than accepting an arbitrary conflicting header without policy. Generate or propagate trace context only under a documented safe rule. Do not attach secrets to a destination until the origin and route checks have passed.
- 03
Inspect the actual emitted request
Use a local capture fixture with dummy credentials and an incoming request containing synthetic cookies, authorization and internal headers. Assert that only the intended outbound headers appear. Cover JSON creation, multipart upload and read-only recovery separately. Confirm that application logs do not record the sensitive incoming or outgoing values. Repeat the check when proxy middleware or the HTTP wrapper changes.
A concrete example
Illustrative example: a browser sends the application's session cookie and a local authorization header. The proxy creates a fresh outbound request using its own permitted AISwapLab bearer value. A local test proves the browser credentials and internal routing header never reach the fixture upstream.
Before you call it ready
- Outbound headers are explicitly constructed.
- The secret comes from trusted server context.
- Tests inspect actual emitted headers without real credentials.
When to stop or choose another method
Stop dispatch if middleware can silently merge browser headers into the upstream request. Correct that boundary before processing private uploads or paid commands; redacting logs does not prevent a secret from being sent to the wrong service.
