You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/developer/design/20250321_password_authentication.md
+15-10Lines changed: 15 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,13 @@ Passwords hashed with `scram-sha-256` will be stored in the configured secret st
43
43
44
44
1. The user sends a username and password to the Materialize server.
45
45
2. The protocol layer will communicate with the coordinator layer to validate the password. (via the adapter Client)
46
-
a. The coordinator layer will check the password against the stored hash. If the password is correct, the user will be authenticated.
47
-
b. If the password is incorrect, the user will be denied access.
46
+
a. The coordinator layer will check the password against the stored hash. If the password is correct, the user will be authenticated.
47
+
b. If the password is incorrect, the user will be denied access.
48
48
49
-
3.**OPTIONAL: Book-Keeping**: Login and failed login requests should be tracked. Metrics should be created to monitor potential security events.
49
+
3.**Audit and Metrics:** Login and failed login requests should be logged. Metrics should be created to monitor potential security events.
50
50
51
51
**Password Rotation or Expiration**: While not currently in scope, the design should allow for additions in the future, such as password rotation and expiration.
52
52
53
-
**Abuse Detection**: Action should be taken action when brute force attempts are detected, either by locking the user or blocking the requesting client IP.
54
-
55
53
### 2. Password Management Syntax:
56
54
57
55
Users should be able to manage their passwords and set passwords for roles they create. Superusers should be able to alter any non-internal user's password.
@@ -87,7 +85,10 @@ Users should be able to manage their passwords and set passwords for roles they
-Wemustuse at least 32 bytes of cryptographically random data for salts.
90
+
91
+
-**OPTIONAL:PasswordVersioning**:Updates to the password hashing mechanisms may be required.
91
92
-For passwords received in plain text we should be able re-encrypt them with stronger algorithms.
92
93
-For client side challenges we may be able to increase the number of hash iterations.
93
94
We will already be storing the necessary password hashing metadata to perform these actions.
@@ -101,7 +102,7 @@ Passwords for `mz_system`(v1) and `mz_support`(TBD) roles will be configurable v
101
102
102
103
Environmentd's HTTP endpoint will have added support for session-based authentication.This includes session creation, storage, and deleting/setting cookies.To handle sessions we should use [tower session-store](https://docs.rs/tower-sessions/latest/tower_sessions/). This should explicitly require secure cookies `.with_secure(true)` when running with TLS.
103
104
Required new endpoints:
104
-
-POST: api/login
105
+
-POST: api/login
105
106
-Accepts username, password AuthenticationHeaders
106
107
- imposes strict rate limiting : returning 429
107
108
- returns 401 on auth failure
@@ -120,7 +121,7 @@ ALTER ROLE ... WITH SUPERUSER;
120
121
ALTERROLE...WITHNOSUPERUSER;
121
122
```
122
123
123
-
A role's superuser state should be stored as a rolsuper along with the user in the catalog. It may make sense to make this an Option<bool>. If the value of rolsuper is not `Some(v)` then we defer to metadata if we're using frontegg auth.
124
+
A role's superuser state should be stored as a rolsuper along with the user in the catalog. It may make sense to make this an Option<bool>. If the value of rolsuper is not `Some(v)` then we defer to metadata if we're using frontegg auth.
124
125
125
126
126
127
### Note on Configurable Authentication Mechanism
@@ -130,7 +131,7 @@ The authentication mechanism for an environment must be configurable. A new flag
130
131
131
132
### Note on Console builds:
132
133
133
-
Console does currently do not support runtime or startup configuration. Configuration is handled only at build time. To resolve this we should add a `config.json` or `config.js` file which can be mounted directly into the Nginx container assets. This file should come from a materialize-console config map which must be setup by Orchestratord. We will also need changes to the console to support reading in configuration from this map. The initial config value here should be `authentication_type: password`, in cloud we should use `authentication_type: frontegg` or `authentication_type: jwt`. The console build process can still be used to set default values for this config file.
134
+
Console does currently do not support runtime or startup configuration. Configuration is handled only at build time. To resolve this we should add a `config.json` or `config.js` file which can be mounted directly into the Nginx container assets. This file should come from a materialize-console config map which must be setup by Orchestratord. We will also need changes to the console to support reading in configuration from this map. The initial config value here should be `authentication_type: password`, in cloud we should use `authentication_type: frontegg` or `authentication_type: jwt`. The console build process can still be used to set default values for this config file.
134
135
135
136
136
137
### Note on Emulator Auth:
@@ -151,7 +152,7 @@ A minimal viable prototype (MVP) for this solution will include:
151
152
152
153
1.**Authd Service**: This would involve creating a separate authentication service to handle authentication. This approach is more complex and introduces security concerns, as it would require developing secure endpoints and integrating a user management system that could be prone to additional complexity and security risks.
153
154
154
-
-**Reasons Not Chosen**: This solution is more involved, requiring significant additional work to secure, develop, and maintain. Additionally, it does not align with the Postgres.
155
+
-**Reasons Not Chosen**: This solution is more involved, requiring significant additional work to secure, develop, and maintain. Additionally, it does not align with Postgres.
155
156
156
157
2.**Password Authentication in Ingress Layer**: Using a front-end proxy like PGbouncer or NGINX to handle password authentication before traffic hits Materialize.
157
158
@@ -170,7 +171,11 @@ A minimal viable prototype (MVP) for this solution will include:
170
171
## Open questions
171
172
172
173
1.**Where exactly are passwords stored**: While it makes sense to store passwords in the catalog, I have not yet identified exactly where they should be stored. Should it go alongside `mz_roles`, or in a new `mz_auth_id` table. The latter makes sense as it could store password metadata, and might let us store multiple passwords down the road.
174
+
**A:** In the catalog
173
175
174
176
2.**Audit Logging and Brute Force Detection**: Do we need to log all failed password attempts and the IPs of those attempts? Do we need to take action to lock an IP or User when an attempt threshold is met?
177
+
**A:** yes log attempts and failed attempts along with the password. No mitigation is required, at least not for v1.
175
178
176
179
3.**Password Strength Validation**: Should Materialize include built-in password strength validation, or should it be handled outside the system (e.g., via Kubernetes or other security tools)?
180
+
**A:** MZ should not have built-in password strength, down the road we may want to consider something like postgres's [passwordcheck](https://www.postgresql.org/docs/current/passwordcheck.html
0 commit comments