backend-manager 5.11.6 → 5.11.7
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/package.json +1 -1
- package/src/cli/commands/serve.js +49 -2
- package/src/test/fixtures/firebase-project/.temp/test-mode.json +1 -1
- package/src/test/fixtures/firebase-project/database-debug.log +8 -14
- package/src/test/fixtures/firebase-project/firestore-debug.log +55 -1344
- package/src/test/fixtures/firebase-project/pubsub-debug.log +3 -5
package/package.json
CHANGED
|
@@ -207,14 +207,61 @@ class ServeCommand extends BaseCommand {
|
|
|
207
207
|
const certFile = certFiles.find((f) => !f.includes('-key.pem'));
|
|
208
208
|
|
|
209
209
|
if (keyFile && certFile) {
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
const problem = this._checkCertProblem(certFile);
|
|
211
|
+
|
|
212
|
+
if (!problem) {
|
|
213
|
+
this.log(chalk.gray(' Using existing mkcert certificates from .temp/certs/'));
|
|
214
|
+
return { key: keyFile, cert: certFile };
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
// Stale certs (expired, or issued by a DIFFERENT machine's mkcert CA — e.g.
|
|
218
|
+
// .temp copied over from another Mac) make browsers reject the proxy outright,
|
|
219
|
+
// so the only thing that responds is the internal plain-HTTP firebase port.
|
|
220
|
+
// Wipe and regenerate against THIS machine's trusted CA.
|
|
221
|
+
this.log(chalk.yellow(` Existing certificates are not usable (${problem}) — regenerating...`));
|
|
222
|
+
jetpack.remove(certsDir);
|
|
223
|
+
jetpack.dir(certsDir);
|
|
212
224
|
}
|
|
213
225
|
|
|
214
226
|
// Try to generate with mkcert
|
|
215
227
|
return this._generateMkcertCerts(certsDir);
|
|
216
228
|
}
|
|
217
229
|
|
|
230
|
+
// Returns a reason string when the existing cert must be regenerated, or null
|
|
231
|
+
// when it's usable: unexpired AND signed by this machine's trusted mkcert root CA.
|
|
232
|
+
_checkCertProblem(certFile) {
|
|
233
|
+
const { X509Certificate } = require('crypto');
|
|
234
|
+
const { execSync } = require('child_process');
|
|
235
|
+
|
|
236
|
+
let cert;
|
|
237
|
+
try {
|
|
238
|
+
cert = new X509Certificate(fs.readFileSync(certFile));
|
|
239
|
+
} catch (e) {
|
|
240
|
+
return 'unreadable certificate';
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (new Date(cert.validTo) <= new Date()) {
|
|
244
|
+
return `expired ${cert.validTo}`;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
// Verify the signature chains to the CURRENT mkcert root CA. If mkcert (or its
|
|
248
|
+
// root) isn't available we can't verify — keep the existing certs rather than
|
|
249
|
+
// breaking the no-mkcert fallback path.
|
|
250
|
+
try {
|
|
251
|
+
const caRoot = execSync('mkcert -CAROOT', { encoding: 'utf8' }).trim();
|
|
252
|
+
const ca = new X509Certificate(fs.readFileSync(path.join(caRoot, 'rootCA.pem')));
|
|
253
|
+
|
|
254
|
+
if (!cert.verify(ca.publicKey)) {
|
|
255
|
+
const issuerCN = cert.issuer.split('\n').find((line) => line.startsWith('CN=')) || cert.issuer;
|
|
256
|
+
return `issued by a different CA (${issuerCN})`;
|
|
257
|
+
}
|
|
258
|
+
} catch (e) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
218
265
|
async _generateMkcertCerts(certsDir) {
|
|
219
266
|
try {
|
|
220
267
|
await powertools.execute('which mkcert', { log: false });
|
|
@@ -2,17 +2,11 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
|
|
2
2
|
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by akka.util.Unsafe (file:/Users/ian/.cache/firebase/emulators/firebase-database-emulator-v4.11.2.jar)
|
|
3
3
|
WARNING: Please consider reporting this to the maintainers of class akka.util.Unsafe
|
|
4
4
|
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
16:28:15.229 [NamespaceSystem-akka.actor.default-dispatcher-5] INFO com.firebase.core.namespace.NamespaceActor - demo-backend-manager successfully activated FBKV (SurveyIdle(0)) wait: 1ms, init: 0ms
|
|
14
|
-
16:28:27.505 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
|
|
15
|
-
16:28:27.511 [NamespaceSystem-akka.actor.default-dispatcher-9] INFO com.firebase.core.namespace.Terminator$Terminator - 2 actors left to terminate: demo-backend-manager-default-rtdb, demo-backend-manager
|
|
16
|
-
16:28:27.524 [NamespaceSystem-akka.actor.default-dispatcher-9] INFO com.firebase.core.namespace.NamespaceActor - stopped namespace actor for demo-backend-manager
|
|
17
|
-
16:28:27.524 [NamespaceSystem-akka.actor.default-dispatcher-12] INFO com.firebase.core.namespace.NamespaceActor - stopped namespace actor for demo-backend-manager-default-rtdb
|
|
18
|
-
16:28:27.532 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.
|
|
5
|
+
17:56:43.904 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
|
|
6
|
+
17:56:44.025 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
|
|
7
|
+
17:56:55.055 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO com.firebase.core.namespace.NamespaceActor - demo-backend-manager-default-rtdb successfully activated FBKV (SurveyIdle(0)) wait: 84ms, init: 0ms
|
|
8
|
+
17:56:55.099 [NamespaceSystem-blocking-namespace-operation-dispatcher-6] INFO com.firebase.core.namespace.StateManager - Namespace demo-backend-manager-default-rtdb status Active to Active
|
|
9
|
+
17:57:09.904 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
|
|
10
|
+
17:57:09.909 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO com.firebase.core.namespace.Terminator$Terminator - 1 actors left to terminate: demo-backend-manager-default-rtdb
|
|
11
|
+
17:57:09.913 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO com.firebase.core.namespace.NamespaceActor - stopped namespace actor for demo-backend-manager-default-rtdb
|
|
12
|
+
17:57:09.917 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.
|