Commit graph

16 commits

Author SHA1 Message Date
Daniel Noulet
d3ee64282d ci: add Forgejo build and deployment workflows 2026-10-08 10:36:33 +02:00
Daniel Noulet
abb207d608 chore: testing build
Some checks failed
CI/CD / Build and Test (push) Has been cancelled
CI/CD / Integration Tests (push) Has been cancelled
CI/CD / Build and Push Docker Image (push) Has been cancelled
CI/CD / Deploy to PRD (push) Has been cancelled
2026-10-07 21:56:56 +02:00
Daniel Noulet
0f5d582d1f chore: helm configuration 2026-10-07 15:07:22 +02:00
Daniel Noulet
49ab89ae46 refactor: keep tenant applications out of the administrator's reach
Claiming the system administrator role no longer grants access to every
application in the installation. Owning a tenant is what lets an administrator
administer it; entering the applications running inside it is a separate,
explicit grant that can be withdrawn again. Handing it out at claim time gave
every installation a standing administrator account inside every customer
application, which is the opposite of the boundary this product draws.

The behaviour suite now covers single sign-on between applications directly: a
second application on the same tenant must receive a code and identify the same
person with no sign-in page in between, once Go Loose already holds a session.

Also adds theme-token tests against the shared styling contract and store
coverage for application grants, and drops the redundant server and security
scheme declarations from the published specification.
2026-10-05 21:48:05 +02:00
Daniel Noulet
8d8970d5a7 test: drive the whole application over HTTP, and serialise migrations
The behaviour suite in internal/behaviour installs the application into an
empty database through the web installer, signs in, walks every flow, and then
replaces the process to confirm the state was persisted rather than held in
memory. It found four defects, each fixed here or in the preceding commit:

- Migrate was not safe to run from two instances at once. CREATE TABLE IF NOT
  EXISTS is not race free in PostgreSQL and collided on the pg_type unique
  index, and two replicas could apply the same file. The run now holds a
  session-level advisory lock, so a rolling deployment waits instead of failing.

- Bootstrap refused ownership whenever a tenant held any member, so installing
  with the demonstration seed and then setting a local administrator password
  produced an account that could never reach the console. It now grants
  ownership only while the tenant has no owner, which still never takes a tenant
  over from one that does.

Three of the fixes are covered by store-level regression tests in the same
commit: the ownership rule, the duplicate tenant slug conflict, and concurrent
migration runs.

The suite is skipped by go test ./... because it needs a scratch database and
the Google credentials for the installer. Run it with make behaviour-test, which
also resets the database afterwards. make test no longer inherits the database
variables, so unit runs need nothing.

Completes the earlier correction to the docs: the role matrix lives in the
database rather than in internal/role, and a local administrator claims the
system administrator role when no Google account has.
2026-10-05 19:37:09 +02:00
Daniel Noulet
c7c81fb65c feat: account menu, database roles, and single logout
Bundles the console work from the current branch: the header account
control, database-backed roles and permissions, and signing out across
the applications that share this sign-in.

The account control replaces a separate identity chip and a separate
sign-out button, which meant the header carried two controls describing
one fact. web/account.js is mounted into every page by a placeholder and
owns the keyboard handling, the outside-click behaviour and the sign-out
form once. It also fills the trigger's name, which the previous markup
left empty.

Signing out revokes the hosted-login bearer sessions this installation
issued, then redirects to the provider's end_session_endpoint when the
discovery document advertises one. Applications that authenticate
against this installation therefore lose their session too; one pointed
straight at an identity provider is out of its reach and is unchanged.

Roles and permissions become rows rather than a closed enum, so a tenant
can extend the catalog without a migration, and a role can no longer be
granted a capability that is not in it. requireSameOrigin now compares
against the origin the request arrived on instead of the configured base
URL, which defaulted to http://localhost:8080 and so rejected every
write in a deployment that never set it.

Two bugs found while verifying in a browser:

  - A profile picture never rendered. avatarURL built an absolute URL
    from the configured base URL, and the page's own img-src 'self'
    blocked it. The console's own pages now take a root-relative path;
    only /connect/userinfo, read from another origin, needs an absolute
    one, and it follows the request.
  - absoluteURL preferred the configuration over the request while its
    comment claimed the opposite, which also misdirected the logout
    redirect.

Card layout: the footer was one two-column row shared between a label
and a forty-character identifier, so the identifier took the width and
crushed its label into three stacked words. Each pair is a line now, the
value truncates with the full text in the title, and cards align their
footers across a row.
2026-10-05 19:18:07 +02:00
Daniel Noulet
3fdc8cb489 roles 2026-10-04 16:57:30 +02:00
Daniel Noulet
6319da650c fix installer 2026-10-04 12:24:13 +02:00
Daniel Noulet
318fb51085 fix: changing url 2026-10-04 11:02:23 +02:00
Daniel Noulet
b984c8a90c feat: read the identity domain from the environment
Compose hardcoded auth.dev, so rehearsing a deployment meant editing a
tracked file and losing the change on the next pull. Read the three domain
values from the environment with the default kept at auth.dev, so a plain
docker compose up behaves exactly as before.
2026-10-03 05:17:06 +02:00
Daniel Noulet
84b64310fe doc: modified client-login.md 2026-10-03 04:41:03 +02:00
Daniel Noulet
b011701522 adding certificate 2026-10-03 00:45:34 +02:00
Daniel Noulet
c2091e746a fix installer 2026-10-02 21:45:42 +02:00
Daniel Noulet
46030a5b14 fix installer 2026-10-02 18:56:52 +02:00
Daniel Noulet
74b3a382ab adding main.go 2026-10-02 17:51:38 +02:00
Daniel Noulet
54576d9d33 initial commit 2026-10-01 23:15:57 +02:00