Skip to content

Commit 81a2d34

Browse files
Merge pull request #781 from snyk/fix/remove-buffer-constructor-use
fix: remove Buffer constructor use for security reasons
2 parents d13de30 + 8bc35be commit 81a2d34

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.eslintrc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"@typescript-eslint/await-thenable": "error",
1717
"@typescript-eslint/ban-ts-comment": "error",
1818
"@typescript-eslint/no-unnecessary-type-assertion": "error",
19-
"@typescript-eslint/unbound-method": "error"
19+
"@typescript-eslint/unbound-method": "error",
20+
"node/prefer-global/buffer": "off"
2021
}
2122
}

src/scanner/images/credentials.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Buffer } from 'buffer';
12
import * as aws from 'aws-sdk';
23

34
import { logger } from '../../common/logger';
@@ -47,7 +48,7 @@ function getEcrCredentials(region: string): Promise<string> {
4748
);
4849
}
4950

50-
const buff = new Buffer(authorizationTokenBase64, 'base64');
51+
const buff = Buffer.from(authorizationTokenBase64, 'base64');
5152
const userColonPassword = buff.toString('utf-8');
5253
return resolve(userColonPassword);
5354
});

0 commit comments

Comments
 (0)