Migrate to Gitea + local Docker Desktop k8s/Harbor; remove SSO

- Remove Microsoft Entra ID SSO entirely; local admin credentials login
  is the only sign-in path (fail-closed on empty LOCAL_ADMIN_PASSWORD).
  Delete config/users.json allowlist and lookupRole.
- Move CI from .github to .gitea/workflows (Gitea Actions, runner label
  gitea-runner); drop the k8s-API network debug step.
- Replace JFrog with local Harbor: push/pull via
  host.docker.internal:8080/library, login with HARBOR_* Gitea secrets,
  pull secret renamed to harbor-pull-secret (created by CI per namespace).
- Adapt Helm values to Docker Desktop k8s: storageClassName hostpath,
  Harbor image repositories, *.local ingress hosts, AUTH_URL scheme http
  (configurable via ingress.scheme).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Tom Chien (IQ-AS)
2026-11-17 14:00:45 +08:00
co-authored by Claude Opus 4.6
parent a79a01437a
commit b3d48198c4
16 changed files with 104 additions and 324 deletions
-42
View File
@@ -1,48 +1,6 @@
import fs from "node:fs";
import path from "node:path";
// Role model for the app. Access is either full "admin" or read-only "user".
// NOTE: this module uses node:fs and MUST only be imported from Node runtime
// code (src/auth.ts / server components / API routes) — never from the edge
// middleware, or the edge bundle will fail to compile.
export type Role = "admin" | "user";
// Resolve a user's role from the hand-edited allowlist at config/users.json.
// Emails are matched case-insensitively. This is FAIL CLOSED: a missing file,
// invalid JSON, or an email that is not listed all return null (access denied).
export function lookupRole(email: string | null | undefined): Role | null {
if (!email) return null;
let raw: string;
try {
raw = fs.readFileSync(
path.join(process.cwd(), "config", "users.json"),
"utf8"
);
} catch {
// File missing/unreadable -> deny everyone (local admin is the break-glass).
return null;
}
let parsed: unknown;
try {
parsed = JSON.parse(raw);
} catch {
return null;
}
if (!parsed || typeof parsed !== "object") return null;
// Lowercase every key so the lookup is case-insensitive.
const table: Record<string, Role> = {};
for (const [key, value] of Object.entries(parsed as Record<string, unknown>)) {
if (value === "admin" || value === "user") {
table[key.toLowerCase()] = value;
}
}
return table[email.toLowerCase()] ?? null;
}
// Constant-time string comparison to avoid leaking secrets via timing.
// Pure JS (no node:crypto) so this stays cheap and dependency-free.
export function safeEqual(a: string, b: string): boolean {