Skip to content

Commit

Permalink
Remove old TODO on getClientIp and remove duplicate logic
Browse files Browse the repository at this point in the history
Issue: ARSN-453
  • Loading branch information
williamlardier committed Dec 26, 2024
1 parent 5aadd36 commit 753fea6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions lib/policyEvaluator/requestUtils.ts
Original file line number Diff line number Diff line change
@@ -8,9 +8,6 @@ export interface S3Config {
}
}

// TODO
// I'm not sure about this behavior.
// Should it returns string | string[] | undefined or string ?
/**
* getClientIp - Gets the client IP from the request
* @param request - http request object
@@ -20,7 +17,6 @@ export interface S3Config {
export function getClientIp(request: IncomingMessage, s3config?: S3Config): string {
const requestConfig = s3config?.requests;
const remoteAddress = request.socket.remoteAddress;
// TODO What to do if clientIp === undefined ?
const clientIp = remoteAddress?.toString() ?? '';
if (requestConfig) {
const { trustedProxyCIDRs, extractClientIPFromHeader } = requestConfig;
@@ -39,5 +35,5 @@ export function getClientIp(request: IncomingMessage, s3config?: S3Config): stri
}
}
}
return clientIp?.toString() ?? '';
return clientIp;
}

0 comments on commit 753fea6

Please sign in to comment.