feat: four super-admin keys and production customer API security
Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m18s
CI/CD Pipeline / Security Scanning (push) Successful in 2m34s
CI/CD Pipeline / Lint and Format (push) Failing after 54s
CI/CD Pipeline / Terraform Validation (push) Failing after 27s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 28s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 39s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 31s
Validation / validate-genesis (push) Successful in 28s
Validation / validate-terraform (push) Failing after 31s
Validation / validate-kubernetes (push) Failing after 11s
Validation / validate-smart-contracts (push) Failing after 11s
Validation / validate-security (push) Failing after 1m27s
Validation / validate-documentation (push) Failing after 21s
Verify Deployment / Verify Deployment (push) Has been cancelled

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-29 05:09:08 -07:00
parent 84f12c7edc
commit 064239be13
39 changed files with 1094 additions and 99 deletions

View File

@@ -1,4 +1,5 @@
import type { Request, Response, NextFunction } from 'express';
import { resolveOmnlPrincipal } from '@dbis/integration-foundation';
function extractBearerOrQuery(req: Request, key: string): boolean {
const auth = String(req.headers.authorization || '');
@@ -9,6 +10,8 @@ function extractBearerOrQuery(req: Request, key: string): boolean {
}
function hasOmnlOperatorAuth(req: Request): boolean {
const principal = resolveOmnlPrincipal(req);
if (principal && principal.role !== 'customer') return true;
const apiKey = process.env.OMNL_API_KEY?.trim();
if (apiKey && extractBearerOrQuery(req, apiKey)) return true;
const dashKey = process.env.OMNL_DASHBOARD_TOKEN?.trim();
@@ -69,18 +72,14 @@ export function omnlRequireApiKeyInProduction(req: Request, res: Response, next:
return;
}
const key = process.env.OMNL_API_KEY?.trim();
if (!key) {
if (!key && !process.env.OMNL_SUPER_ADMIN_OFFICE24_KEY) {
res.status(503).json({
error: 'OMNL_API_KEY required in production',
hint: 'Set OMNL_API_KEY and pass Authorization: Bearer <key>',
error: 'OMNL super-admin API keys required in production',
hint: 'Run scripts/deployment/seed-omnl-super-admin-keys.sh',
});
return;
}
if (extractBearerOrQuery(req, key)) {
next();
return;
}
if (isComplianceConsolePath(req.path) && hasOmnlOperatorAuth(req)) {
if (hasOmnlOperatorAuth(req)) {
next();
return;
}