Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ const dotenv = require('dotenv')
const provider = new ethers.providers.JsonRpcProvider(bscProvider)

const evmPrivateKey = process.env.EVM_PRIVATE_KEY
console.log(evmPrivateKey)
const signer = new ethers.Wallet(evmPrivateKey, provider)
const bnbAddress = await signer.getAddress()

Expand Down
18 changes: 18 additions & 0 deletions src/__tests__/SecretLogging.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fs from 'fs'
import path from 'path'

describe('secret handling examples', () => {
it('does not print EVM private keys in tests or documentation', () => {
const repoRoot = path.resolve(__dirname, '..', '..')
const filesToCheck = [
'README.md',
path.join('src', '__tests__', 'WBGL.test.ts')
]

for (const file of filesToCheck) {
const source = fs.readFileSync(path.join(repoRoot, file), 'utf8')
expect(source).not.toMatch(/console\.log\([^)]*EVM_PRIVATE_KEY/i)
expect(source).not.toMatch(/console\.log\([^)]*evmPrivateKey/i)
}
})
})
2 changes: 0 additions & 2 deletions src/__tests__/WBGL.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import WBGLBridgeSDK, {
import { WBGLBGLExchangePair } from '../bridge/WBGL'

expect.extend(matchers)

console.log(process.env.evmPrivateKey)
describe('WBGL class tests on Ethereum', () => {

let WBGLSDKInstance: WBGLBridgeSDK
Expand Down