Skip to content

Commit

Permalink
FIX - Add check to public address of the application when checking if…
Browse files Browse the repository at this point in the history
… the client is GitHub
  • Loading branch information
Juansecu committed Feb 25, 2024
1 parent ed25533 commit cc18ff7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/middlewares/check-whether-client-is-github.middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ export function checkIfClientIsGitHub(
if (process.env.NODE_ENV === 'production') {
consoleLogger.info(`Client host: ${request.get('host')}`);

if (request.get('host') !== 'api.github.com') {
if (
request.get('host') !== 'api.github.com' &&
request.get(process.env.PUBLIC_HOST_ADDRESS!)
) {
consoleLogger.error('Client is not GitHub');
response.status(403).send('Forbidden');
return;
Expand All @@ -36,7 +39,7 @@ export function checkIfClientIsGitHub(
return;
}

consoleLogger.verbose('Client is GitHub');
consoleLogger.info('Client is GitHub');

next();
}

0 comments on commit cc18ff7

Please sign in to comment.