fireemu 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -34
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ Fireemu is being developed to close these gaps. For example, it provides:
|
|
|
14
14
|
|
|
15
15
|
Fireemu is still in development and does not yet reproduce every feature and behavior of production Firebase. Before relying on Fireemu’s test results in CI or other automated workflows, we recommend differential testing against production Firebase services for the features and critical workflows your application uses. Run the same tests against Fireemu and a dedicated Firebase test project, and check for differences in results and behavior that could affect your application. Use a dedicated test project, not your live production project.
|
|
16
16
|
|
|
17
|
-
See the [capability manifest](https://github.com/t-k/fireemu/blob/v0.
|
|
17
|
+
See the [capability manifest](https://github.com/t-k/fireemu/blob/v0.20.0/crates/fireemu/src/capabilities.json) and [compatibility documentation](https://github.com/t-k/fireemu/blob/v0.20.0/docs/compatibility-contract.md) for supported features, known differences, and the status of compatibility verification.
|
|
18
18
|
|
|
19
19
|
## Quick start
|
|
20
20
|
|
|
@@ -25,7 +25,7 @@ npm install --save-dev fireemu
|
|
|
25
25
|
npx fireemu init
|
|
26
26
|
|
|
27
27
|
# Start the emulator
|
|
28
|
-
# UI (default): http://127.0.0.1:4000
|
|
28
|
+
# UI (default): http://127.0.0.1:4000/ui/
|
|
29
29
|
npx fireemu up
|
|
30
30
|
```
|
|
31
31
|
|
|
@@ -65,18 +65,18 @@ Fireemu supports Cloud Firestore, Firebase Authentication (Identity Platform), C
|
|
|
65
65
|
|---|---|
|
|
66
66
|
| Cloud Firestore | The Enterprise Pipeline API supports a limited subset of read operations. Full-text search supports index definition validation, but local search execution is not supported. |
|
|
67
67
|
| Firebase Authentication (Identity Platform) | Authentication flows that communicate with external identity providers, authorization-code exchange, and SAML XML signature verification are outside the supported scope. These are separate from local authentication behavior and provider configuration. |
|
|
68
|
-
| Cloud Storage for Firebase |
|
|
69
|
-
| Cloud Functions for Firebase | Triggers that depend on unsupported products, such as Realtime Database (deferred), Remote Config, and Data Connect (deferred), cannot run. Storage archive events
|
|
68
|
+
| Cloud Storage for Firebase | Signed-URL and POST-policy signatures are not verified (their expiry and conditions are), object ACLs other than `allUsers` read are not enforced, and IAM and bucket-level public access are not modeled. Object composition (`compose`) and notification configuration are not supported. |
|
|
69
|
+
| Cloud Functions for Firebase | Triggers that depend on unsupported products, such as Realtime Database (deferred), Remote Config, and Data Connect (deferred), cannot run. Storage archive events occur only for a bucket whose versioning was enabled, and their shape is unrecorded. |
|
|
70
70
|
| Cloud Pub/Sub | Schemas, BigQuery and Cloud Storage subscription delivery, and some APIs such as `UpdateTopic` are not supported. |
|
|
71
71
|
| Firebase App Check | Local testing with debug tokens is supported. Real attestation through Play Integrity, App Attest, DeviceCheck, or reCAPTCHA, and replay protection using limited-use tokens, are not supported. |
|
|
72
72
|
|
|
73
|
-
This table highlights key limitations; it is not exhaustive. Check individual API support and conditions with the following command or the [capability manifest](https://github.com/t-k/fireemu/blob/v0.
|
|
73
|
+
This table highlights key limitations; it is not exhaustive. Check individual API support and conditions with the following command or the [capability manifest](https://github.com/t-k/fireemu/blob/v0.20.0/crates/fireemu/src/capabilities.json).
|
|
74
74
|
|
|
75
75
|
```sh
|
|
76
76
|
npx fireemu capabilities
|
|
77
77
|
```
|
|
78
78
|
|
|
79
|
-
See the [Functions support inventory](https://github.com/t-k/fireemu/blob/v0.
|
|
79
|
+
See the [Functions support inventory](https://github.com/t-k/fireemu/blob/v0.20.0/docs/functions-export-inventory.md) for support by trigger type.
|
|
80
80
|
|
|
81
81
|
### Unsupported products
|
|
82
82
|
|
|
@@ -84,6 +84,8 @@ Realtime Database, Firebase Hosting, App Hosting, and Data Connect are not curre
|
|
|
84
84
|
|
|
85
85
|
## Usage
|
|
86
86
|
|
|
87
|
+
`fireemu config show` prints every configuration key in schema order with its effective value and source, using the same configuration discovery as `fireemu up`. Use `--config <path>` or `--firebase-json <path>` to select files, and `--json` for records containing `key`, `value`, `source`, and the schema description. Sources distinguish explicit values, defaults, `productionExact`, derived values, and unset keys. When the runtime does not expose a value, the command uses its explicit file value, its schema default (marked `default (schema)`), or `(unset)` (`null` with source `unset` in JSON). A key the configuration accepts but the daemon does not read (for example `bind`, `limits.catalog`, `firestore.textSearch.*`, `rules.staticLimitChecks`, `auth.enabled` and `trace.*`) has the source `accepted, no effect`: its value is shown as written, or `(unset)`, never as if it were in effect, and a configuration that sets one prints a `note:` line at start-up. `firebaseJson` shows the Firebase configuration file actually selected, including one chosen with `--firebase-json`.
|
|
88
|
+
|
|
87
89
|
### Select services
|
|
88
90
|
|
|
89
91
|
Use `--only` to select the services to start.
|
|
@@ -118,7 +120,7 @@ npx fireemu emulators:exec -- npm test
|
|
|
118
120
|
|
|
119
121
|
### UI
|
|
120
122
|
|
|
121
|
-
The default UI address is `http://127.0.0.1:4000
|
|
123
|
+
The default UI address is `http://127.0.0.1:4000/ui/`. Use `--ui-port` to specify a port.
|
|
122
124
|
|
|
123
125
|
```sh
|
|
124
126
|
# Start the UI on port 4001
|
|
@@ -135,7 +137,7 @@ Use `--ui-port 0` to disable the UI. When automatic UI startup cannot bind the d
|
|
|
135
137
|
|
|
136
138
|
When a Functions codebase is loaded, the Functions page shows registered functions, triggers, invocation results, and logs. You can run scheduled functions immediately or advance the virtual clock to their next scheduled execution.
|
|
137
139
|
|
|
138
|
-
For clock-sensitive and parallel integration tests, [test clocks and independent worlds](https://github.com/t-k/fireemu/blob/v0.
|
|
140
|
+
For clock-sensitive and parallel integration tests, [test clocks and independent worlds](https://github.com/t-k/fireemu/blob/v0.20.0/docs/test-worlds.md) describes explicit Node Date/timer/Cloud Tasks policies and the `fireemu/testing` helper. Separate worlds isolate their clocks, Rules, Functions and service state, including when they use the same project ID.
|
|
139
141
|
|
|
140
142
|
### Export data
|
|
141
143
|
|
|
@@ -177,6 +179,8 @@ The command reports information about the Fireemu binary, UI, Functions runner,
|
|
|
177
179
|
|
|
178
180
|
### Initial setup and reusing `firebase.json`
|
|
179
181
|
|
|
182
|
+
`fireemu init --reference` also writes `fireemu.reference.jsonc`, a commented reference generated from the schema. Fireemu never loads this file. The normal `fireemu.json` stays minimal: copying a reference key into it makes that key explicit, which stops `productionExact` from switching it. Keys without defaults, keys whose presence selects behavior, keys governed by `productionExact`, and keys accepted for forward compatibility that currently have no effect (marked as such in their comment) stay commented out. Combine `--reference` with `--profile` or `--firebase-json` when initializing; with an existing `fireemu.json` and neither of those options, only the reference is written. Existing output files require `--force` to replace.
|
|
183
|
+
|
|
180
184
|
`fireemu init` creates `fireemu.json` in the current directory. The interactive setup lets you choose a compatibility profile and whether to reuse an existing `firebase.json`.
|
|
181
185
|
|
|
182
186
|
When reusing `firebase.json`, Fireemu references the file rather than copying its settings. Rules, indexes, Functions codebases, and emulator ports are read from it each time Fireemu starts.
|
|
@@ -262,12 +266,15 @@ Fireemu is mostly run by tests, in CI and on a developer's machine. Where produc
|
|
|
262
266
|
| Development default | Key | With `productionExact` |
|
|
263
267
|
|---|---|---|
|
|
264
268
|
| Unsigned emulator custom tokens are accepted | `auth.allowUnsignedCustomTokens` | refused |
|
|
265
|
-
| Firestore and Storage Security Rules accept `@firebase/rules-unit-testing`'s unsigned mock ID token (`authenticatedContext()`, the client SDK's `mockUserToken`) | `auth.allowUnsignedIdTokens` |
|
|
266
|
-
| Identity-provider sign-in accepts the fixture assertions and the sign-in widget (`/emulator/auth/handler`), for built-in, `oidc.*` and `saml.*` providers | `auth.idpAssertions` (`"fixture"`) | `"signed"`: OIDC ID tokens must verify with an `auth.idpSigners` key, SAML responses with the provider's certificates, and the fixture and built-in providers are refused |
|
|
267
|
-
| The strict Eventarc listener admits any credential or none, so the Admin SDK publishes with a fake credential (see [Eventarc authentication](https://github.com/t-k/fireemu/blob/v0.
|
|
268
|
-
| A query whose composite index is not defined (or is still building, or was deleted) runs, and each missing index is reported once per database on stderr with production's refusal text and the `firestore.indexes.json` entry | `firestore.missingIndexes` (`"report"`) | refused with `FAILED_PRECONDITION` and the console link (`"refuse"`) |
|
|
269
|
+
| Firestore and Storage Security Rules accept `@firebase/rules-unit-testing`'s unsigned mock ID token (`authenticatedContext()`, the client SDK's `mockUserToken`) | `auth.allowUnsignedIdTokens` | mock-token fallback disabled; normally verified fireemu-issued tokens still accepted |
|
|
270
|
+
| Identity-provider sign-in accepts the fixture assertions and the sign-in widget (`/emulator/auth/handler`), for built-in, `oidc.*` and `saml.*` providers; under `strict` an `oidc.*` or `saml.*` provider must still be configured and enabled (`auth.providers` or the Admin API), as production requires | `auth.idpAssertions` (`"fixture"`) | `"signed"`: OIDC ID tokens must verify with an `auth.idpSigners` key, SAML responses with the provider's certificates, and the fixture and built-in providers are refused |
|
|
271
|
+
| The strict Eventarc listener admits any credential or none, so the Admin SDK publishes with a fake credential (see [Eventarc authentication](https://github.com/t-k/fireemu/blob/v0.20.0/docs/eventarc-authentication.md)) | `eventarc.authentication` (`"permissive"`) | `"production"`: a missing, malformed or JWT-shaped bearer is refused with production's 401 |
|
|
269
272
|
| A tenant of `auth.tenants` can have any readable id, such as `tenant-a` | `auth.tenantIdFormat` (`"readable"`) | the id must have production's generated form, the display name, a hyphen and five characters of `a-z0-9` (`"generated"`) |
|
|
273
|
+
| Multi-tenancy is on: the Admin API creates tenants and `auth.tenants` loads without an `updateConfig` call | `auth.multiTenant.allowTenants` (`true`) | unset until it is enabled, as in a new production project: tenant routes are refused and `auth.tenants` needs `allowTenants: true` |
|
|
274
|
+
| Multi-factor authentication is on, SMS and TOTP, without a console toggle, an `updateConfig` call or an `auth.mfa` block | `auth.mfa` (`state: "ENABLED"`, `PHONE_SMS` and TOTP) | off until enabled, as in a new production project: enrollment is refused with `OPERATION_NOT_ALLOWED : SMS based MFA not enabled.` or `TOTP based MFA not enabled.` |
|
|
270
275
|
| An end user's native gRPC `Listen` stream stays open however long it is held. `POST /v1/firestore/listen:expire` on the control API ends every held end-user stream at once, with production's status, to test a client's reconnect | `firestore.listenStreamLifetime` (`"unlimited"`) | ended with `INTERNAL` an hour after it opened, as production ends it (`"oneHour"`) |
|
|
276
|
+
| App Check is served without registering an app: any well-formed debug token (a UUIDv4) exchanges for any app, so an `enforceAppCheck` callable works with no `appCheck` block and a missing or malformed token is still refused | `appCheck.debugTokens` (`"any"`) | only registered apps and digests exchange (`"registered"`); an `appCheck` block asks for this too |
|
|
277
|
+
| Dead-letter forwarding needs neither a project number nor IAM grants | `pubsub.deadLetterAuthorization` (`"implicit"`) | forwarded only after the service agent holds `roles/pubsub.subscriber` on the subscription and `roles/pubsub.publisher` on the dead-letter topic (`"iam"`); naming `pubsub.projectNumbers` selects it |
|
|
271
278
|
|
|
272
279
|
The start banner and `fireemu capabilities` report whether `productionExact` is set.
|
|
273
280
|
|
|
@@ -279,15 +286,15 @@ Keep `"profile": "strict"` (the default of `fireemu init`), and point fireemu at
|
|
|
279
286
|
|
|
280
287
|
When a test fails under `strict` but passed on the official emulator, it is usually behavior the application would also meet in production. Fix the test or the application, or relax only the specific setting below instead of switching the whole profile.
|
|
281
288
|
|
|
282
|
-
- **Unsigned emulator ID tokens** (`@firebase/rules-unit-testing` `authenticatedContext()`, the client SDK's `mockUserToken`) work under `strict` by default. Set `auth.allowUnsignedIdTokens` to `false` to
|
|
283
|
-
- **Composite indexes** are validated as production does, and
|
|
289
|
+
- **Unsigned emulator ID tokens** (`@firebase/rules-unit-testing` `authenticatedContext()`, the client SDK's `mockUserToken`) work under `strict` by default. Set `auth.allowUnsignedIdTokens` to `false` to disable their fallback on the Security Rules surfaces. For a refusal test, use the SDK helper's default `iat: 0` / `exp: 3600` with a clock after expiry; fireemu-issued tokens that pass normal verification are still accepted. Use `auth.idTokenSigning: "session-rsa"` to refuse all unsigned ID tokens.
|
|
290
|
+
- **Composite indexes** are validated as production does: a query whose index is not defined (or is still building, or was deleted) is refused with `FAILED_PRECONDITION` and the console link to the index. Declare the index a query needs in `firestore.indexes.json`, referenced from `firebase.json`. To run such a query anyway and have each missing index reported once per database on stderr (with production's refusal text and the `firestore.indexes.json` entry), set `firestore.missingIndexes` to `"report"`; `productionExact` does not change this key.
|
|
284
291
|
- **Settings that mirror your production project.** Set them to match it instead of switching the profile:
|
|
285
292
|
|
|
286
293
|
| Setting | What it does under `strict` |
|
|
287
294
|
|---|---|
|
|
288
295
|
| `auth.improvedEmailPrivacy` | Email enumeration protection, on for a new production project. Set `false` only if your production project turned it off; sign-ins then answer `EMAIL_NOT_FOUND` and `INVALID_PASSWORD` as the official Auth emulator does |
|
|
289
|
-
| `auth.mfa` | Your project's multi-factor configuration (an object, see [Enable multi-factor authentication at start](#enable-multi-factor-authentication-at-start)). `strict` starts with multi-factor off
|
|
290
|
-
| `firestore.enforceLimits` | Production always enforces the Standard edition query limits. `false` lets queries pass that production refuses, so leave it on unless you have a specific reason |
|
|
296
|
+
| `auth.mfa` | Your project's multi-factor configuration (an object, see [Enable multi-factor authentication at start](#enable-multi-factor-authentication-at-start)). `strict` starts with SMS and TOTP enabled as a development default, `productionExact` starts with multi-factor off as a new production project does, and the official emulator has no TOTP at all. A declared block always decides, so `{"state": "DISABLED"}` makes enrollment fail as it does in a project that never enabled it |
|
|
297
|
+
| `firestore.enforceLimits` | Production always enforces the Standard edition query limits. `false` lets queries pass that production refuses, so leave it on unless you have a specific reason. Under `strict` it switches only the query limits |
|
|
291
298
|
|
|
292
299
|
### Basic configuration
|
|
293
300
|
|
|
@@ -311,7 +318,7 @@ You can also name the configuration file with `--config`.
|
|
|
311
318
|
npx fireemu up --config ./fireemu.json
|
|
312
319
|
```
|
|
313
320
|
|
|
314
|
-
Keep Fireemu-specific settings in a Fireemu configuration file containing `"schemaVersion": 1`, rather than in `firebase.json`. See the [configuration schema](https://github.com/t-k/fireemu/blob/v0.
|
|
321
|
+
Keep Fireemu-specific settings in a Fireemu configuration file containing `"schemaVersion": 1`, rather than in `firebase.json`. See the [configuration schema](https://github.com/t-k/fireemu/blob/v0.20.0/spec/config/fireemu.schema.json) for all available settings.
|
|
315
322
|
|
|
316
323
|
### Firebase Authentication (Identity Platform) configuration
|
|
317
324
|
|
|
@@ -333,22 +340,22 @@ The `auth` section of `fireemu.json` lets you configure sign-in methods, passwor
|
|
|
333
340
|
| Blocking functions before account creation or sign-in, and credential forwarding to those functions | `auth.blockingFunctions` |
|
|
334
341
|
| Initial custom OIDC and SAML provider resources | `auth.providers.oidc`, `auth.providers.saml` |
|
|
335
342
|
| Accept unsigned emulator custom tokens (default `true` in both profiles, `false` with `productionExact`) | `auth.allowUnsignedCustomTokens` |
|
|
336
|
-
|
|
|
343
|
+
| Allow unsigned mock ID token fallback after normal verification fails in Firestore and Storage Security Rules (default `true` in both profiles, `false` with `productionExact`; normally verified fireemu-issued tokens remain accepted) | `auth.allowUnsignedIdTokens` |
|
|
337
344
|
| Accept the fixture identity-provider assertions and sign-in widget (`"fixture"`, the default in both profiles), or verify signed assertions as production does (`"signed"`, `strict` only; the default with `productionExact` or `auth.idpSigners`) | `auth.idpAssertions` |
|
|
338
345
|
| Public keys for verifying custom tokens and OIDC ID tokens | `auth.customTokenSigners`, `auth.idpSigners` |
|
|
339
346
|
| Sign-up quota configuration and local quota-exceeded simulation | `auth.quota`, `auth.quotaSimulation` |
|
|
340
347
|
|
|
341
348
|
Unsigned custom tokens minted by the Firebase Admin SDK in emulator mode are accepted by default, including with the recommended `strict` profile and with `auth.customTokenSigners` configured. To require signed custom tokens, set `auth.allowUnsignedCustomTokens` to `false` and configure `auth.customTokenSigners` with the service accounts' public JWK sets. The setting applies only to custom-token sign-in; strict claim checks and signed-token verification still apply. In the `emulator` profile, setting it to `false` also disables JSON fake custom tokens.
|
|
342
349
|
|
|
343
|
-
The unsigned mock ID token of `@firebase/rules-unit-testing` is accepted by default when Firestore and Storage Security Rules are evaluated, including with the `strict` profile. This is the token `authenticatedContext()` and the client SDKs' `mockUserToken` option send (`createMockUserToken` in `@firebase/util`). Under `strict` only
|
|
350
|
+
The unsigned mock ID token of `@firebase/rules-unit-testing` is accepted by default when Firestore and Storage Security Rules are evaluated, including with the `strict` profile. This is the token `authenticatedContext()` and the client SDKs' `mockUserToken` option send (`createMockUserToken` in `@firebase/util`). Normal verification runs first. Only after it fails can the mock-token fallback accept a token. Under `strict` that fallback accepts only the exact SDK shape: a JWT whose header is exactly `{"alg":"none","type":"JWT"}` and whose signature is empty. `request.auth` is built from the token's claims, as the official emulator builds it, when the token names a subject (`sub`) and its audience (`aud`) is the project the request goes to. Its `exp` is not checked, because the SDK sets `iat: 0` and `exp: 3600` by default. Every other token is verified as before, expiry included. That covers the unsigned ID tokens fireemu itself issues (their header carries `typ`, not `type`), and a token that claims a signature that does not verify is still refused. The `emulator` profile accepts any unsigned token, as the official emulator does, and its Storage also accepts another project's token. Set `auth.allowUnsignedIdTokens` to `false` (in either profile) or set `productionExact` to disable this fallback. Neither setting refuses fireemu-issued unsigned ID tokens that pass normal verification. Changing only an issued token's header to the SDK shape can still pass normal verification of its payload; it is not a refusal test. For a refusal test, use `createMockUserToken` with its default `iat: 0` / `exp: 3600`, or construct that exact header and empty signature with those times, a subject and the routed project as audience, and run with a clock after expiry (including Firestore's 30-second allowance). A session with `auth.idTokenSigning: "session-rsa"` accepts no unsigned token. The setting does not affect callable Functions, Identity Toolkit or App Check.
|
|
344
351
|
|
|
345
|
-
See the [configuration schema](https://github.com/t-k/fireemu/blob/v0.
|
|
352
|
+
See the [configuration schema](https://github.com/t-k/fireemu/blob/v0.20.0/spec/config/fireemu.schema.json) for the format and accepted values of each setting.
|
|
346
353
|
|
|
347
|
-
Declare `auth.authorizedDomains`, for example `["localhost", "app.test"]`, to set the initial project-wide list in either profile. The list replaces the defaults, so include `localhost` if your tests use it. An empty list authorizes no host under `strict`; an absent or `null` setting keeps the existing defaults (`localhost` and the project's `firebaseapp.com` and `web.app` domains). Validation uses the Admin API's rules for the selected profile, including its conversion of numeric and boolean entries to strings and omission of `null` entries; use strings when writing the list. Fireemu intentionally keeps `localhost` in its defaults for development. The [recorded production sandbox baseline](https://github.com/t-k/fireemu/blob/v0.
|
|
354
|
+
Declare `auth.authorizedDomains`, for example `["localhost", "app.test"]`, to set the initial project-wide list in either profile. The list replaces the defaults, so include `localhost` if your tests use it. An empty list authorizes no host under `strict`; an absent or `null` setting keeps the existing defaults (`localhost` and the project's `firebaseapp.com` and `web.app` domains). Validation uses the Admin API's rules for the selected profile, including its conversion of numeric and boolean entries to strings and omission of `null` entries; use strings when writing the list. Fireemu intentionally keeps `localhost` in its defaults for development. The [recorded production sandbox baseline](https://github.com/t-k/fireemu/blob/v0.20.0/conformance/auth-action-production.json) does not include it; new production projects may also omit it. This default is a Fireemu-only convenience, and declaring the list replaces it. Tenant-scoped strict action links currently check the tenant's default domains rather than this project declaration; support for the parent project's live list is pending.
|
|
348
355
|
|
|
349
356
|
An Admin update changes the live list. A session reset restores the declared list, when present, and preserves an Admin-written list when no initial list was declared. Projects created later receive the declaration word for word, independently of the default project's live list; listing a particular project's `firebaseapp.com` or `web.app` domain therefore gives later projects that same domain. Clearing accounts leaves the live list alone. Auth export/import carries accounts without the domain list or its declaration. The `emulator` profile accepts the setting and exposes the list, while continuing to allow action-link continue URLs outside it.
|
|
350
357
|
|
|
351
|
-
Declare project OIDC and SAML resources with `auth.providers.oidc` and `auth.providers.saml`, using the Admin v2 resource fields and an ID-only `name` such as `oidc.fixture` or `saml.fixture`. Full resource names are refused. For example, `"providers": {"oidc": [{"name": "oidc.fixture", "enabled": true, "clientId": "local-client", "issuer": "https://issuer.test", "responseType": {"idToken": true}}]}` initializes that provider in both profiles. By default both profiles accept the fixture assertions the official emulator accepts (a JSON or unsigned ID token, a JSON SAML response, the sign-in widget)
|
|
358
|
+
Declare project OIDC and SAML resources with `auth.providers.oidc` and `auth.providers.saml`, using the Admin v2 resource fields and an ID-only `name` such as `oidc.fixture` or `saml.fixture`. Full resource names are refused. For example, `"providers": {"oidc": [{"name": "oidc.fixture", "enabled": true, "clientId": "local-client", "issuer": "https://issuer.test", "responseType": {"idToken": true}}]}` initializes that provider in both profiles. By default both profiles accept the fixture assertions the official emulator accepts (a JSON or unsigned ID token, a JSON SAML response, the sign-in widget); the emulator profile accepts them whether or not the provider is declared, and the strict profile refuses an `oidc.*` or `saml.*` provider that is not declared (or is disabled), as production does. With `auth.idpAssertions` set to `"signed"` (or `productionExact`, or `auth.idpSigners` present), strict OIDC sign-in needs matching public issuer keys in `auth.idpSigners`; no key is fetched. Strict SAML then uses the declared provider certificates and retains its existing assertion checks.
|
|
352
359
|
|
|
353
360
|
Each declared array replaces that provider kind; `[]` explicitly starts it empty, while an absent or `null` kind declares no initial resources. Admin operations change live resources until a session reset restores the declared kinds. Later session and routed projects inherit the declaration independently of the default project's live changes. Tenant resources and built-in providers remain separate. Clearing accounts preserves live resources; snapshots and Auth export/import transfer no provider resources or declarations. The emulator profile continues to accept its unsigned fixture credentials without requiring configured or enabled provider resources. These declarations require a canonical document with `"schemaVersion": 1`; a Firebase deployment `auth.providers` section without that version remains deployment data and installs no provider seeds.
|
|
354
361
|
|
|
@@ -413,7 +420,7 @@ These settings are separate from creating the project or tenant. Naming a tenant
|
|
|
413
420
|
|
|
414
421
|
#### Enable multi-factor authentication at start
|
|
415
422
|
|
|
416
|
-
Under the `strict` profile, TOTP is enabled only through the project's MFA configuration, as in production, so `auth.totp` alone enables nothing there. Use `auth.mfa` to declare
|
|
423
|
+
Under the `strict` profile, TOTP is enabled only through the project's MFA configuration, as in production, so `auth.totp` alone enables nothing there. By default that configuration is on (SMS and TOTP enabled), so a test needs nothing to enrol a second factor; `productionExact` starts a project with multi-factor off, as production does until it is enabled. Use `auth.mfa` to declare the configuration in the file instead of calling the Admin API in every session, to turn multi-factor off (`{"state": "DISABLED"}`), or to enable only what your production project does. It has the shape Identity Platform uses (`state`, `enabledProviders`, and `providerConfigs` with `totpProviderConfig.adjacentIntervals`):
|
|
417
424
|
|
|
418
425
|
```json
|
|
419
426
|
{
|
|
@@ -431,14 +438,14 @@ Under the `strict` profile, TOTP is enabled only through the project's MFA confi
|
|
|
431
438
|
```
|
|
432
439
|
|
|
433
440
|
- The configuration applies when the daemon starts, in both profiles, and to every project created afterward (not the default project's current value). It is validated as the Admin API validates an update of `mfa`, and a value production would refuse stops the daemon at startup.
|
|
434
|
-
- Nothing else changes. An Admin API update replaces the current configuration, and disabling MFA refuses TOTP as production does. A tenant follows its own `mfaConfig`, not this setting.
|
|
435
|
-
- `POST /v1/sessions/{session}/reset` returns the project to the declared configuration.
|
|
441
|
+
- Nothing else changes. An Admin API update replaces the current configuration, and disabling MFA refuses TOTP as production does. A tenant follows its own `mfaConfig`, not this setting. The accepted TOTP window stays `auth.totp.windowSteps` unless the configuration sets `adjacentIntervals`.
|
|
442
|
+
- `POST /v1/sessions/{session}/reset` returns the project to the declared configuration, or to the default (SMS and TOTP enabled) when none is declared. Under `productionExact` without `auth.mfa`, a reset leaves a configuration set through the Admin API alone, as it does the rest of the project configuration. `DELETE /emulator/v1/projects/{project}/accounts` clears accounts only.
|
|
436
443
|
- An export does not carry the project's `mfa` configuration, so an imported project keeps its own `auth.mfa` or Admin-set configuration.
|
|
437
|
-
- The `emulator` profile keeps `auth.totp` working. Under `strict`, `auth.totp`
|
|
444
|
+
- The `emulator` profile keeps `auth.totp` working. Under `strict`, `auth.totp` is enough by default; under `productionExact`, or with an `auth.mfa` that leaves TOTP off, it prints a startup warning naming `auth.mfa`.
|
|
438
445
|
|
|
439
446
|
#### Enable multi-tenancy
|
|
440
447
|
|
|
441
|
-
|
|
448
|
+
Multi-tenancy works by default under both profiles: a new project allows tenants, so the Admin API creates them and `auth.tenants` loads without `multiTenant.allowTenants`. `productionExact` (`strict` only) starts a project as production does, with the switch unset until it is enabled through the Admin API, or with `auth.multiTenant` in the file (see "Start with tenants" below). A declared `allowTenants: false` always turns it off. See the [compatibility documentation](https://github.com/t-k/fireemu/blob/v0.20.0/docs/compatibility-contract.md) for the supported Admin API scope.
|
|
442
449
|
|
|
443
450
|
#### Start with tenants
|
|
444
451
|
|
|
@@ -464,7 +471,7 @@ Instead of creating tenants through the Admin API in every session, declare the
|
|
|
464
471
|
|
|
465
472
|
- A document is read by the code the Admin tenant create route reads one with, so a value production refuses stops the daemon at startup. The tenants are created empty, in file order, and settings such as `mfaConfig` and `passwordPolicyConfig` come from the document. The file is stricter than the route in the `emulator` profile: it also refuses an unknown member and a missing or invalid `displayName`, as production does.
|
|
466
473
|
- A declared tenant has what an Admin create with that document gives: an omitted `allowPasswordSignup`, `enableEmailLinkSignin` or `enableAnonymousUser` is off and multi-factor is off. A tenant the `emulator` profile creates on the way for a request that names an unknown id gets the official emulator's defaults instead (all three on, `PHONE_SMS` multi-factor), so declare what your test needs.
|
|
467
|
-
- Under the `strict` profile tenants are created only in a project that allows them, as in production
|
|
474
|
+
- Under the `strict` profile tenants are created only in a project that allows them, as in production. A new project allows them by default; with `productionExact`, or with `allowTenants: false` declared, `auth.tenants` needs `auth.multiTenant.allowTenants: true` (the daemon refuses to start otherwise). The `emulator` profile takes tenants without the switch.
|
|
468
475
|
- The default project and every session project (`POST /v1/sessions`) start with the declared switch and tenants. `POST /v1/sessions/{session}/reset` (the default session's included) creates them again, empty, and returns the switch to the declared value; without these keys a reset leaves an Admin-set switch alone. A namespace the `emulator` profile creates for an unknown project id (as the official emulator does) starts with the declared switch and tenants too: it is created by the requests that already created one (a user, a provider or a project setting written there) and by a request that writes a tenant there (creating one, or naming one that does not exist yet), not by a read alone. A session created for that project id (`POST /v1/sessions`) replaces the namespace, tenants included, and starts with the declared ones.
|
|
469
476
|
- With `--import`, an imported tenant is authoritative for its id, and a declared tenant the import did not carry is still created. If you keep re-importing your own export (`--import dir --export-on-exit dir`), an edit to a declared tenant is therefore ignored once its exported copy exists: the daemon prints a warning naming the tenant when the imported tenant's document differs from the declared one (every setting the file can declare is compared). The switch is the other way round: a declared `allowTenants` wins over the import. After a reset the declared version of a tenant comes back, not the imported one.
|
|
470
477
|
|
|
@@ -489,7 +496,9 @@ A schedule is driven by the virtual clock alone: real time passing runs nothing.
|
|
|
489
496
|
|
|
490
497
|
A manual run (`POST /v1/sessions/{session}/functions/{name}:run`) enqueues one run of a scheduled function stamped with the current virtual time. It does not consume the next occurrence, which still comes due and is subject to `scheduler.overlap` like any run. It answers `400 INVALID_ARGUMENT` for an unknown function, a function that is not scheduled, an overlap policy refusal, or a runtime that is shutting down, and `429 RESOURCE_EXHAUSTED` when the event queue is full. This is fireemu's own control, not a claim about production's run-now.
|
|
491
498
|
|
|
492
|
-
|
|
499
|
+
On a task-queue function (`onTaskDispatched`), the same `POST /v1/sessions/{session}/functions/{name}:run` releases the Cloud Tasks that wait for their `scheduleTime`: all of them, or the one named by a `{"task": "<task id>"}` body (404 when no waiting task has that id). Under the strict profile a task enqueued with a `scheduleTime` waits for it, so this is how a test runs a task due in an hour without moving the clock; a released task still obeys the queue's rate and concurrency limits. The Functions page of the Emulator UI lists the waiting tasks with their due time and a **Run now** button.
|
|
500
|
+
|
|
501
|
+
See the [configuration schema](https://github.com/t-k/fireemu/blob/v0.20.0/spec/config/fireemu.schema.json) for available settings and values.
|
|
493
502
|
|
|
494
503
|
### Firestore history limits
|
|
495
504
|
|
|
@@ -567,7 +576,7 @@ Fireemu is compatible with the listed Local Emulator Suite products as shipped b
|
|
|
567
576
|
|
|
568
577
|
The `strict` and `emulator` profiles differ in some behaviors to serve their respective purposes. Where the official emulator and production Firebase disagree, Fireemu also adopts production behavior in some cases and records the difference.
|
|
569
578
|
|
|
570
|
-
Check support for the specific APIs and conditions your application uses, rather than relying on product names alone. The [compatibility contract](https://github.com/t-k/fireemu/blob/v0.
|
|
579
|
+
Check support for the specific APIs and conditions your application uses, rather than relying on product names alone. The [compatibility contract](https://github.com/t-k/fireemu/blob/v0.20.0/spec/compatibility/contract.json) records scope and known differences. The [compatibility documentation](https://github.com/t-k/fireemu/blob/v0.20.0/docs/compatibility-contract.md) explains the verification process and how to interpret its records.
|
|
571
580
|
|
|
572
581
|
### Network exposure of the Storage port
|
|
573
582
|
|
|
@@ -594,7 +603,7 @@ By default every listener is on loopback, which a published container port canno
|
|
|
594
603
|
|
|
595
604
|
### Changes between versions
|
|
596
605
|
|
|
597
|
-
Configuration and behavior may change between releases. See the [CHANGELOG](https://github.com/t-k/fireemu/blob/v0.
|
|
606
|
+
Configuration and behavior may change between releases. See the [CHANGELOG](https://github.com/t-k/fireemu/blob/v0.20.0/CHANGELOG.md) for release changes.
|
|
598
607
|
|
|
599
608
|
## Performance
|
|
600
609
|
|
|
@@ -611,7 +620,7 @@ The following results come from one `standard` run at commit `f3b942c`. Ratios a
|
|
|
611
620
|
|
|
612
621
|
The 95% confidence interval for the startup-time ratio is `[21.4, 21.8]`. For the peak-memory ratio, calculated as official emulator divided by Fireemu, it is `[10.2, 11.1]`.
|
|
613
622
|
|
|
614
|
-
See [benchmark.yml](https://github.com/t-k/fireemu/blob/v0.
|
|
623
|
+
See [benchmark.yml](https://github.com/t-k/fireemu/blob/v0.20.0/.github/workflows/benchmark.yml) for the workflow and [`tools/bench/`](https://github.com/t-k/fireemu/tree/v0.20.0/tools/bench/) for the benchmark implementation.
|
|
615
624
|
|
|
616
625
|
## Reporting issues and contributing
|
|
617
626
|
|
|
@@ -619,8 +628,8 @@ When reporting an issue, include the Fireemu and Firebase SDK versions, the prof
|
|
|
619
628
|
|
|
620
629
|
For compatibility issues, also state whether you are comparing against the actual Firebase service or the official emulator, along with the expected and actual results. Remove credentials and personal information before sharing configuration files or logs.
|
|
621
630
|
|
|
622
|
-
See the [development guide](https://github.com/t-k/fireemu/blob/v0.
|
|
631
|
+
See the [development guide](https://github.com/t-k/fireemu/blob/v0.20.0/docs/development.md) for build and test instructions.
|
|
623
632
|
|
|
624
633
|
## License
|
|
625
634
|
|
|
626
|
-
Fireemu is licensed under the [Apache License 2.0](https://github.com/t-k/fireemu/blob/v0.
|
|
635
|
+
Fireemu is licensed under the [Apache License 2.0](https://github.com/t-k/fireemu/blob/v0.20.0/LICENSE). Third-party notices are listed in [THIRD_PARTY_LICENSES.txt](https://github.com/t-k/fireemu/blob/v0.20.0/THIRD_PARTY_LICENSES.txt).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fireemu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.20.0",
|
|
4
4
|
"description": "A local runtime for testing Firebase SDK and Functions code, checked against production Firebase behavior",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"emulator",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
],
|
|
32
32
|
"type": "module",
|
|
33
33
|
"optionalDependencies": {
|
|
34
|
-
"@fireemu/darwin-arm64": "0.
|
|
35
|
-
"@fireemu/darwin-x64": "0.
|
|
36
|
-
"@fireemu/linux-x64": "0.
|
|
37
|
-
"@fireemu/linux-arm64": "0.
|
|
38
|
-
"@fireemu/win32-x64": "0.
|
|
34
|
+
"@fireemu/darwin-arm64": "0.20.0",
|
|
35
|
+
"@fireemu/darwin-x64": "0.20.0",
|
|
36
|
+
"@fireemu/linux-x64": "0.20.0",
|
|
37
|
+
"@fireemu/linux-arm64": "0.20.0",
|
|
38
|
+
"@fireemu/win32-x64": "0.20.0"
|
|
39
39
|
},
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=20"
|