ag-common 0.0.752 → 0.0.754
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.
|
@@ -279,7 +279,9 @@ const executePartiQLQuery = (params) => __awaiter(void 0, void 0, void 0, functi
|
|
|
279
279
|
Limit: params.limit,
|
|
280
280
|
NextToken: nextToken,
|
|
281
281
|
};
|
|
282
|
-
const result = yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.ExecuteStatementCommand(executeParams)), 'batchQueryDynamo'
|
|
282
|
+
const result = yield (0, withRetry_1.withRetry)(() => _1.dynamoDb.send(new lib_dynamodb_1.ExecuteStatementCommand(executeParams)), 'batchQueryDynamo', {
|
|
283
|
+
maxRetries: params.maxRetries === undefined ? 3 : params.maxRetries,
|
|
284
|
+
});
|
|
283
285
|
if (result.Items) {
|
|
284
286
|
allItems.push(...result.Items);
|
|
285
287
|
}
|
|
@@ -37,6 +37,7 @@ export interface DynamoQueryParams {
|
|
|
37
37
|
limit?: number;
|
|
38
38
|
filter?: DynamoFilter;
|
|
39
39
|
sortAscending?: boolean;
|
|
40
|
+
/** default 3, set to null to disable retries */
|
|
40
41
|
maxRetries?: number | null;
|
|
41
42
|
}
|
|
42
43
|
export interface DynamoBatchQueryParams {
|
|
@@ -46,5 +47,7 @@ export interface DynamoBatchQueryParams {
|
|
|
46
47
|
indexName?: string;
|
|
47
48
|
limit?: number;
|
|
48
49
|
filter?: DynamoFilter;
|
|
50
|
+
/** default 3, set to null to disable retries */
|
|
51
|
+
maxRetries?: number | null;
|
|
49
52
|
}
|
|
50
53
|
export declare const isError: <T>(result: DynamoDBResult<T>) => result is DynamoDBError;
|
|
@@ -46,26 +46,4 @@ export interface ILambdaConfig {
|
|
|
46
46
|
export type ILambdaConfigs = Partial<Record<string, ILambdaConfig & {
|
|
47
47
|
default?: ILambdaConfig;
|
|
48
48
|
}>>;
|
|
49
|
-
export type TSkOperator = 'BETWEEN' | '<' | '<=' | '=' | '>=' | '>' | '<>' | 'BEGINS_WITH';
|
|
50
|
-
export interface IQueryDynamo {
|
|
51
|
-
pkName: string;
|
|
52
|
-
pkValue: string | number;
|
|
53
|
-
/** default, = */
|
|
54
|
-
pkOperator?: string;
|
|
55
|
-
skName?: string;
|
|
56
|
-
skValue?: string | number | string[] | number[];
|
|
57
|
-
/** default, = */
|
|
58
|
-
skOperator?: TSkOperator;
|
|
59
|
-
tableName: string;
|
|
60
|
-
indexName?: string;
|
|
61
|
-
/** default 1000. if null will not apply */
|
|
62
|
-
limit?: number | null;
|
|
63
|
-
startKey?: Key;
|
|
64
|
-
filterName?: string;
|
|
65
|
-
filterValue?: string | number | boolean;
|
|
66
|
-
/** default, = */
|
|
67
|
-
filterOperator?: string;
|
|
68
|
-
/** default = true */
|
|
69
|
-
sortAscending?: boolean;
|
|
70
|
-
}
|
|
71
49
|
export type * from './aws';
|
|
@@ -36,7 +36,17 @@ function logprocess(type, args) {
|
|
|
36
36
|
const log = [
|
|
37
37
|
`[${datetime}]`,
|
|
38
38
|
type,
|
|
39
|
-
...args.filter(array_1.notEmpty).map((s) =>
|
|
39
|
+
...args.filter(array_1.notEmpty).map((s) => {
|
|
40
|
+
// Handle Error instances specially to preserve their message
|
|
41
|
+
if (s instanceof Error) {
|
|
42
|
+
return (0, redact_1.redactObject)({
|
|
43
|
+
message: s.message,
|
|
44
|
+
name: s.name,
|
|
45
|
+
stack: s.stack,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return (0, redact_1.redactObject)(s);
|
|
49
|
+
}),
|
|
40
50
|
];
|
|
41
51
|
if (logShim) {
|
|
42
52
|
logShim(...log);
|
|
@@ -6,10 +6,48 @@ function redactString(str) {
|
|
|
6
6
|
let ret = str;
|
|
7
7
|
ret = ret || '';
|
|
8
8
|
const repl = '$1<redacted>$2';
|
|
9
|
+
// OAuth and authentication tokens
|
|
9
10
|
ret = ret.replace(/(\b)grant_type.+?(\b)/gm, repl);
|
|
10
11
|
ret = ret.replace(/(\b)Bearer .+?(\b)/gm, repl);
|
|
11
|
-
//
|
|
12
|
+
// JWT tokens (base64 with dots)
|
|
12
13
|
ret = ret.replace(/(eyJ[\w-_.]*\.[\w-_.]*\.[\w-_.]*)/gim, '<redacted>');
|
|
14
|
+
// API Keys (various formats)
|
|
15
|
+
ret = ret.replace(/(\b)(sk_live_|sk_test_|pk_live_|pk_test_)[\w-]+/gi, '$1<redacted>'); // Stripe
|
|
16
|
+
ret = ret.replace(/(\b)(AKIA[0-9A-Z]{16})/gi, '$1<redacted>'); // AWS Access Key ID
|
|
17
|
+
ret = ret.replace(/(aws_secret_access_key["\s]*[:=]["\s]*)([0-9a-zA-Z/+]{40})/gi, '$1<redacted>'); // AWS Secret Access Key pattern
|
|
18
|
+
ret = ret.replace(/(\b)(AIza[0-9A-Za-z\\-_]{35})/gi, '$1<redacted>'); // Google API Key
|
|
19
|
+
ret = ret.replace(/(\b)(ya29\.[0-9A-Za-z\\-_]+)/gi, '$1<redacted>'); // Google OAuth Access Token
|
|
20
|
+
ret = ret.replace(/(\b)(glpat-[a-zA-Z0-9\\-_]{20})/gi, '$1<redacted>'); // GitLab Personal Access Token
|
|
21
|
+
ret = ret.replace(/(\b)(ghp_[a-zA-Z0-9]{36})/gi, '$1<redacted>'); // GitHub Personal Access Token
|
|
22
|
+
ret = ret.replace(/(\b)(github_pat_[a-zA-Z0-9]{22}_[a-zA-Z0-9]{59})/gi, '$1<redacted>'); // GitHub Fine-grained PAT
|
|
23
|
+
// Password patterns in key-value pairs
|
|
24
|
+
ret = ret.replace(/(password["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
25
|
+
ret = ret.replace(/(passwd["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
26
|
+
ret = ret.replace(/(pwd["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
27
|
+
ret = ret.replace(/(secret["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
28
|
+
ret = ret.replace(/(token["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
29
|
+
ret = ret.replace(/(^|[^a-zA-Z])(api_?key|private_?key|secret_?key)["\s]*[:=]["\s]*([^",\s}]+)/gi, '$1$2<redacted>');
|
|
30
|
+
ret = ret.replace(/(auth["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
31
|
+
// Database connection strings
|
|
32
|
+
ret = ret.replace(/(mongodb:\/\/[^:]+:)([^@]+)(@)/gi, '$1<redacted>$3');
|
|
33
|
+
ret = ret.replace(/(mysql:\/\/[^:]+:)([^@]+)(@)/gi, '$1<redacted>$3');
|
|
34
|
+
ret = ret.replace(/(postgresql:\/\/[^:]+:)([^@]+)(@)/gi, '$1<redacted>$3');
|
|
35
|
+
ret = ret.replace(/(redis:\/\/[^:]+:)([^@]+)(@)/gi, '$1<redacted>$3');
|
|
36
|
+
// Credit card numbers (basic pattern)
|
|
37
|
+
ret = ret.replace(/(\b)([3-6]\d{3}[\s-]?\d{4}[\s-]?\d{4}[\s-]?\d{3,4})(\b)/g, '$1<redacted>$3');
|
|
38
|
+
// Social Security Numbers (US format)
|
|
39
|
+
ret = ret.replace(/(\b)(\d{3}[-\s]?\d{2}[-\s]?\d{4})(\b)/g, '$1<redacted>$3');
|
|
40
|
+
// Private keys
|
|
41
|
+
ret = ret.replace(/(-----BEGIN [A-Z\s]+PRIVATE KEY-----)([\s\S]*?)(-----END [A-Z\s]+PRIVATE KEY-----)/gi, '$1\n<redacted>\n$3');
|
|
42
|
+
// Session IDs and UUIDs in headers/cookies
|
|
43
|
+
ret = ret.replace(/(sessionid["\s]*[:=]["\s]*)([a-zA-Z0-9]{32,})/gi, '$1<redacted>');
|
|
44
|
+
ret = ret.replace(/(session["\s]*[:=]["\s]*)([a-zA-Z0-9]{32,})/gi, '$1<redacted>');
|
|
45
|
+
ret = ret.replace(/(csrftoken["\s]*[:=]["\s]*)([a-zA-Z0-9]{32,})/gi, '$1<redacted>');
|
|
46
|
+
// Common environment variable patterns
|
|
47
|
+
ret = ret.replace(/(DATABASE_URL["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
48
|
+
ret = ret.replace(/(REDIS_URL["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
49
|
+
ret = ret.replace(/(SMTP_PASSWORD["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
50
|
+
ret = ret.replace(/(ENCRYPTION_KEY["\s]*[:=]["\s]*)([^",\s}]+)/gi, '$1<redacted>');
|
|
13
51
|
return ret;
|
|
14
52
|
}
|
|
15
53
|
function redactObject(ob) {
|
package/package.json
CHANGED