Merge pull request 'fix(ci): repair 0pt baseline typecheck and pnpm supply-chain config' (#627) from ci-baseline-fix-20261117 into main
CI (SIAX Cloud) / security (push) Successful in 19s
CI (SIAX Cloud) / Component conformance (blocking) (push) Successful in 9s
masterplan-lock / check (push) Successful in 6s
CI (SIAX Cloud) / sonar (push) Successful in 1m17s
CI (SIAX Cloud) / integration (push) Successful in 1m25s
security / scan (push) Failing after 1m0s
Release chain (G17, ADR-W16-003) / Build, push, G17 (SBOM/scan/attest/verify/evidence) (push) Successful in 1m47s
CI (SIAX Cloud) / quality (push) Successful in 2m14s
Deploy to Coolify / deploy (push) Successful in 2m29s
CI (SIAX Cloud) / security (push) Successful in 19s
CI (SIAX Cloud) / Component conformance (blocking) (push) Successful in 9s
masterplan-lock / check (push) Successful in 6s
CI (SIAX Cloud) / sonar (push) Successful in 1m17s
CI (SIAX Cloud) / integration (push) Successful in 1m25s
security / scan (push) Failing after 1m0s
Release chain (G17, ADR-W16-003) / Build, push, G17 (SBOM/scan/attest/verify/evidence) (push) Successful in 1m47s
CI (SIAX Cloud) / quality (push) Successful in 2m14s
Deploy to Coolify / deploy (push) Successful in 2m29s
This commit was merged in pull request #627.
This commit is contained in:
@@ -16,3 +16,11 @@ packages:
|
||||
onlyBuiltDependencies:
|
||||
- sharp
|
||||
- esbuild
|
||||
|
||||
# Supply-chain hardening (Semgrep p/ci blocking rules):
|
||||
# - no transitive dependency from an untrusted/exotic source
|
||||
# - wait 7 days (10080 min) for newly published versions
|
||||
# - never accept a downgrade of security settings via a dependency update
|
||||
blockExoticSubdeps: true
|
||||
minimumReleaseAge: 10080
|
||||
trustPolicy: no-downgrade
|
||||
|
||||
@@ -70,7 +70,10 @@ export function parseServiceTenants(value: string | undefined | null): string[]
|
||||
|
||||
/** Read the configured service tenant allowlist from the environment. */
|
||||
export function resolveInternalServiceTenants(
|
||||
env: { INTERNAL_SERVICE_TENANTS?: string } = process.env,
|
||||
// @types/node 22's ProcessEnv has only an index signature, so a direct
|
||||
// default is not assignable to the narrow named-property shape. This is a
|
||||
// type-only view of the same object; runtime behaviour is unchanged.
|
||||
env: { INTERNAL_SERVICE_TENANTS?: string } = process.env as { INTERNAL_SERVICE_TENANTS?: string },
|
||||
): string[] {
|
||||
return parseServiceTenants(env.INTERNAL_SERVICE_TENANTS);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,10 @@ function timingSafeEqualStr(a: string, b: string): boolean {
|
||||
*/
|
||||
export function verifyInternalServiceToken(
|
||||
headers: HeaderLookup,
|
||||
env: { INTERNAL_TOKEN?: string } = process.env,
|
||||
// @types/node 22's ProcessEnv has only an index signature, so a direct
|
||||
// default is not assignable to the narrow named-property shape. This is a
|
||||
// type-only view of the same object; runtime behaviour is unchanged.
|
||||
env: { INTERNAL_TOKEN?: string } = process.env as { INTERNAL_TOKEN?: string },
|
||||
): boolean {
|
||||
const expected = env.INTERNAL_TOKEN?.trim();
|
||||
if (!expected) return false;
|
||||
|
||||
@@ -23,6 +23,11 @@ function req(url: string, headers: Record<string, string> = {}): NextRequest {
|
||||
return new NextRequest(new URL(url, 'http://localhost'), { headers });
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. These tests deliberately save
|
||||
// and restore it; a typed mutable view keeps that exact without weakening the
|
||||
// production auth checks under test.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('anonymous-access regression: /api/orders (GET) and /api/admin/metrics (GET)', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -35,8 +40,8 @@ describe('anonymous-access regression: /api/orders (GET) and /api/admin/metrics
|
||||
afterEach(() => {
|
||||
if (saved.auth === undefined) delete process.env.AUTH_ENFORCE;
|
||||
else process.env.AUTH_ENFORCE = saved.auth;
|
||||
if (saved.node === undefined) delete process.env.NODE_ENV;
|
||||
else process.env.NODE_ENV = saved.node;
|
||||
if (saved.node === undefined) delete mutableEnv.NODE_ENV;
|
||||
else mutableEnv.NODE_ENV = saved.node;
|
||||
});
|
||||
|
||||
it('REGRESSION: GET /api/orders 401s with no Authorization header (was: 200 + full order list)', async () => {
|
||||
|
||||
@@ -36,6 +36,11 @@ function h(init: Record<string, string>): Headers {
|
||||
return new Headers(init);
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. These tests deliberately save
|
||||
// and restore it; a typed mutable view keeps that exact without weakening the
|
||||
// fail-closed auth contract under test.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -46,8 +51,8 @@ describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', ()
|
||||
afterEach(() => {
|
||||
if (saved.auth === undefined) delete process.env.AUTH_ENFORCE;
|
||||
else process.env.AUTH_ENFORCE = saved.auth;
|
||||
if (saved.node === undefined) delete process.env.NODE_ENV;
|
||||
else process.env.NODE_ENV = saved.node;
|
||||
if (saved.node === undefined) delete mutableEnv.NODE_ENV;
|
||||
else mutableEnv.NODE_ENV = saved.node;
|
||||
});
|
||||
|
||||
it('REGRESSION: with the variable unset, an unauthenticated request is REJECTED (401)', async () => {
|
||||
@@ -98,7 +103,7 @@ describe('auth default -- fail-closed (no AUTH_ENFORCE in the environment)', ()
|
||||
});
|
||||
|
||||
it('a production process with AUTH_ENFORCE=false cannot serve a request at all (throws)', async () => {
|
||||
process.env.NODE_ENV = 'production';
|
||||
mutableEnv.NODE_ENV = 'production';
|
||||
process.env.AUTH_ENFORCE = 'false';
|
||||
await expect(
|
||||
resolveAuthContext(h({ 'x-tenant-id': 'tenant_attacker' }), { verify: okVerify }),
|
||||
|
||||
@@ -20,6 +20,10 @@ function req(path: string, headers: Record<string, string> = {}): NextRequest {
|
||||
return new NextRequest(new URL(path, 'http://localhost'), { headers });
|
||||
}
|
||||
|
||||
// @types/node 22 declares NODE_ENV readonly. This key is one of the three
|
||||
// restored below; a typed mutable view keeps that exact.
|
||||
const mutableEnv = process.env as Record<string, string | undefined>;
|
||||
|
||||
describe('middleware.ts: internal-token path for /api/0pt/quality/bridge-run', () => {
|
||||
const saved = { auth: process.env.AUTH_ENFORCE, internal: process.env.INTERNAL_TOKEN, node: process.env.NODE_ENV };
|
||||
|
||||
@@ -31,8 +35,8 @@ describe('middleware.ts: internal-token path for /api/0pt/quality/bridge-run', (
|
||||
afterEach(() => {
|
||||
for (const [k, v] of Object.entries(saved)) {
|
||||
const envKey = k === 'auth' ? 'AUTH_ENFORCE' : k === 'internal' ? 'INTERNAL_TOKEN' : 'NODE_ENV';
|
||||
if (v === undefined) delete process.env[envKey];
|
||||
else process.env[envKey] = v;
|
||||
if (v === undefined) delete mutableEnv[envKey];
|
||||
else mutableEnv[envKey] = v;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user