Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ con SvelteKit. Mantener este archivo y `CLAUDE.md` equivalentes en arquitectura
GitOps combina autenticacion y RBAC, organizaciones y proyectos, Open Report de seguridad y
visibilidad de Pulumi State. La ruta Vault es actualmente una base visual sin backend completo.

Google SSO es a nivel de clúster y se configura solo con variables de entorno
Google SSO es a nivel de sistema y se configura solo con variables de entorno
(`GOOGLE_SSO_CLIENT_ID`, `GOOGLE_SSO_CLIENT_SECRET` y, opcionales, `GOOGLE_SSO_ALLOWED_DOMAINS` y
`GOOGLE_SSO_AUTO_PROVISION`), leídas en cada request por `readGoogleSsoConfig()` desde
`src/modules/auth/infrastructure/config/google-sso.config.ts` en `GoogleSsoConfig`; nada se
Expand All @@ -21,7 +21,7 @@ se silencia como deshabilitada y se registra la razón; la UI nunca se rompe. `s
`GoogleOidcClient` y autentica al usuario existente y no deshabilitado por `sub` o email verificado;
vincula el `sub` en `user.authProviders[]` y acepta invitaciones pendientes. Los dominios se
comprueban contra el claim `hd` de Workspace, no email. Con `GOOGLE_SSO_AUTO_PROVISION=true`
(requiere dominios permitidos), una cuenta Workspace desconocida recibe una cuenta `cluster-user`
(requiere dominios permitidos), una cuenta Workspace desconocida recibe una cuenta GitOps User (`cluster-user`)
activa sin organización vía `userAccessService.provisionClusterUser()`. `user.disabled` solo lo
aplica Google sign-in. Templates de notificación (`src/notifications/`) se leen en tiempo de
ejecución. SAML es configuración solo.
Expand Down Expand Up @@ -99,12 +99,12 @@ para obtener flags de lectura de alto nivel que se filtran en AppSidebar según
Roles por defecto en `src/modules/auth/domain/role-permissions.data.ts`. Los permisos incluyen scope
como prefijo (ej: `organization:projects:read`, `project:vault:secrets:all`) y se almacenan verbatim sin
transformaciones. Recursos de módulos tienen sub-permisos granulares (ej: `project:vault:secrets:read`, `project:vault:environments:read`):
- **Cluster Admin**: vault, openreport, stateiac (todos)
- **Cluster User**: sin permisos propios; rol base para acceso a nivel cluster
- **Organization Admin**: todos los permisos de org (proyectos, usuarios, roles, configuración global, backups, server-access-keys, audit)
- **Organization Developer**: solo read/create/update de proyectos
- **Project Admin**: metadata/usuarios/roles/server-keys/audit plus todos los permisos de módulos (vault, codereport, stateiac)
- **Project Developer/Viewer**: acceso granular a módulos con permisos diferenciados (solo lectura en Viewer)
- **GitOps Admin** (`cluster-admin`) — vault, openreport, stateiac (todos)
- **GitOps User** (`cluster-user`) — rol base sin permisos propios para acceso a nivel sistema
- **Organization Admin** — todos los permisos de org (proyectos, usuarios, roles, configuración global, backups, server-access-keys, audit)
- **Organization Developer** — solo read/create/update de proyectos
- **Project Admin** — metadata/usuarios/roles/server-keys/audit plus todos los permisos de módulos (vault, codereport, stateiac)
- **Project Developer/Viewer** — acceso granular a módulos con permisos diferenciados (solo lectura en Viewer)

Los permisos de organización se propagan a sus proyectos solo cuando no hay un assignment explícito a nivel de
proyecto. Un usuario con `organization:projects:read` puede satisfacer `project:project:read` en cualquier
Expand All @@ -114,7 +114,7 @@ aplican (regla most-specific-wins). Permite delegación de autoridad granular co
`canManageOrganization()` controla acceso al area `/settings`, mientras que `canViewOrganization()` incluye
tambien usuarios con acceso solo a proyectos bajo la organización (ven el overview pero no pueden acciones de org-scope).

Al crear una organizacion (via bootstrap o cluster-settings), se llama automaticamente a
Al crear una organización (vía bootstrap o `/gitops-settings`), se llama automáticamente a
`roleService.createDefaultOrganizationRoles()`. Al crear un proyecto, se llama a
`roleService.createDefaultProjectRoles()`. Ambas operaciones inicializan sus roles por defecto.

Expand Down
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GitOps combines identity and access management, organizations and projects, Open
analysis, and Pulumi State visibility. The Vault route is currently a UI foundation and does not
yet provide a complete secrets backend. SAML settings are configuration only.

Google SSO is cluster-wide and configured only through environment variables
Google SSO is system-wide and configured only through environment variables
(`GOOGLE_SSO_CLIENT_ID`, `GOOGLE_SSO_CLIENT_SECRET`, optional `GOOGLE_SSO_ALLOWED_DOMAINS` and
`GOOGLE_SSO_AUTO_PROVISION`), read on every request by `readGoogleSsoConfig()` from
`src/modules/auth/infrastructure/config/google-sso.config.ts` into a `GoogleSsoConfig` domain
Expand All @@ -23,13 +23,13 @@ JWKS via `GoogleOidcClient`, and signs in any existing, non-disabled user found
verified email, linking the `sub` in `user.authProviders[]` and accepting pending invitations on
first sign-in. Allowed domains are checked against the Workspace `hd` claim, not the email suffix.
With `GOOGLE_SSO_AUTO_PROVISION=true` (requires at least one allowed domain), an unknown Workspace
account of an allowed domain gets an active `cluster-user` account with no organization membership
account of an allowed domain gets an active GitOps User (`cluster-user`) account with no organization membership
through `userAccessService.provisionClusterUser()`; organizations still have to invite it.
`user.disabled` is currently enforced only by Google sign-in.

Self-service registration (`/auth/registration`) lets a visitor create a plain `cluster-user`
account with no organization membership. It is gated by a cluster-wide toggle managed at
`/cluster-settings/registration` (persisted via `clusterSettingsService` in `$modules/config`,
Self-service registration (`/auth/registration`) lets a visitor create a plain GitOps User (`cluster-user`)
account with no organization membership. It is gated by a system-wide toggle managed at
`/gitops-settings/registration` (persisted via `clusterSettingsService` in `$modules/config`,
off by default) and re-checked server-side on submit so it can't be bypassed while disabled. Once
registered and signed in, the user lands on `/org`, where the `cluster:organization:create`
permission (granted to `cluster-user` by default) surfaces a "New Organization" action that
Expand Down Expand Up @@ -166,13 +166,13 @@ This ensures the UI only displays navigation items for sections the user has per
Default roles and permissions are centralized in `src/modules/auth/domain/role-permissions.data.ts`.
Permissions always include their scope as a prefix (e.g., `organization:projects:read`,
`project:vault:secrets:all`) and are stored verbatim—there is no scope-stripping transformation:
- **Cluster Admin** (`vault:all`, `openreport:all`, `stateiac:all`)
- **Cluster User** (no inherent permissions; used as base role for cluster-level access)
- **Organization Admin** (all org-level permissions: projects, users, roles, settings, backups, server-keys, audit)
- **Organization Developer** (read/create/update projects only)
- **Project Admin** (all project-level permissions: project metadata, users, roles, server-keys, audit; plus all module permissions: vault secrets/environments, codereport reports/dependencies/vulnerabilities, stateiac stacks/states/history)
- **Project Developer** (read/create/update project resources; no deletion or admin; granular module access)
- **Project Viewer** (read-only: project metadata, all modules, vault secrets/environments, codereport reports/dependencies/vulnerabilities, stateiac stacks/states/history)
- **GitOps Admin** (`cluster-admin`) — grants vault, openreport, stateiac full access
- **GitOps User** (`cluster-user`) — no inherent permissions; base role for system-level access
- **Organization Admin** — all org-level permissions: projects, users, roles, settings, backups, server-keys, audit
- **Organization Developer** — read/create/update projects only
- **Project Admin** — all project-level permissions: project metadata, users, roles, server-keys, audit; plus all module permissions: vault secrets/environments, codereport reports/dependencies/vulnerabilities, stateiac stacks/states/history
- **Project Developer** — read/create/update project resources; no deletion or admin; granular module access
- **Project Viewer** — read-only: project metadata, all modules, vault secrets/environments, codereport reports/dependencies/vulnerabilities, stateiac stacks/states/history

Module resources have granular sub-permissions: `project:vault:secrets:read`, `project:vault:environments:read`, `project:codereport:reports:read`, `project:codereport:dependencies:read`, `project:codereport:vulnerabilities:read`, `project:stateiac:stacks:read`, `project:stateiac:states:read`, `project:stateiac:history:read`. These allow fine-grained access control within each module.

Expand All @@ -186,7 +186,7 @@ Two helpers distinguish organization visibility from management: `canManageOrgan
while `canViewOrganization()` also includes users whose only access is to a project under that organization
(they see the org overview, but cannot perform org-scope actions).

When creating an organization (via bootstrap or cluster settings), `roleService.createDefaultOrganizationRoles()` is
When creating an organization (via bootstrap or `/gitops-settings`), `roleService.createDefaultOrganizationRoles()` is
automatically invoked. When creating a project, `roleService.createDefaultProjectRoles()` is automatically invoked. Both
operations initialize their respective default roles. Keep authorization tests beside changes to permission behavior.
Machine-to-machine requests authenticate with `Authorization: Bearer gvs_...`; `hooks.server.ts`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ in testing mode, only the accounts listed as test users can sign in.

By default only existing or invited users can sign in with Google. With
`GOOGLE_SSO_AUTO_PROVISION=true` (requires at least one allowed domain), the first Google sign-in of
an unknown `@example.com` Workspace account creates a plain cluster user with no organization
an unknown `@example.com` Workspace account creates a plain GitOps User (`cluster-user`) with no organization
membership; organizations still have to invite it. Personal Google accounts are never signed up
automatically, because the domain is checked against the Workspace `hd` claim, not the email
address. If the variables are inconsistent (only one credential set, an invalid domain, or
Expand Down
4 changes: 2 additions & 2 deletions e2e/fixtures/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ function requireSeedSlug(slug: string | null, entity: string): string {

export async function seedAll(): Promise<SeedOutput> {
const clusterAdminRole = await roleService.createRole({
name: 'Cluster Admin',
name: 'GitOps Admin',
slug: 'cluster-admin',
scope: 'cluster',
permissions: CLUSTER_ADMIN_PERMISSIONS,
});
const clusterUserRole = await roleService.createRole({
name: 'Cluster User',
name: 'GitOps User',
slug: 'cluster-user',
scope: 'cluster',
permissions: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { test } from '../fixtures/auth';
import { expectAllowed, expectDenied } from '../fixtures/expect-access';

const clusterRoutes = [
'/cluster-settings/orgs',
'/cluster-settings/roles-permissions',
'/cluster-settings/access-control',
'/cluster-settings/database',
'/cluster-settings/audit',
'/gitops-settings/orgs',
'/gitops-settings/roles-permissions',
'/gitops-settings/access-control',
'/gitops-settings/database',
'/gitops-settings/audit',
];

test.describe('cluster settings — cluster admin', () => {
Expand Down
9 changes: 8 additions & 1 deletion src/hooks.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ const authGuard: Handle = async ({ event, resolve }) => {
return new Response(null, { status: 302, headers: { location: '/bootstrap' } });
}

// legacy URL: the admin area moved from /cluster-settings to /gitops-settings; keep old
// bookmarks working (the new path is still guarded below)
if (pathname === '/cluster-settings' || pathname.startsWith('/cluster-settings/')) {
const location = pathname.replace('/cluster-settings', '/gitops-settings') + event.url.search;
return new Response(null, { status: 308, headers: { location } });
}

// sign-in, sign-out, self-registration, password recovery, invitation acceptance and the Google
// SSO round trip must work without (or with a broken) session; each route re-checks what it needs
if (
Expand Down Expand Up @@ -151,7 +158,7 @@ const authGuard: Handle = async ({ event, resolve }) => {
) {
return new Response(null, { status: 302, headers: { location: '/' } });
}
} else if (event.url.pathname.startsWith('/cluster-settings')) {
} else if (event.url.pathname.startsWith('/gitops-settings')) {
if (!cancanService.canAccessAdminArea(currentUser)) {
return new Response(null, { status: 302, headers: { location: '/' } });
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/AppNavbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
>
{#if !organizationSlug}
<p class="px-4 py-3 text-sm text-slate-400">
{$_('nav.noOrganizationSelected')} <a href="/cluster-settings/orgs" class="underline"
{$_('nav.noOrganizationSelected')} <a href="/gitops-settings/orgs" class="underline"
>{$_('nav.chooseOne')}</a
>.
</p>
Expand Down
18 changes: 9 additions & 9 deletions src/lib/components/AppSidebar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
: [
{
label: $_('sidebar.items.selectOrganization'),
href: '/cluster-settings/orgs',
href: '/gitops-settings/orgs',
icon: Building2,
},
],
Expand Down Expand Up @@ -323,36 +323,36 @@
{
name: $_('sidebar.modules.clusterSettings'),
icon: Building2,
base: '/cluster-settings',
base: '/gitops-settings',
items: [
{
label: $_('sidebar.items.organizations'),
href: '/cluster-settings/orgs',
href: '/gitops-settings/orgs',
icon: Building2,
},
{
label: $_('sidebar.items.rolesAndPermissions'),
href: '/cluster-settings/roles-permissions',
href: '/gitops-settings/roles-permissions',
icon: Shield,
},
{
label: $_('sidebar.items.accessControl'),
href: '/cluster-settings/access-control',
href: '/gitops-settings/access-control',
icon: Users,
},
{
label: $_('sidebar.items.registration'),
href: '/cluster-settings/registration',
href: '/gitops-settings/registration',
icon: KeyRound,
},
{
label: $_('sidebar.items.database'),
href: '/cluster-settings/database',
href: '/gitops-settings/database',
icon: Database,
},
{
label: $_('sidebar.items.auditLog'),
href: '/cluster-settings/audit',
href: '/gitops-settings/audit',
icon: ScrollText,
},
],
Expand Down Expand Up @@ -429,7 +429,7 @@
<a
href={organizationSlug
? `/org/${organizationSlug}/settings/storage`
: '/cluster-settings/orgs'}
: '/gitops-settings/orgs'}
class="flex items-center gap-3 rounded-md border border-amber-200 bg-amber-50 p-3 text-amber-950 transition-colors hover:border-amber-300 hover:bg-amber-100 {collapsed
? 'justify-center'
: 'items-start'}"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/RolePermissions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

function roleDescription(role: RoleRow): string {
if (role.description) return role.description;
if (role.slug === 'cluster-admin') return 'Acceso completo al clúster y todas las organizaciones.';
if (role.slug === 'cluster-admin') return 'Acceso completo a GitOps y a todas las organizaciones.';
if (role.slug === 'cluster-user') return 'Acceso de lectura y gestión de recursos limitados.';
return `${role.permissions.length} permisos configurados.`;
}
Expand Down
Loading
Loading