@friggframework/core 2.0.0--canary.654.ebad223.0 → 2.0.0--canary.654.3cd4278.0
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.
- package/logs/__fixtures__/secrets.js +56 -19
- package/logs/__fixtures__/vectors.js +3 -3
- package/logs/redact.js +1 -1
- package/package.json +5 -5
|
@@ -1,22 +1,59 @@
|
|
|
1
|
-
// Fake values
|
|
1
|
+
// Fake values, generated at load time so secret scanners find no literal in
|
|
2
|
+
// the source. A fixed seed per name keeps every run identical.
|
|
3
|
+
const MIXED = 'BCDFGHJKLMNPQRSTVWXZbcdfghjkmnpqrstvwxz23456789';
|
|
4
|
+
const HEX = '0123456789abcdef';
|
|
5
|
+
|
|
6
|
+
function seededRandom(name) {
|
|
7
|
+
let seed = [...name].reduce(
|
|
8
|
+
(h, c) => Math.imul(h ^ c.charCodeAt(0), 16777619),
|
|
9
|
+
2166136261
|
|
10
|
+
);
|
|
11
|
+
return () => {
|
|
12
|
+
seed = (seed + 0x6d2b79f5) | 0;
|
|
13
|
+
let t = Math.imul(seed ^ (seed >>> 15), seed | 1);
|
|
14
|
+
t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
|
|
15
|
+
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function draw(name, alphabet, length) {
|
|
20
|
+
const next = seededRandom(name);
|
|
21
|
+
let out = '';
|
|
22
|
+
for (let i = 0; i < length; i += 1) {
|
|
23
|
+
out += alphabet[Math.floor(next() * alphabet.length)];
|
|
24
|
+
}
|
|
25
|
+
return out;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// The fixed 'Zq' + 'B7k' start puts upper case, lower case and a digit in every token.
|
|
29
|
+
function fakeToken(name, length = 28) {
|
|
30
|
+
return `ZqB7k${draw(name, MIXED, length - 5)}`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const base64url = (value) => Buffer.from(value).toString('base64url');
|
|
34
|
+
|
|
2
35
|
const SECRETS = Object.freeze({
|
|
3
|
-
bearer: '
|
|
4
|
-
apiKeyQuery: '
|
|
5
|
-
friggApiKey: '
|
|
6
|
-
cookie: '
|
|
7
|
-
oauthCode: '
|
|
8
|
-
codeVerifier: '
|
|
9
|
-
password: '
|
|
10
|
-
clientSecret: '
|
|
11
|
-
accessToken: '
|
|
12
|
-
refreshToken: '
|
|
13
|
-
idToken: '
|
|
14
|
-
hashword: '
|
|
15
|
-
dbPassword: '
|
|
16
|
-
signature: '
|
|
17
|
-
jwt:
|
|
18
|
-
|
|
19
|
-
|
|
36
|
+
bearer: fakeToken('bearer'),
|
|
37
|
+
apiKeyQuery: fakeToken('apiKeyQuery'),
|
|
38
|
+
friggApiKey: fakeToken('friggApiKey'),
|
|
39
|
+
cookie: fakeToken('cookie'),
|
|
40
|
+
oauthCode: fakeToken('oauthCode'),
|
|
41
|
+
codeVerifier: fakeToken('codeVerifier'),
|
|
42
|
+
password: fakeToken('password'),
|
|
43
|
+
clientSecret: fakeToken('clientSecret'),
|
|
44
|
+
accessToken: fakeToken('accessToken'),
|
|
45
|
+
refreshToken: fakeToken('refreshToken'),
|
|
46
|
+
idToken: fakeToken('idToken'),
|
|
47
|
+
hashword: fakeToken('hashword'),
|
|
48
|
+
dbPassword: fakeToken('dbPassword'),
|
|
49
|
+
signature: fakeToken('signature'),
|
|
50
|
+
jwt: [
|
|
51
|
+
base64url(JSON.stringify({ alg: 'HS256' })),
|
|
52
|
+
base64url(JSON.stringify({ sub: `fake-${draw('jwtSub', MIXED, 8)}` })),
|
|
53
|
+
base64url(draw('jwtSig', MIXED, 24)),
|
|
54
|
+
].join('.'),
|
|
55
|
+
hexToken: draw('hexToken', HEX, 40),
|
|
56
|
+
base64Run: Buffer.from(draw('base64Run', MIXED, 42)).toString('base64'),
|
|
20
57
|
});
|
|
21
58
|
|
|
22
|
-
module.exports = { SECRETS };
|
|
59
|
+
module.exports = { SECRETS, fakeToken };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
// ADR-048 §14 redaction vectors. Each vector is one log call that carries
|
|
2
2
|
// secrets; the suite asserts that no 8-char window of them reaches a record.
|
|
3
|
-
const { SECRETS: S } = require('./secrets');
|
|
3
|
+
const { SECRETS: S, fakeToken } = require('./secrets');
|
|
4
4
|
const { httpApiV2Event, restV1Event, sqsEvent } = require('./events');
|
|
5
5
|
const { summarizeLambdaEvent } = require('../summarize-event');
|
|
6
6
|
|
|
7
7
|
const secretUrl = `https://api.example.com/v1/items?api_key=${S.apiKeyQuery}`;
|
|
8
|
-
const SIGNATURE_VALUE = '
|
|
8
|
+
const SIGNATURE_VALUE = fakeToken('signatureValue', 27);
|
|
9
9
|
|
|
10
10
|
// Built by concatenation so push protection does not match the prefixes.
|
|
11
|
-
const TOKEN_TAIL = '
|
|
11
|
+
const TOKEN_TAIL = fakeToken('prefixTail', 25);
|
|
12
12
|
const PREFIXED_TOKENS = [
|
|
13
13
|
'sk_' + 'live_' + TOKEN_TAIL,
|
|
14
14
|
'whsec' + '_' + TOKEN_TAIL,
|
package/logs/redact.js
CHANGED
|
@@ -237,7 +237,7 @@ function redactUrl(url) {
|
|
|
237
237
|
)}${redactHash(u.hash)}`;
|
|
238
238
|
}
|
|
239
239
|
if (raw.startsWith('/')) {
|
|
240
|
-
const u = new URL(raw, '
|
|
240
|
+
const u = new URL(raw, 'https://relative.invalid');
|
|
241
241
|
return `${redactPath(raw.match(RAW_RELATIVE_PATH)[0])}${redactParams(
|
|
242
242
|
u.search,
|
|
243
243
|
'?'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/core",
|
|
3
3
|
"prettier": "@friggframework/prettier-config",
|
|
4
|
-
"version": "2.0.0--canary.654.
|
|
4
|
+
"version": "2.0.0--canary.654.3cd4278.0",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
|
|
7
7
|
"@aws-sdk/client-kms": "^3.588.0",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
}
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@friggframework/eslint-config": "2.0.0--canary.654.
|
|
51
|
-
"@friggframework/prettier-config": "2.0.0--canary.654.
|
|
52
|
-
"@friggframework/test": "2.0.0--canary.654.
|
|
50
|
+
"@friggframework/eslint-config": "2.0.0--canary.654.3cd4278.0",
|
|
51
|
+
"@friggframework/prettier-config": "2.0.0--canary.654.3cd4278.0",
|
|
52
|
+
"@friggframework/test": "2.0.0--canary.654.3cd4278.0",
|
|
53
53
|
"@prisma/client": "^6.19.3",
|
|
54
54
|
"@types/lodash": "4.17.15",
|
|
55
55
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
@@ -89,5 +89,5 @@
|
|
|
89
89
|
"publishConfig": {
|
|
90
90
|
"access": "public"
|
|
91
91
|
},
|
|
92
|
-
"gitHead": "
|
|
92
|
+
"gitHead": "3cd42784313ae866c499d7c7549b7c28e39d3045"
|
|
93
93
|
}
|