Skip to content

Commit 8dfed06

Browse files
committed
fix(express): warn when signer mode runs without GPG key pinning
In environments that do not enforce the BitGo GPG public key config (mock, custom, local dev), the signer share is encrypted to any caller-supplied GPG public key. Log a warning at startup so operators of unpinned environments know share encryption accepts any key. References: WAL-2456
1 parent e1439fc commit 8dfed06

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

‎modules/express/src/expressApp.ts‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import express from 'express';
55
import * as path from 'path';
66
import * as _ from 'lodash';
77
import debugLib from 'debug';
8+
import { logger } from '@bitgo/logger';
89
import * as https from 'https';
910
import * as http from 'http';
1011
import morgan, { token as morganToken } from 'morgan';
@@ -27,8 +28,10 @@ import {
2728
} from './errors';
2829

2930
import { Environments } from 'bitgo';
30-
import * as clientRoutes from './clientRoutes';
31+
3132
import { isSameFilePath } from './consumedSharesRegistry';
33+
import * as clientRoutes from './clientRoutes';
34+
import { BitgoMpcGpgPubKeys } from '@bitgo/sdk-core';
3235
import { getBitGoTlsPolicy } from './tlsPolicy';
3336

3437
/**
@@ -257,6 +260,13 @@ function checkPreconditions(config: Config) {
257260
);
258261
}
259262

263+
if (signerMode && !BitgoMpcGpgPubKeys.envRequiresBitgoPubGpgKeyConfig(env)) {
264+
logger.warn(
265+
`External signer mode is running in env '${env}', which does not enforce the ` +
266+
'BitGo GPG public key pin; share encryption will accept any supplied GPG public key.'
267+
);
268+
}
269+
260270
if (signerMode !== undefined && lightningSignerFileSystemPath !== undefined) {
261271
throw new LightningSignerConfigError(
262272
'signerMode and lightningSignerFileSystemPath cannot be set at the same time.'

0 commit comments

Comments
 (0)