Skip to content

Commit 25fb06a

Browse files
committed
Update default configuration for JWT and auth cookie settings
1 parent aad7629 commit 25fb06a

1 file changed

Lines changed: 54 additions & 31 deletions

File tree

docs/deployment/default-configuration.adoc

Lines changed: 54 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,26 @@ basicAuthMechanism:
9090
enabled: true
9191
authenticator: mongoRealmAuthenticator
9292
93+
# JWT Configuration Provider
94+
# Provides consistent JWT settings (key, algorithm, issuer, audience) across all JWT components
95+
# See https://restheart.org/docs/security/authentication#jwt-authentication
96+
jwtConfigProvider:
97+
enabled: true
98+
key: null # null = auto-generate secure random key (recommended for single-node)
99+
# For clustered deployments, set the same key on all nodes
100+
algorithm: HS256 # Supported: HS256, HS384, HS512
101+
issuer: restheart.org
102+
audience: null # null or array of audience strings
103+
93104
# JSON Web Token Authentication
94105
# See https://restheart.org/docs/security/authentication#jwt-authentication
95106
jwtAuthenticationMechanism:
96-
enabled: false
97-
algorithm: HS256
98-
key: secret
107+
enabled: true
99108
base64Encoded: false
100109
usernameClaim: sub
101110
rolesClaim: roles
102111
fixedRoles: []
103112
# - jwt-role
104-
issuer: restheart.org
105-
audience: null
106113
107114
# Digest Authentication
108115
# See https://restheart.org/docs/security/authentication#digest-authentication
@@ -119,7 +126,7 @@ identityAuthMechanism:
119126
enabled: false
120127
username: admin
121128
roles:
122-
- admind
129+
- admin
123130
- user
124131
----
125132

@@ -164,31 +171,38 @@ mongoRealmAuthenticator:
164171
cache-size: 1_000
165172
cache-ttl: 60_000 # in milliseconds
166173
cache-expire-policy: AFTER_WRITE
174+
# List of request parameter names to copy into account properties after successful authentication.
175+
# Useful for copying metadata attached by interceptors (e.g., tenantId, organizationId).
176+
# When omitted or empty, no parameters are copied (default behavior).
177+
# attached-props:
178+
# - tenantId
179+
# - organizationId
167180
168181
# Cookie Authentication
169182
# see: https://restheart.org/docs/security/authentication#cookie-authentication
170183
171-
# Sets auth cookie on successful authentication when '?set-auth-cookie' is present
184+
# Sets auth cookie on POST /token/cookie (or legacy: when '?set-auth-cookie' is present)
172185
# Compatible with both rndTokenManager and jwtTokenManager
173186
authCookieSetter:
174-
enabled: false # Not enabled by default
175-
name: rh_auth # The name of the cookie to be set
176-
domain: localhost # The domain within which the cookie is valid.
177-
path: / # The cookie path, applicable to the entire domain.
178-
http-only: true # If true enhances security by making the cookie inaccessible to JavaScript.
179-
same-site: true # Restricts the cookie to first-party contexts, preventing CSRF attacks.
180-
same-site-mode: strict # Strictly prevents the cookie from being sent along with cross-site requests.
181-
expires-ttl: 86_400 # Defines the duration in seconds for which the cookie is valid (default: 86400 seconds = 1 day). When using jwtTokenManager, this value should match the TTL configured at /jwtTokenManager/ttl.
187+
enabled: true # Enabled by default for /token/cookie endpoint
188+
name: rh_auth # The name of the cookie to be set
189+
domain: localhost # The domain within which the cookie is valid.
190+
path: / # The cookie path, applicable to the entire domain.
191+
http-only: true # If true enhances security by making the cookie inaccessible to JavaScript.
192+
same-site: true # Restricts the cookie to first-party contexts, preventing CSRF attacks.
193+
same-site-mode: strict # Strictly prevents the cookie from being sent along with cross-site requests.
194+
ttl: 15 # Cookie expiration time in minutes (matches jwtTokenManager/ttl)
195+
allow-legacy: false # If true, allows legacy ?set-auth-cookie query parameter on any endpoint (not recommended)
182196
183197
# Creates Authorization header from auth cookie. Compatible with Basic and JWT auth.
184198
authCookieHandler:
185-
enabled: false # Not enabled by default
199+
enabled: true # Enabled by default for cookie-based authentication
186200
187201
# Clears auth cookie on POST /logout, logging out the user
188202
authCookieRemover:
189-
enabled: false # Not enabled by default
190-
secure: false # If request to clean the cookie should be authenticated
191-
defaultUri: /logout # The endpoint that triggers this service.
203+
enabled: true # Enabled by default
204+
secure: false # If request to clean the cookie should be authenticated
205+
defaultUri: /logout # The endpoint that triggers this service.
192206
----
193207

194208
=== Authorizers
@@ -246,22 +260,20 @@ fullAuthorizer:
246260
# Generates and verifies auth tokens. First configured manager is used.
247261
# Token returned via auth-token header on successful authentication.
248262
249-
# rndTokenService generates auth tokens using a random number generator.
263+
# rndTokenManager generates auth tokens using a random number generator.
250264
rndTokenManager:
251-
enabled: true
265+
enabled: false
252266
ttl: 15 # in minutes
253267
srv-uri: /tokens
254268
255269
# jwtTokenManager generates JWT auth tokens.
256270
# Use this in clustered deployments, since all nodes sharing the key
257271
# can verify the token independently
258272
jwtTokenManager:
259-
enabled: false
260-
key: secret
273+
enabled: true
261274
ttl: 15 # in minutes
262-
srv-uri: /tokens
263-
issuer: restheart.org
264-
audience: null
275+
srv-uri: /token
276+
# Note: key, algorithm, issuer, audience configured via jwtConfigProvider
265277
# additional JWT claims from accounts properties
266278
account-properties-claims:
267279
# - foo # property name
@@ -453,6 +465,8 @@ graphql:
453465
# The time limit in milliseconds for processing queries. Set to 0 for no time limit.
454466
query-time-limit: 0 # in milliseconds
455467
verbose: false
468+
# restrict-mapping-db: when enabled, all mappings must use the same db as the GraphQL app definition
469+
restrict-mapping-db: false
456470
457471
# Automatically creates indexes on {"descriptor.uri":1} and {"descriptor.name":1}
458472
# for GraphQL applications to improve query performance when fetching app definitions
@@ -502,10 +516,6 @@ static-resources:
502516

503517
[source,yml]
504518
----
505-
# Service to GET and DELETE (invalidate) the user auth token generated by the TokenManager
506-
authTokenService:
507-
uri: /tokens
508-
509519
# Simple ping service
510520
# Must respond with HTTP 200 OK
511521
# If enable-extended-response is true, returns the following JSON response
@@ -526,8 +536,20 @@ roles:
526536
527537
# A global blacklist for mongodb operators in filter query parameter
528538
filterOperatorsBlacklist:
529-
blacklist: [ "$where" ]
539+
blacklist: ["$where"]
540+
enabled: true
541+
542+
# Aggregation pipeline security settings
543+
aggregationSecurity:
530544
enabled: true
545+
# Block dangerous pipeline stages that can access other databases or execute code
546+
stageBlacklist: ["$out", "$merge", "$lookup", "$graphLookup", "$unionWith"]
547+
# Block dangerous operators within pipeline stages
548+
operatorBlacklist: ["$where", "$function", "$accumulator"]
549+
# Prevent operations that access different databases than the request URI
550+
allowCrossDatabaseOperations: false
551+
# Control JavaScript execution in aggregation pipelines
552+
allowJavaScriptExecution: false
531553
532554
# bruteForceAttackGuard defends from brute force password cracking attacks
533555
# by returning `429 Too Many Requests` when more than
@@ -615,6 +637,7 @@ logging:
615637
metrics:
616638
enabled: true
617639
uri: /metrics
640+
missing-registry-status-code: 404 # use 404 or 200
618641
619642
requestsMetricsCollector:
620643
enabled: false

0 commit comments

Comments
 (0)