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
10 changes: 6 additions & 4 deletions charts/dawarich/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,12 @@ initial public administrator. No HTTP server runs during model provisioning.
An existing unsafe demo credential blocks startup and requires explicit repair.

The public proxy forwards to a Rails listener bound exclusively to loopback. It
denies the unconditional native API registration routes, Apple/Google enrollment,
the OAuth web namespace and the public signup page. The chart implements a
local-account policy; enabling an OAuth environment variable does not remove these
guards.
denies the native API registration routes and Apple/Google enrollment. The public
signup page remains denied in every configuration. The OAuth web namespace
(`/users/auth`) is denied while `oidc.enabled` is false; with OIDC enabled the
proxy forwards `/users/auth` to Rails so provider sign-in can complete. The chart
implements a local-account policy: OIDC federation opens only that sign-in
round-trip and never public registration.

A chart-owned initializer uses the Rails middleware extension point to reject
Devise account creation after `Rack::MethodOverride` has interpreted HTML form
Expand Down
5 changes: 4 additions & 1 deletion charts/dawarich/docs/identity.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ rotate their passwords.
## Registration policy

Rails binds only to loopback on port 3010. The public NGINX listener denies native
API registration and Apple/Google enrollment, the signup page and web OAuth routes.
API registration and Apple/Google enrollment, and denies the signup page in every
configuration. The web OAuth namespace (`/users/auth`) is denied while
`oidc.enabled` is false; with OIDC enabled the proxy forwards `/users/auth` so
provider sign-in can complete.
A documented Rails middleware initializer rejects Devise account creation after
`Rack::MethodOverride`, so authenticated profile update and deletion retain their
native HTTP methods. Native registration is also disabled in the cached setting.
Expand Down
3 changes: 2 additions & 1 deletion charts/dawarich/scripts/runtime-smoke.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ try{
assert.deepEqual(listeners,['0100007F:0BC2'],'Native Rails listener must be exclusively IPv4 loopback');
await forward(async base=>{const request=client(base);
assert.equal((await request('/api/v1/health')).status,200);
for(const path of ['/api/v1/auth/register','/api/v1/auth/register.json','/api/v1/auth/register/','/api/v1/auth/%72egister','/api/v1/auth%2fregister','//api/v1/auth/register','/api/v1/auth/apple','/api/v1/auth/google','/users','/users.json','/users/sign_up','/users/auth/openid_connect'])assert.equal((await request(path,{method:'POST',anonymous:true,json:{email:'never-created@example.test',password:'Owned-fixture-never-created'}})).status,403,'Public self-registration route must be denied: '+path);
for(const path of ['/api/v1/auth/register','/api/v1/auth/register.json','/api/v1/auth/register/','/api/v1/auth/%72egister','/api/v1/auth%2fregister','//api/v1/auth/register','/api/v1/auth/apple','/api/v1/auth/google','/users','/users.json','/users/sign_up'])assert.equal((await request(path,{method:'POST',anonymous:true,json:{email:'never-created@example.test',password:'Owned-fixture-never-created'}})).status,403,'Public self-registration route must be denied: '+path);
assert.equal((await request('/users/auth/openid_connect',{method:'POST',anonymous:true,json:{email:'never-created@example.test',password:'Owned-fixture-never-created'}})).status,values.oidc.enabled?422:403,'OAuth web namespace must deny provider enrollment when OIDC is disabled and reject forged provider POSTs when enabled: /users/auth/openid_connect');
assert.equal((await request('/metrics',{anonymous:true})).status,404);
assert.equal((await request('/api/v1/auth/login',{method:'POST',anonymous:true,json:{email:'demo@dawarich.app',password:'safepassword'}})).status,401);
assert.equal((await request('/api/v1/auth/login',{method:'POST',anonymous:true,json:{email:values.bootstrap.email,password:'incorrect-owned-fixture'}})).status,401);
Expand Down
9 changes: 7 additions & 2 deletions charts/dawarich/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@ An identity fingerprint mismatch or unsafe default seed account blocks startup.
kubectl -n {{ .Release.Namespace }} logs deployment/{{ include "dawarich.fullname" . }} -c dawarich
kubectl -n {{ .Release.Namespace }} logs deployment/{{ include "dawarich.fullname" . }} -c worker
Check dependency credentials, PostGIS extensions, CA trust, writable paths and
the configured public origin. Public self-registration and OAuth routes are closed
by the chart's documented local-account policy.
the configured public origin. Public self-registration is closed by the chart's
documented local-account policy.
{{- if .Values.oidc.enabled }}
OAuth sign-in routes under /users/auth are forwarded; public signup stays closed.
{{- else }}
OAuth routes under /users/auth are closed alongside public signup.
{{- end }}

Happy Helmforging :)
4 changes: 4 additions & 0 deletions charts/dawarich/templates/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ data:
server_name _;
client_max_body_size {{ .Values.proxy.bodySize }};
location ~ ^/api/v1/auth/(register|apple|google)([/.]|$) { return 403; }
{{- if .Values.oidc.enabled }}
location ~ ^/users/sign_up([/.]|$) { return 403; }
{{- else }}
location ~ ^/users/(sign_up|auth)([/.]|$) { return 403; }
{{- end }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
location ~ ^/metrics([/.]|$) { return 404; }
location / {
proxy_pass http://127.0.0.1:3010;
Expand Down
26 changes: 26 additions & 0 deletions charts/dawarich/tests/oidc_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@ tests:
path: stringData.clientSecret
value: super-secret

- it: renders the strict nginx policy blocking the oauth web namespace when oidc is disabled
template: templates/runtime.yaml
set:
oidc.enabled: false
asserts:
- matchRegex:
path: data['nginx.conf']
pattern: 'location ~ \^/users/\(sign_up\|auth\)\(\[/\.\]\|\$\) \{ return 403; \}'
- matchRegex:
path: data['nginx.conf']
pattern: 'location ~ \^/users/sign_up\(\[/\.\]\|\$\) \{ return 403; \}'
not: true

- it: renders the nginx policy forwarding the oauth web namespace when oidc is enabled
template: templates/runtime.yaml
set:
oidc.enabled: true
asserts:
- matchRegex:
path: data['nginx.conf']
pattern: 'location ~ \^/users/sign_up\(\[/\.\]\|\$\) \{ return 403; \}'
- matchRegex:
path: data['nginx.conf']
pattern: 'location ~ \^/users/\(sign_up\|auth\)\(\[/\.\]\|\$\) \{ return 403; \}'
not: true

- it: injects OIDC environment variables into web and worker workloads
template: templates/deployment.yaml
set:
Expand Down
Loading