Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
API: hardening from a security audit
Duarte Santosfebb2b2b3409
diff --git a/api/coach/cadence.js b/api/coach/cadence.jsindex 7485f20a1..db5398875 100644--- a/api/coach/cadence.js+++ b/api/coach/cadence.js@@ -99,13 +99,15 @@ const hhmmToMin = v => {};/**- * @param {object} deps { users(): [{id}], userNow(tz): {date,hhmm,weekday} }+ * @param {object} deps { users(): [{id}], userNow(tz): {date,hhmm,weekday}, skip?(uid): bool }*/export function startCadence(deps) {const timer = setInterval(() => {if (!cfgStore.isEnabled() || !cfgStore.isConnected()) return;for (const user of deps.users()) {try {+ // A profile that never agreed to the Coach is skipped before its whole state is read.+ if (deps.skip?.(user.id)) continue;const S = jobs.readState(user.id);const coach = S?.coach;if (!coach?.consent?.agreedAt) continue; // consent revoked ⇒ cadence stopsdiff --git a/api/passkeys-store.js b/api/passkeys-store.jsindex 10604b0cf..7e8886585 100644--- a/api/passkeys-store.js+++ b/api/passkeys-store.js@@ -28,7 +28,7 @@ export const passkeyName = v => (typeof v === 'string' ? v : '')// `transports` comes from the browser that made the passkey, which is to say from the request. It// is handed back to browsers as a hint, so only a short list of short words is kept.-const transportsOf = v => (Array.isArray(v) ? v.filter(x => typeof x === 'string' && x.length <= 16).slice(0, 8) : []);+export const transportsOf = v => (Array.isArray(v) ? v.filter(x => typeof x === 'string' && x.length <= 16).slice(0, 8) : []);// What the owner sees of their passkeys: never the public key, which nothing on screen needs.export function listPasskeys(db, userId) {diff --git a/api/server.js b/api/server.jsindex a0b5916fd..0631ebede 100644--- a/api/server.js+++ b/api/server.js@@ -27,7 +27,8 @@ import {} from './password.js';import { createBackoff, createWindow } from './rate-limit.js';import {- listPasskeys, addPasskeyRecord, renamePasskeyRecord, removePasskeyRecord, passkeyRemovalRefused, MAX_PASSKEYS+ listPasskeys, addPasskeyRecord, renamePasskeyRecord, removePasskeyRecord, passkeyRemovalRefused, MAX_PASSKEYS,+ transportsOf,} from './passkeys-store.js';import { createDeviceLink, findDeviceLink, burnDeviceLink, dropDeviceLinks } from './device-link.js';import { createMediaStore, mediaLimits, mediaConfig, MediaError, HASH_RE } from './media.js';@@ -397,10 +398,19 @@ async function sendPush(userId, payload, deviceId) {// In memory only — an API restart drops whatever is pending.const restTimers = new Map(); // `${userId}:${deviceId}` -> Timeoutconst restKey = (userId, deviceId) => `${userId}:${deviceId || ''}`;+// A browser holds one device id, so a person has a timer or two pending, never more than the+// devices they train with. Each request with a new id used to leave another hour-long timer (and+// its push to every id-less subscription) behind, without limit; past this many, the oldest goes.+const MAX_REST_TIMERS_PER_USER = 5;function scheduleRestTimer(userId, deviceId, sec, lang) {const k = restKey(userId, deviceId);const t = restTimers.get(k);if (t) clearTimeout(t);+ restTimers.delete(k); // re-inserted below, so the map stays oldest first+ const mine = [...restTimers.keys()].filter(x => x.startsWith(userId + ':'));+ for (const old of mine.slice(0, Math.max(0, mine.length - MAX_REST_TIMERS_PER_USER + 1))) {+ clearTimeout(restTimers.get(old)); restTimers.delete(old);+ }restTimers.set(k, setTimeout(() => {restTimers.delete(k);sendPush(userId, restTimerPush(lang), deviceId);@@ -497,25 +507,56 @@ function nudgeTick(user, S, now) {saveDb();sendPush(user.id, nudgePush(S.lang, toneOf(S.reminder), routine, now.date));}+// What the tick needs to know before it reads a whole state: the reminder settings and whether+// the Coach was agreed to, kept per user against the state file's mtime and size. The state cache+// above holds at most STATE_CACHE_MAX documents, and the tick walks every subscribed user in the+// same order, so past that many it missed on every lookup and parsed every state every 10 s: a+// handful of accounts with multi-megabyte states stalled the instance for everyone. A summary is+// a few bytes, so there is one for every user, and a full read happens only while one of that+// user's windows is open and something could still be sent.+const stateSummaries = new Map(); // uid -> { mtimeMs, size, rem, consent, settled }+function stateSummary(uid) {+ let st;+ try { st = fs.statSync(stateFile(uid)); } catch { stateSummaries.delete(uid); return null; }+ const had = stateSummaries.get(uid);+ if (had && had.mtimeMs === st.mtimeMs && had.size === st.size) return had;+ const S = readStateCached(uid);+ const r = S?.reminder;+ const sum = {+ mtimeMs: st.mtimeMs, size: st.size,+ rem: r && typeof r === 'object' ? { on: !!r.on, tz: r.tz, time: r.time, nudge: !!r.nudge } : { on: false },+ consent: !!S?.coach?.consent?.agreedAt,+ settled: '', // a local date the reminder was found to owe nothing on, for this file+ };+ stateSummaries.set(uid, sum);+ return sum;+}setInterval(() => {for (const user of db.users) {+ if (user.disabled) continue; // locked out everywhere, reminders includedif (!db.subs.some(s => s.userId === user.id)) continue;// One user's state file is one user's problem: a shape this tick cannot read is logged and// skipped, not allowed to take the process — and everyone else's reminders — down with it.// PUT /api/data refuses the obvious shapes, but a file already on disk answers to nobody.try {+ const sum = stateSummary(user.id);+ if (!sum?.rem.on) continue;+ const now = userNow(sum.rem.tz || 'UTC');+ if (!now) continue;+ const late = minutesLate(sum.rem.time, now);+ const reminderOpen = late >= 0 && late <= REMINDER_WINDOW_MIN && user.lastReminder !== now.date && sum.settled !== now.date;+ const nudgeOpen = sum.rem.nudge && user.lastNudge !== now.date && nudgeWindowOpen(sum.rem.time, now.hhmm);+ if (!reminderOpen && !nudgeOpen) continue;const S = readStateCached(user.id);if (!S?.reminder?.on) continue;- const now = userNow(S.reminder.tz || 'UTC');- if (!now) continue;- nudgeTick(user, S, now);- const late = minutesLate(S.reminder.time, now);- if (!(late >= 0 && late <= REMINDER_WINDOW_MIN)) continue;- if (user.lastReminder === now.date) continue;- if ((S.workouts || []).some(w => w?.d === now.date)) continue;- if (excusedOn(S, now.date)) continue; // noted as sick, away, … (nudge.js excusedOn)+ if (nudgeOpen) nudgeTick(user, S, now);+ if (!reminderOpen) continue;+ // Nothing below depends on anything but the file, so an answer of "nothing owed today"+ // holds until the file changes (which drops the summary) or the date does.+ if ((S.workouts || []).some(w => w?.d === now.date)) { sum.settled = now.date; continue; }+ if (excusedOn(S, now.date)) { sum.settled = now.date; continue; } // noted as sick, away, … (nudge.js excusedOn)const rid = effectiveRoutineId(S, now.date);- if (!rid) continue; // rest day — nothing planned+ if (!rid) { sum.settled = now.date; continue; } // rest day — nothing plannedconst routine = (S.routines || []).find(r => r?.id === rid);console.log('reminder firing', user.id, rid);user.lastReminder = now.date;@@ -550,9 +591,14 @@ function verifySig(token) {// signing out the whole instance. Cookies minted before `sv` existed have no third field and are// read as version 0, matching a user who has never bumped — they stay valid until they expire.const sessionVersion = user => user.sv || 0;-function makeSession(user) {+// A fourth field says what the token was made for: `c` a browser's cookie, `b` a paired phone's+// bearer. Both verify the same way and either works in either place, but only a phone's token is+// renewed (GET /api/me): a cookie value replayed as a bearer used to be traded for a fresh 90-day+// token whenever it was past half its life, so a stolen cookie never had to expire. Tokens from+// before the field have none and are renewed as before; the cookies among them expire on their own.+function makeSession(user, kind = 'b') {const exp = Date.now() + SESSION_DAYS * 86400000;- return sign(user.id + ':' + exp + ':' + sessionVersion(user));+ return sign(user.id + ':' + exp + ':' + sessionVersion(user) + ':' + kind);}// With the __Host- prefix the *browser* guarantees the cookie is host-only (no Domain attribute// is even allowed) — which is what stops a sibling subdomain, e.g. anything-else.example.com@@ -604,7 +650,7 @@ function sessionUser(tok) {if (!tok) return null;const payload = verifySig(tok);if (!payload) return null;- const [uid, exp, ver] = payload.split(':');+ const [uid, exp, ver, kind] = payload.split(':');if (!uid || +exp < Date.now()) return null;const user = db.users.find(u => u.id === uid) || null;if (!user) return null;@@ -613,7 +659,7 @@ function sessionUser(tok) {// payload (it still had to pass the HMAC, so this is belt-and-braces) and is refused outright.const claimed = ver === undefined ? 0 : Number(ver);if (!Number.isInteger(claimed) || claimed !== sessionVersion(user)) return null;- return { user, exp: +exp };+ return { user, exp: +exp, kind: kind || null };}function readSession(req) {return sessionOf(req)?.user || null;@@ -629,7 +675,7 @@ function requireAdmin(req, res) {}const expireCookie = name => `${name}=; Path=/; Max-Age=0; HttpOnly;${SECURE} SameSite=Lax`;function sessionCookie(user) {- const fresh = `${COOKIE}=${makeSession(user)}; Path=/; Max-Age=${SESSION_DAYS * 86400}; HttpOnly;${SECURE} SameSite=Lax`;+ const fresh = `${COOKIE}=${makeSession(user, 'c')}; Path=/; Max-Age=${SESSION_DAYS * 86400}; HttpOnly;${SECURE} SameSite=Lax`;// Signing in also retires any pre-upgrade cookie, so nobody is left carrying an unprefixed one// (or a shadowing copy of it) alongside the new session.return COOKIE === LEGACY_COOKIE ? [fresh] : [fresh, expireCookie(LEGACY_COOKIE)];@@ -1339,7 +1385,13 @@ const passwordRoutes = {const problem = passwordProblem(body.password, name);if (problem) return policyError(res, problem);const taken = () => json(res, 409, { error: 'another profile already signs in with this name', code: 'name-taken' });- if (nameTaken(name)) return taken();+ // A name is also matched against every sign-in e-mail (nameTaken), so a name that is an+ // address is the e-mail question asked through the name field: it waits for the hash below+ // and counts against the address like the e-mail field does, or it would answer "in use" for+ // any address at once and without limit.+ const nameIsAddress = name.includes('@');+ if (nameIsAddress && addressPaused(req, res, 'email')) return;+ if (!nameIsAddress && nameTaken(name)) return taken();// An e-mail is optional here. One already in use counts against the address, the way it// does in Settings: this route needs no session, so it is the cheaper place to ask. Whether// it is in use is only answered after the hash and the invite check that follows it, so on@@ -1362,7 +1414,11 @@ const passwordRoutes = {return json(res, 403, { error: 'invite code is no longer valid, ask for a new one', code: 'invite' });}}- if (nameTaken(name)) return taken();+ if (nameTaken(name)) {+ // No name in the row: it is an address, and the log keeps none (maskEmail is for owners).+ if (nameIsAddress) { strikeAddress(req, 'email'); audit(req, 'auth.register.fail', { ok: false, msg: 'email-taken' }); }+ return taken();+ }// No await from here to the push: nothing can take the address between this check and it.if (email && emailTaken(email)) return emailRefused();const created = new Date().toISOString();@@ -1818,6 +1874,17 @@ setInterval(() => {MEDIA_BURST.sweep(); MEDIA_SWEEPS.sweep();for (const [k, until] of mediaThrottleNoted) if (until < Date.now()) mediaThrottleNoted.delete(k);}, 600000).unref();+// Every one of these makes the server send pushes, one per subscription of the account. A+// person taps "send test" a few times and starts a rest after each set; a loop does neither.+const PUSH_TESTS = createWindow({ max: 10, windowMs: 600000 });+const REST_TIMER_SETS = createWindow({ max: 60, windowMs: 60000 });+setInterval(() => { PUSH_TESTS.sweep(); REST_TIMER_SETS.sweep(); }, 600000).unref();+function pushThrottled(res, win, user) {+ const wait = win.take(user.id);+ if (!wait) return false;+ json(res, 429, { error: 'too many requests, try again later', code: 'locked', retryAfter: wait }, { 'Retry-After': String(wait) });+ return true;+}function mediaThrottle(req, user, win) {const wait = win.take(user.id);if (!wait) return;@@ -2000,7 +2067,7 @@ const routes = {const s = sessionOf(req);if (!s) return json(res, 401, { error: 'not signed in' });const { user } = s;- const renew = s.bearer && s.exp - Date.now() < SESSION_DAYS * 86400000 / 2;+ const renew = s.bearer && s.kind !== 'c' && s.exp - Date.now() < SESSION_DAYS * 86400000 / 2;json(res, 200, { user: { id: user.id, name: user.name, admin: isAdmin(user) }, ...(renew ? { token: makeSession(user) } : {}) });},@@ -2073,7 +2140,7 @@ const routes = {id: credential.id, userId: user.id,publicKey: Buffer.from(credential.publicKey).toString('base64url'),counter: credential.counter || 0,- transports: body.credential?.response?.transports || [],+ transports: transportsOf(body.credential?.response?.transports),// What Settings → Passkeys shows (#95); a passkey from before then has neither.created: user.created, lastUsed: user.created});@@ -2410,6 +2477,7 @@ const routes = {'POST /api/push/test': async (req, res) => {const user = readSession(req);if (!user) return json(res, 401, { error: 'not signed in' });+ if (pushThrottled(res, PUSH_TESTS, user)) return;await sendPush(user.id, testPush(readStateCached(user.id)?.lang));json(res, 200, { ok: true });},@@ -2417,6 +2485,7 @@ const routes = {'POST /api/push/rest-timer': async (req, res) => {const user = readSession(req);if (!user) return json(res, 401, { error: 'not signed in' });+ if (pushThrottled(res, REST_TIMER_SETS, user)) return;const body = await readBody(req);// Validated before it is clamped: the clamp used to run first, which turned a missing or// unusable value into a 1-second push and made the 400 below unreachable. `Number()` only@@ -2654,7 +2723,7 @@ coachJobs.setProposalHook((uid, pending) => {tag: 'coach-proposal', url: '#/coach'});});-startCadence({ users: () => db.users, userNow });+startCadence({ users: () => db.users.filter(u => !u.disabled), userNow, skip: uid => !stateSummary(uid)?.consent });startWarmup();// node's requestTimeout is one number for every route, and it is half an hour (below) for the@@ -2711,6 +2780,12 @@ const server = http.createServer(async (req, res) => {let url;try { url = new URL(req.url, 'http://x'); }catch { return json(res, 400, { error: 'bad request' }); }+ // The path routed on has to be the path that was sent. The URL parser turns a backslash into a+ // slash and resolves dot segments; nginx does neither, so `/api/media/..\data` matched nginx's+ // media block (its body size and buffering) and reached `/api/data` here. Any rule the proxy+ // keys on the path could be stepped around the same way. No client sends such a path.+ const sent = req.url.split('?')[0];+ if (sent.startsWith('/') && sent !== url.pathname) return json(res, 400, { error: 'bad request' });let key = req.method + ' ' + url.pathname;// The one route with a parameter in its path. Mapped onto its template key here so the table// above stays a plain lookup, and so csrfOk and the catch-all see one name for every file.diff --git a/api/test/server-email.test.js b/api/test/server-email.test.jsindex 55e17b2eb..53240b5ae 100644--- a/api/test/server-email.test.js+++ b/api/test/server-email.test.js@@ -340,6 +340,20 @@ test('asking over and over whether an address is in use runs into a pause', asynassert.equal((await signIn(h, { identifier: 'bea', password: GOOD }, ip)).status, 200);});+// A name is matched against sign-in addresses too, so signing up with an address as the name+// asked "is this address in use" with no limit at all, ahead of the hash.+test('signing up with an address as the name counts against the address like the e-mail field', async t => {+ const h = await startServer(t, { users: [withPassword('u1', 'Ana', { email: '[email protected]' })] });+ const ip = '203.0.113.70';+ for (let i = 0; i < 21; i++) {+ const r = await h.req('POST', '/api/register/password', { body: { name: '[email protected]', password: GOOD }, ip });+ assert.equal(r.status, 409, 'try ' + i); assert.equal(r.body.code, 'name-taken');+ }+ const r = await h.req('POST', '/api/register/password', { body: { name: '[email protected]', password: GOOD }, ip });+ assert.equal(r.status, 429); assert.equal(r.body.code, 'locked');+ assert.equal(leaks(h, 'example.com'), false);+});+test('a reset code is redeemed with the e-mail as well as with the name', async t => {const code = 'K7WQ-2MZP-4HXA';const reset = () => ({ h: hashResetCode(code), exp: Date.now() + 3600000, by: 'adm' });diff --git a/api/test/server-pairing.test.js b/api/test/server-pairing.test.jsindex e5154ba5e..4573e0c59 100644--- a/api/test/server-pairing.test.js+++ b/api/test/server-pairing.test.js@@ -74,5 +74,5 @@ test('logout/all invalidates the account\'s outstanding pairing codes and nobodyconst fresh = await redeem(await create('u_test_1', 1));assert.equal(fresh.status, 200);const { token } = await fresh.json();- assert.match(token.split('.')[0], /^u_test_1:\d+:1$/);+ assert.match(token.split('.')[0], /^u_test_1:\d+:1:b$/);});diff --git a/api/test/server-push-status.test.js b/api/test/server-push-status.test.jsindex fd7ee9408..f2d2f83cf 100644--- a/api/test/server-push-status.test.js+++ b/api/test/server-push-status.test.js@@ -182,3 +182,62 @@ test('a rest timer belongs to the device that set it: another device cancellingawait new Promise(r => setTimeout(r, 2500));assert.equal(sends(), 3, 'a legacy timer goes to every subscription of the account');});++// Each rest timer is an hour-long setTimeout and a push when it rings. A new device id per+// request used to leave one more behind every time, without limit.+test('an account keeps at most five rest timers; the oldest give way', async t => {+ const h = await startServer(t, [{ userId: 'u_test_1', endpoint: 'https://localhost/any', keys, created: new Date().toISOString() }]);+ const sent = () => (h.log.match(/push send failed u_test_1/g) || []).length;+ for (let i = 0; i < 8; i++) {+ assert.equal((await post(h, '/api/push/rest-timer', { seconds: 1, deviceId: `dev_cap0000${i}` })).status, 200);+ }+ await new Promise(r => setTimeout(r, 2500));+ assert.equal(sent(), 5, `three were dropped before they rang:\n${h.log}`);+});++test('rest timers and test pushes are throttled per account', async t => {+ const h = await startServer(t);+ let last;+ for (let i = 0; i < 61; i++) last = await post(h, '/api/push/rest-timer', { seconds: 3600, deviceId: 'dev_phone000' });+ assert.equal(last.status, 429);+ assert.ok(Number(last.headers.get('retry-after')) >= 1);+ assert.equal((await post(h, '/api/push/rest-timer', { seconds: 3600 }, other)).status, 200, 'another account has its own budget');+ for (let i = 0; i < 10; i++) assert.equal((await post(h, '/api/push/test', {})).status, 200);+ assert.equal((await post(h, '/api/push/test', {})).status, 429);+});++// The URL parser makes `\` a slash and resolves `..`, nginx does not: a path the proxy matched+// as one route must not reach another one here.+test('a path that only normalizes into a route is refused', async t => {+ const h = await startServer(t);+ const net = await import('node:net');+ const raw = p => new Promise((resolve, reject) => {+ const s = net.connect(h.port, '127.0.0.1', () => s.write(`GET ${p} HTTP/1.1\r\nHost: x\r\nCookie: ${cookie.Cookie}\r\nConnection: close\r\n\r\n`));+ let out = ''; s.on('data', d => out += d); s.on('end', () => resolve(out.split(' ')[1])); s.on('error', reject);+ });+ assert.equal(await raw('/api/media/..\\data'), '400');+ assert.equal(await raw('/api/media/../data'), '400');+ assert.equal(await raw('/api/x/./../data'), '400');+ assert.equal(await raw('/api/data'), '200');+ assert.equal(await raw('/api/push/status?endpoint=a/../b'), '200');+});++// A browser's cookie and a phone's token are made the same way, and either is accepted in either+// place. Only a phone's token is renewed, or a cookie copied off a browser could be replayed as a+// bearer and traded for a fresh one for as long as anybody liked.+test('GET /api/me renews a phone token past half its life, never a cookie replayed as one', async t => {+ const h = await startServer(t);+ const mint = (kind, daysLeft) => {+ const payload = `u_test_1:${Date.now() + daysLeft * 86400000}:0${kind ? ':' + kind : ''}`;+ return payload + '.' + crypto.createHmac('sha256', SECRET).update(payload).digest('base64url');+ };+ const me = async tok => (await fetch(`${h.api}/api/me`, { headers: { Authorization: `Bearer ${tok}` } })).json();+ assert.ok((await me(mint('b', 10))).token, 'a phone token is renewed');+ assert.ok((await me(mint('', 10))).token, 'a token from before the mark is renewed as before');+ const renewed = (await me(mint('', 10))).token;+ assert.match(Buffer.from(renewed).toString(), /^u_test_1:\d+:0:b\./, 'and comes back as a phone token');+ const cookie = await me(mint('c', 10));+ assert.equal(cookie.user.id, 'u_test_1', 'a cookie still works as a bearer');+ assert.equal(cookie.token, undefined, 'but is not renewed');+ assert.equal((await me(mint('b', 80))).token, undefined, 'nothing is renewed early');+});diff --git a/api/test/server-reminder.test.js b/api/test/server-reminder.test.jsindex 0b373cc85..7d7205504 100644--- a/api/test/server-reminder.test.js+++ b/api/test/server-reminder.test.js@@ -181,3 +181,43 @@ test('a null entry in workouts or routines does not cost that profile its remindassert.equal(firings(h.log), 1, h.log);assert.doesNotMatch(h.log, /reminder tick u_test_1 TypeError/, h.log);});++// The tick keeps a few bytes per user and reads a whole state only while a window is open and+// something could still be sent. "Nothing owed today" is remembered for the file as it is, so a+// change to the file (here: a rest day turned into a training day) has to be read again.+test('a day that owed nothing is asked again once the state file changes', async t => {+ const late = hhmmMinusMinutes(2);+ if (!late.sameDay) return t.skip('just after midnight UTC — a same-day window cannot be set up');+ const h = await startServer(t, [sub]);+ const file = path.join(h.dataDir, 'state-u_test_1.json');+ fs.writeFileSync(file, goodState(late.hhmm, { week: {} }));+ await wait(1500);+ assert.equal(firings(h.log), 0, `a rest day stays silent:\n${h.log}`);+ fs.writeFileSync(file, goodState(late.hhmm));+ const deadline = Date.now() + 10000;+ while (Date.now() < deadline && !firings(h.log)) await wait(300);+ assert.equal(firings(h.log), 1, h.log);+});++test('a disabled profile gets no reminder', async t => {+ const late = hhmmMinusMinutes(2);+ if (!late.sameDay) return t.skip('just after midnight UTC — a same-day window cannot be set up');+ const h = await startServer(t, [sub]);+ const db = JSON.parse(fs.readFileSync(path.join(h.dataDir, 'db.json'), 'utf8'));+ assert.equal(db.users[0].id, 'u_test_1');+ h.child.kill('SIGKILL');+ db.users[0].disabled = true;+ fs.writeFileSync(path.join(h.dataDir, 'db.json'), JSON.stringify(db));+ fs.writeFileSync(path.join(h.dataDir, 'state-u_test_1.json'), goodState(late.hhmm));+ const child = spawn(process.execPath, ['server.js'], {+ cwd: API, stdio: ['ignore', 'pipe', 'pipe'],+ env: { ...process.env, PORT: '0', DATA_DIR: h.dataDir, ORIGIN: 'http://localhost:8080', RP_ID: 'localhost', REMINDER_TICK_MS: '300' }+ });+ let log = '';+ child.stdout.on('data', d => log += d);+ child.stderr.on('data', d => log += d);+ t.after(() => child.kill('SIGKILL'));+ await boundPort(child, () => log);+ await wait(1500);+ assert.equal(firings(log), 0, log);+});