@vollcrypt/db-guard 0.1.0 → 0.1.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/provenance.json +8 -8
- package/dist/provenance.json.sig +2 -1
- package/dist/sbom.json +8 -8
- package/dist/sbom.json.sig +0 -0
- package/dist/security.d.ts +2 -0
- package/dist/security.js +31 -10
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export { createDrizzleGuard } from './drizzle';
|
|
|
4
4
|
export { createTypeOrmSubscriber } from './typeorm';
|
|
5
5
|
export { KmsProvider, AwsKmsProvider, GcpKmsProvider, VaultKmsProvider, unwrapDekLocal, Pkcs11KmsProvider } from './kms';
|
|
6
6
|
export { computeBlindIndex } from './blind-index';
|
|
7
|
-
export { dbGuardContextStore, configureAuditLogger, decryptWithSecurity, checkRateLimit, checkPageSize, resetFailClosedStatusForTesting, resetAuditLoggerForTesting, getCachedKey, setCachedKey, resetSecureKeyCacheForTesting, configureBreakGlass, deactivateBreakGlass, isBreakGlassActive, getBreakGlassKey, activateBreakGlass, parseCiphertext, CRYPTO_ALGORITHMS, VERSION_ALGORITHMS } from './security';
|
|
7
|
+
export { dbGuardContextStore, configureAuditLogger, decryptWithSecurity, checkRateLimit, checkPageSize, resetFailClosedStatusForTesting, resetAuditLoggerForTesting, getCachedKey, setCachedKey, resetSecureKeyCacheForTesting, configureBreakGlass, deactivateBreakGlass, isBreakGlassActive, getBreakGlassKey, activateBreakGlass, parseCiphertext, CRYPTO_ALGORITHMS, VERSION_ALGORITHMS, maskValue } from './security';
|
|
8
8
|
export { auditConfiguration, generateComplianceHtmlReport, ComplianceAuditInput, ComplianceScorecard } from './compliance';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.generateComplianceHtmlReport = exports.auditConfiguration = exports.VERSION_ALGORITHMS = exports.CRYPTO_ALGORITHMS = exports.parseCiphertext = exports.activateBreakGlass = exports.getBreakGlassKey = exports.isBreakGlassActive = exports.deactivateBreakGlass = exports.configureBreakGlass = exports.resetSecureKeyCacheForTesting = exports.setCachedKey = exports.getCachedKey = exports.resetAuditLoggerForTesting = exports.resetFailClosedStatusForTesting = exports.checkPageSize = exports.checkRateLimit = exports.decryptWithSecurity = exports.configureAuditLogger = exports.dbGuardContextStore = exports.computeBlindIndex = exports.Pkcs11KmsProvider = exports.unwrapDekLocal = exports.VaultKmsProvider = exports.GcpKmsProvider = exports.AwsKmsProvider = exports.createTypeOrmSubscriber = exports.createDrizzleGuard = exports.mongooseDbGuard = exports.resolveKeys = exports.decryptValue = exports.encryptValue = exports.prismaDbGuard = void 0;
|
|
3
|
+
exports.generateComplianceHtmlReport = exports.auditConfiguration = exports.maskValue = exports.VERSION_ALGORITHMS = exports.CRYPTO_ALGORITHMS = exports.parseCiphertext = exports.activateBreakGlass = exports.getBreakGlassKey = exports.isBreakGlassActive = exports.deactivateBreakGlass = exports.configureBreakGlass = exports.resetSecureKeyCacheForTesting = exports.setCachedKey = exports.getCachedKey = exports.resetAuditLoggerForTesting = exports.resetFailClosedStatusForTesting = exports.checkPageSize = exports.checkRateLimit = exports.decryptWithSecurity = exports.configureAuditLogger = exports.dbGuardContextStore = exports.computeBlindIndex = exports.Pkcs11KmsProvider = exports.unwrapDekLocal = exports.VaultKmsProvider = exports.GcpKmsProvider = exports.AwsKmsProvider = exports.createTypeOrmSubscriber = exports.createDrizzleGuard = exports.mongooseDbGuard = exports.resolveKeys = exports.decryptValue = exports.encryptValue = exports.prismaDbGuard = void 0;
|
|
4
4
|
var prisma_1 = require("./prisma");
|
|
5
5
|
Object.defineProperty(exports, "prismaDbGuard", { enumerable: true, get: function () { return prisma_1.prismaDbGuard; } });
|
|
6
6
|
Object.defineProperty(exports, "encryptValue", { enumerable: true, get: function () { return prisma_1.encryptValue; } });
|
|
@@ -39,6 +39,7 @@ Object.defineProperty(exports, "activateBreakGlass", { enumerable: true, get: fu
|
|
|
39
39
|
Object.defineProperty(exports, "parseCiphertext", { enumerable: true, get: function () { return security_1.parseCiphertext; } });
|
|
40
40
|
Object.defineProperty(exports, "CRYPTO_ALGORITHMS", { enumerable: true, get: function () { return security_1.CRYPTO_ALGORITHMS; } });
|
|
41
41
|
Object.defineProperty(exports, "VERSION_ALGORITHMS", { enumerable: true, get: function () { return security_1.VERSION_ALGORITHMS; } });
|
|
42
|
+
Object.defineProperty(exports, "maskValue", { enumerable: true, get: function () { return security_1.maskValue; } });
|
|
42
43
|
var compliance_1 = require("./compliance");
|
|
43
44
|
Object.defineProperty(exports, "auditConfiguration", { enumerable: true, get: function () { return compliance_1.auditConfiguration; } });
|
|
44
45
|
Object.defineProperty(exports, "generateComplianceHtmlReport", { enumerable: true, get: function () { return compliance_1.generateComplianceHtmlReport; } });
|
package/dist/provenance.json
CHANGED
|
@@ -52,13 +52,13 @@
|
|
|
52
52
|
{
|
|
53
53
|
"name": "dist/index.d.ts",
|
|
54
54
|
"digest": {
|
|
55
|
-
"sha256": "
|
|
55
|
+
"sha256": "ec2f9fbf66e83818e0fb9e9e97780941f7078def441e2b8a7e0a8fb99d64a532"
|
|
56
56
|
}
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"name": "dist/index.js",
|
|
60
60
|
"digest": {
|
|
61
|
-
"sha256": "
|
|
61
|
+
"sha256": "b2f9f7e6a8b238911e9e9e303b13be231af846180da1321275752126dacf1264"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
{
|
|
@@ -100,13 +100,13 @@
|
|
|
100
100
|
{
|
|
101
101
|
"name": "dist/security.d.ts",
|
|
102
102
|
"digest": {
|
|
103
|
-
"sha256": "
|
|
103
|
+
"sha256": "554d9ba00f800470666ab66127079df889b8d717a9cf7b28ab252f0adad64304"
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
107
|
"name": "dist/security.js",
|
|
108
108
|
"digest": {
|
|
109
|
-
"sha256": "
|
|
109
|
+
"sha256": "5e907c9f5ec9fb93ef07f6360d7f8572aa5a1ea1c0a32d0b10496477d0b8fd33"
|
|
110
110
|
}
|
|
111
111
|
},
|
|
112
112
|
{
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"externalParameters": {
|
|
130
130
|
"packageJson": {
|
|
131
131
|
"name": "@vollcrypt/db-guard",
|
|
132
|
-
"version": "0.1.
|
|
132
|
+
"version": "0.1.1",
|
|
133
133
|
"scripts": {
|
|
134
134
|
"build": "tsc && node scripts/generate-sbom.js",
|
|
135
135
|
"test": "node --import tsx --test tests/*.test.ts"
|
|
@@ -213,9 +213,9 @@
|
|
|
213
213
|
"id": "https://vollcrypt.dev/builders/local-hermetic-env"
|
|
214
214
|
},
|
|
215
215
|
"metadata": {
|
|
216
|
-
"invocationId": "
|
|
217
|
-
"startedOn": "2026-06-
|
|
218
|
-
"finishedOn": "2026-06-
|
|
216
|
+
"invocationId": "4038ab2da0eed20086c5bb329a4db9f2",
|
|
217
|
+
"startedOn": "2026-06-11T13:14:40.057Z",
|
|
218
|
+
"finishedOn": "2026-06-11T13:14:40.058Z"
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
}
|
package/dist/provenance.json.sig
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
���ĸ�k��F2@����OCt��)�gT�� \�
|
|
2
|
+
�����������bܤ�/W����>6
|
package/dist/sbom.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"bomFormat": "CycloneDX",
|
|
3
3
|
"specVersion": "1.5",
|
|
4
|
-
"serialNumber": "urn:uuid:
|
|
4
|
+
"serialNumber": "urn:uuid:3f1b85cc-1214-411d-b559-97018328b572",
|
|
5
5
|
"version": 1,
|
|
6
6
|
"metadata": {
|
|
7
|
-
"timestamp": "2026-06-
|
|
7
|
+
"timestamp": "2026-06-11T13:14:40.057Z",
|
|
8
8
|
"tools": [
|
|
9
9
|
{
|
|
10
10
|
"vendor": "Vollcrypt",
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
}
|
|
14
14
|
],
|
|
15
15
|
"component": {
|
|
16
|
-
"bomRef": "pkg:npm/@vollcrypt/db-guard@0.1.
|
|
16
|
+
"bomRef": "pkg:npm/@vollcrypt/db-guard@0.1.1",
|
|
17
17
|
"type": "library",
|
|
18
18
|
"name": "@vollcrypt/db-guard",
|
|
19
|
-
"version": "0.1.
|
|
19
|
+
"version": "0.1.1",
|
|
20
20
|
"description": "Database field-level encryption integrations for Vollcrypt (Prisma, Mongoose, Drizzle, TypeORM)",
|
|
21
21
|
"hashes": [
|
|
22
22
|
{
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
"alg": "SHA-256",
|
|
56
|
-
"content": "
|
|
56
|
+
"content": "ec2f9fbf66e83818e0fb9e9e97780941f7078def441e2b8a7e0a8fb99d64a532"
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
"alg": "SHA-256",
|
|
60
|
-
"content": "
|
|
60
|
+
"content": "b2f9f7e6a8b238911e9e9e303b13be231af846180da1321275752126dacf1264"
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
"alg": "SHA-256",
|
|
@@ -85,11 +85,11 @@
|
|
|
85
85
|
},
|
|
86
86
|
{
|
|
87
87
|
"alg": "SHA-256",
|
|
88
|
-
"content": "
|
|
88
|
+
"content": "554d9ba00f800470666ab66127079df889b8d717a9cf7b28ab252f0adad64304"
|
|
89
89
|
},
|
|
90
90
|
{
|
|
91
91
|
"alg": "SHA-256",
|
|
92
|
-
"content": "
|
|
92
|
+
"content": "5e907c9f5ec9fb93ef07f6360d7f8572aa5a1ea1c0a32d0b10496477d0b8fd33"
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
"alg": "SHA-256",
|
package/dist/sbom.json.sig
CHANGED
|
Binary file
|
package/dist/security.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface UserContext {
|
|
|
19
19
|
maxPageSize?: number;
|
|
20
20
|
onPageSizeExceeded?: 'warn' | 'error' | 'bypass';
|
|
21
21
|
tenantId?: string;
|
|
22
|
+
decryptCount?: number;
|
|
23
|
+
windowStart?: number;
|
|
22
24
|
}
|
|
23
25
|
export declare const dbGuardContextStore: AsyncLocalStorage<UserContext>;
|
|
24
26
|
export declare function maskValue(val: any, rule: 'credit_card' | 'email' | 'tc_no' | ((v: any) => any) | string): any;
|
package/dist/security.js
CHANGED
|
@@ -370,17 +370,38 @@ function checkRateLimit(options) {
|
|
|
370
370
|
const limit = context?.maxDecryptionsPerSecond || options?.maxDecryptionsPerSecond || 500;
|
|
371
371
|
const mode = context?.rateLimiterMode || options?.mode || 'fail_closed';
|
|
372
372
|
const now = Date.now();
|
|
373
|
-
if (
|
|
374
|
-
decryptCount
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
decryptCount++;
|
|
378
|
-
if (decryptCount > limit) {
|
|
379
|
-
if (mode === 'fail_closed') {
|
|
380
|
-
triggerFailClosed(options?.onFailClosed);
|
|
373
|
+
if (context) {
|
|
374
|
+
if (context.windowStart === undefined || context.decryptCount === undefined) {
|
|
375
|
+
context.windowStart = now;
|
|
376
|
+
context.decryptCount = 0;
|
|
381
377
|
}
|
|
382
|
-
|
|
383
|
-
|
|
378
|
+
if (now - context.windowStart > 1000) {
|
|
379
|
+
context.decryptCount = 0;
|
|
380
|
+
context.windowStart = now;
|
|
381
|
+
}
|
|
382
|
+
context.decryptCount++;
|
|
383
|
+
if (context.decryptCount > limit) {
|
|
384
|
+
if (mode === 'fail_closed') {
|
|
385
|
+
triggerFailClosed(options?.onFailClosed);
|
|
386
|
+
}
|
|
387
|
+
else if (mode === 'warn') {
|
|
388
|
+
console.warn(`Vollcrypt Warning: Decryption rate limit exceeded. ${context.decryptCount} decryptions in the current window (limit: ${limit}).`);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
if (now - windowStart > 1000) {
|
|
394
|
+
decryptCount = 0;
|
|
395
|
+
windowStart = now;
|
|
396
|
+
}
|
|
397
|
+
decryptCount++;
|
|
398
|
+
if (decryptCount > limit) {
|
|
399
|
+
if (mode === 'fail_closed') {
|
|
400
|
+
triggerFailClosed(options?.onFailClosed);
|
|
401
|
+
}
|
|
402
|
+
else if (mode === 'warn') {
|
|
403
|
+
console.warn(`Vollcrypt Warning: Decryption rate limit exceeded. ${decryptCount} decryptions in the current window (limit: ${limit}).`);
|
|
404
|
+
}
|
|
384
405
|
}
|
|
385
406
|
}
|
|
386
407
|
}
|
package/package.json
CHANGED