Files
it_cost_dashboard/src/lib/authz.ts
T
Tom Chien (IQ-AS)andClaude Opus 4.6 b3d48198c4 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>
2026-11-17 14:00:45 +08:00

14 lines
500 B
TypeScript

// Role model for the app. Access is either full "admin" or read-only "user".
export type Role = "admin" | "user";
// 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 {
if (a.length !== b.length) return false;
let mismatch = 0;
for (let i = 0; i < a.length; i++) {
mismatch |= a.charCodeAt(i) ^ b.charCodeAt(i);
}
return mismatch === 0;
}