Skip to content

Commit

Permalink
service: Align /network path auth with /subgraph path auth
Browse files Browse the repository at this point in the history
- Require the 'bearer' string in authorization header on /network path
  • Loading branch information
fordN committed May 15, 2024
1 parent 1d0f542 commit a14c752
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions packages/indexer-service/src/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,14 @@ export const createApp = async ({
try {
logger.info(`Handle network subgraph query`)

let networkSubgraphAuthValue: string | undefined
if (networkSubgraphAuthToken) {
networkSubgraphAuthValue = `Bearer ${networkSubgraphAuthToken}`
}

if (
networkSubgraphAuthToken &&
req.headers['authorization'] !== networkSubgraphAuthToken
networkSubgraphAuthValue &&
req.headers['authorization'] !== networkSubgraphAuthValue
) {
throw new Error(`Invalid auth token`)
}
Expand Down

0 comments on commit a14c752

Please sign in to comment.