mirror of
https://github.com/fosrl/pangolin.git
synced 2026-08-13 16:00:02 +02:00
Merge branch 'aig' of github.com:fosrl/pangolin into aig
This commit is contained in:
@@ -263,28 +263,20 @@ export async function verifyResourceSession(
|
||||
);
|
||||
|
||||
if (action == "ACCEPT") {
|
||||
// Public inference still requires a virtual API key; do not
|
||||
// bypass that with an allow rule.
|
||||
if (mode === "inference") {
|
||||
logger.debug(
|
||||
"Rule ACCEPT ignored for inference; continuing to virtual API key check"
|
||||
);
|
||||
} else {
|
||||
logger.debug("Resource allowed by rule");
|
||||
logger.debug("Resource allowed by rule");
|
||||
|
||||
logRequestAudit(
|
||||
{
|
||||
action: true,
|
||||
reason: 100, // allowed by rule
|
||||
resourceId: resource.resourceId,
|
||||
orgId: resource.orgId,
|
||||
location: ipCC
|
||||
},
|
||||
parsedBody.data
|
||||
);
|
||||
logRequestAudit(
|
||||
{
|
||||
action: true,
|
||||
reason: 100, // allowed by rule
|
||||
resourceId: resource.resourceId,
|
||||
orgId: resource.orgId,
|
||||
location: ipCC
|
||||
},
|
||||
parsedBody.data
|
||||
);
|
||||
|
||||
return allowed(res, undefined, dontStripSession);
|
||||
}
|
||||
return allowed(res, undefined, dontStripSession);
|
||||
} else if (action == "DROP") {
|
||||
logger.debug("Resource denied by rule");
|
||||
|
||||
@@ -425,7 +417,7 @@ export async function verifyResourceSession(
|
||||
parsedBody.data
|
||||
);
|
||||
|
||||
return notAllowed(res, redirectPath);
|
||||
return notAllowed(res, redirectPath, resource.orgId);
|
||||
}
|
||||
|
||||
// check for access token in headers
|
||||
|
||||
@@ -42,6 +42,7 @@ export type GetResourceAuthInfoResponse = {
|
||||
skipToIdpId: number | null;
|
||||
orgId: string;
|
||||
postAuthPath: string | null;
|
||||
mode: string;
|
||||
};
|
||||
|
||||
export async function getResourceAuthInfo(
|
||||
@@ -227,7 +228,8 @@ export async function getResourceAuthInfo(
|
||||
whitelist: effectivePolicy?.emailWhitelistEnabled ?? false,
|
||||
skipToIdpId: effectivePolicy?.idpId ?? resource.skipToIdpId,
|
||||
orgId: resource.orgId,
|
||||
postAuthPath: resource.postAuthPath ?? null
|
||||
postAuthPath: resource.postAuthPath ?? null,
|
||||
mode: resource.mode
|
||||
},
|
||||
success: true,
|
||||
error: false,
|
||||
|
||||
@@ -123,10 +123,12 @@ export async function listMyVirtualApiKeys(
|
||||
}
|
||||
|
||||
let resourceId: number | undefined;
|
||||
let resourceName: string | undefined;
|
||||
if (resourceGuid) {
|
||||
const [resource] = await db
|
||||
.select({
|
||||
resourceId: resources.resourceId
|
||||
resourceId: resources.resourceId,
|
||||
name: resources.name
|
||||
})
|
||||
.from(resources)
|
||||
.where(
|
||||
@@ -147,6 +149,7 @@ export async function listMyVirtualApiKeys(
|
||||
}
|
||||
|
||||
resourceId = resource.resourceId;
|
||||
resourceName = resource.name;
|
||||
}
|
||||
|
||||
const { key: userKeyRow } = await getOrCreateUserVirtualApiKey({
|
||||
@@ -203,7 +206,8 @@ export async function listMyVirtualApiKeys(
|
||||
userKey: toKeyWithResources(userKeyRow, resourceIdsByKey),
|
||||
manualKeys: manualRows.map((row) =>
|
||||
toKeyWithResources(row, resourceIdsByKey)
|
||||
)
|
||||
),
|
||||
...(resourceName !== undefined ? { resourceName } : {})
|
||||
},
|
||||
success: true,
|
||||
error: false,
|
||||
|
||||
@@ -22,6 +22,7 @@ export type CreateOrEditVirtualApiKeyResponse = {
|
||||
export type ListMyVirtualApiKeysResponse = {
|
||||
userKey: VirtualApiKeyWithResources;
|
||||
manualKeys: VirtualApiKeyWithResources[];
|
||||
resourceName?: string | null;
|
||||
};
|
||||
|
||||
export type GetMyVirtualApiKeyResponse = {
|
||||
|
||||
Reference in New Issue
Block a user