chore(orchestration): validate PK when throwIfKeyNotFound (#11190)
CLOSES: FRMW-2895
This commit is contained in:
committed by
GitHub
parent
e0bd2a79b0
commit
e98d3c615e
@@ -33,21 +33,18 @@ export async function ensurePublishableApiKeyMiddleware(
|
||||
const query = req.scope.resolve(ContainerRegistrationKeys.QUERY)
|
||||
|
||||
try {
|
||||
const { data } = await query.graph(
|
||||
{
|
||||
entity: "api_key",
|
||||
fields: ["id", "token", "sales_channels_link.sales_channel_id"],
|
||||
filters: {
|
||||
token: publishableApiKey,
|
||||
type: ApiKeyType.PUBLISHABLE,
|
||||
$or: [
|
||||
{ revoked_at: { $eq: null } },
|
||||
{ revoked_at: { $gt: new Date() } },
|
||||
],
|
||||
},
|
||||
const { data } = await query.graph({
|
||||
entity: "api_key",
|
||||
fields: ["id", "token", "sales_channels_link.sales_channel_id"],
|
||||
filters: {
|
||||
token: publishableApiKey,
|
||||
type: ApiKeyType.PUBLISHABLE,
|
||||
$or: [
|
||||
{ revoked_at: { $eq: null } },
|
||||
{ revoked_at: { $gt: new Date() } },
|
||||
],
|
||||
},
|
||||
{ throwIfKeyNotFound: true }
|
||||
)
|
||||
})
|
||||
|
||||
apiKey = data[0]
|
||||
} catch (e) {
|
||||
|
||||
Reference in New Issue
Block a user