Skip to content

Commit d7b02dc

Browse files
apply linter
1 parent 295c6ce commit d7b02dc

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

src/config/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,10 @@ export class AdapterConfig<T extends SettingsDefinitionMap = SettingsDefinitionM
667667
value: new RegExp(
668668
((this.settings as Record<string, ValidSettingValue>)[name]! as string)
669669
// Escaping potential special characters in values before creating regex
670-
.replace(
671-
/[-[\]{}()*+?.,\\^$|#\s]/g,
672-
'\\$&',
673-
)
670+
.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
674671
// Escaping special case for new line characters. This is needed to properly match and censor private keys,
675672
// ssh keys, and other multi-line string values.
676-
.replace(
677-
/\n/g,
678-
'\\n',
679-
),
673+
.replace(/\n/g, '\\n'),
680674
'gi',
681675
),
682676
}))

test/config.test.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import {
77
SettingsDefinitionMap,
88
} from '../src/config'
99
import { validator } from '../src/validation/utils'
10-
import { Adapter } from "../src/adapter";
11-
import { buildSettingsList } from "../src/util/settings";
10+
import { Adapter } from '../src/adapter'
11+
import { buildSettingsList } from '../src/util/settings'
1212

1313
test.afterEach(async () => {
1414
process.env = {}
@@ -192,7 +192,8 @@ test.serial('sensitive configuration constants are properly flagged', (t) => {
192192

193193
test.serial('multiline sensitive configuration constants are properly redacted', async (t) => {
194194
// GIVEN
195-
process.env['PRIVATE_KEY'] = '-----BEGIN PRIVATE KEY-----\nthis\nis a fake\nprivate key\nused for testing only==\n-----END PRIVATE KEY-----'
195+
process.env['PRIVATE_KEY'] =
196+
'-----BEGIN PRIVATE KEY-----\nthis\nis a fake\nprivate key\nused for testing only==\n-----END PRIVATE KEY-----'
196197
const customSettings: SettingsDefinitionMap = {
197198
PRIVATE_KEY: {
198199
description: 'Test custom env var',
@@ -204,8 +205,8 @@ test.serial('multiline sensitive configuration constants are properly redacted',
204205
},
205206
fn: (_?: string) => {
206207
return ''
207-
}
208-
}
208+
},
209+
},
209210
},
210211
}
211212
const config = new AdapterConfig(customSettings)
@@ -214,7 +215,7 @@ test.serial('multiline sensitive configuration constants are properly redacted',
214215
config.buildCensorList()
215216

216217
const adapter = new Adapter({
217-
name: "TEST_ADAPTER",
218+
name: 'TEST_ADAPTER',
218219
endpoints: [],
219220
config: config,
220221
})
@@ -224,5 +225,5 @@ test.serial('multiline sensitive configuration constants are properly redacted',
224225
const settingEntries = settingsList.filter((entry) => entry.name === 'PRIVATE_KEY')
225226
t.assert(settingEntries.length === 1)
226227
const settingEntry = settingEntries[0]
227-
t.assert(settingEntry.value === "[PRIVATE_KEY REDACTED]")
228-
})
228+
t.assert(settingEntry.value === '[PRIVATE_KEY REDACTED]')
229+
})

0 commit comments

Comments
 (0)