harperdb 4.7.0-beta.2 → 4.7.0-beta.4
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/README.md +1 -1
- package/bin/harperdb.js +79 -79
- package/bin/lite.js +77 -77
- package/config/yaml/defaultConfig.yaml +1 -1
- package/json/systemSchema.json +30 -0
- package/launchServiceScripts/launchNatsIngestService.js +77 -77
- package/launchServiceScripts/launchNatsReplyService.js +77 -77
- package/launchServiceScripts/launchUpdateNodes4-0-0.js +77 -77
- package/npm-shrinkwrap.json +302 -294
- package/package.json +3 -1
- package/resources/RequestTarget.d.ts +2 -0
- package/resources/Table.d.ts +34 -34
- package/resources/analytics/hostnames.d.ts +5 -477
- package/resources/blob.d.ts +6 -3
- package/resources/databases.d.ts +1 -478
- package/resources/openApi.d.ts +27 -0
- package/security/certificateVerification/certificateVerificationSource.d.ts +18 -0
- package/security/certificateVerification/configValidation.d.ts +14 -0
- package/security/certificateVerification/crlVerification.d.ts +29 -0
- package/security/certificateVerification/index.d.ts +31 -0
- package/security/certificateVerification/ocspVerification.d.ts +23 -0
- package/security/certificateVerification/types.d.ts +105 -0
- package/security/certificateVerification/verificationConfig.d.ts +29 -0
- package/security/certificateVerification/verificationUtils.d.ts +79 -0
- package/server/jobs/jobProcess.js +77 -77
- package/server/operationsServer.d.ts +13 -3
- package/server/replication/replicator.d.ts +6 -0
- package/server/threads/threadServer.js +77 -77
- package/studio/web/assets/index-BsZJSz4i.js +1 -0
- package/studio/web/assets/index-BwVqw4zI.js +453 -0
- package/studio/web/assets/index-OpljqLtb.css +4 -0
- package/studio/web/assets/profiler-CW5dV_9B.js +1 -0
- package/studio/web/assets/startRecording--YUj61DT.js +2 -0
- package/studio/web/index.html +2 -2
- package/studio/web/running.html +90 -0
- package/utility/hdbTerms.d.ts +22 -3
- package/utility/scripts/restartHdb.js +77 -77
- package/security/certificateVerification.d.ts +0 -87
- package/studio/web/assets/index-B797owPM.js +0 -1
- package/studio/web/assets/index-CXaPu3wc.js +0 -445
- package/studio/web/assets/index-Dj8x6atJ.css +0 -4
- package/studio/web/assets/profiler-CgmzpljF.js +0 -1
- package/studio/web/assets/startRecording-DiD-ht9H.js +0 -2
- /package/security/{pkijs-ed25519-patch.d.ts → certificateVerification/pkijs-ed25519-patch.d.ts} +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OCSP (Online Certificate Status Protocol) verification
|
|
3
|
+
*/
|
|
4
|
+
import './pkijs-ed25519-patch.ts';
|
|
5
|
+
import type { CertificateVerificationResult, OCSPCheckResult, OCSPConfig } from './types.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Verify OCSP status of a client certificate
|
|
8
|
+
* @param certPem - Client certificate as Buffer (DER format)
|
|
9
|
+
* @param issuerPem - Issuer (CA) certificate as Buffer (DER format)
|
|
10
|
+
* @param config - OCSP configuration
|
|
11
|
+
* @param ocspUrls - Optional pre-extracted OCSP responder URLs (avoids re-parsing)
|
|
12
|
+
* @returns Promise resolving to verification result
|
|
13
|
+
*/
|
|
14
|
+
export declare function verifyOCSP(certPem: Buffer, issuerPem: Buffer, config?: OCSPConfig, ocspUrls?: string[]): Promise<CertificateVerificationResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Perform the actual OCSP check using easy-ocsp
|
|
17
|
+
* @param certPem - Certificate in PEM format
|
|
18
|
+
* @param issuerPem - Issuer certificate in PEM format
|
|
19
|
+
* @param config - OCSP configuration
|
|
20
|
+
* @param ocspUrls - Optional pre-extracted OCSP responder URLs (avoids re-parsing)
|
|
21
|
+
* @returns OCSP check result
|
|
22
|
+
*/
|
|
23
|
+
export declare function performOCSPCheck(certPem: string, issuerPem: string, config: any, ocspUrls?: string[]): Promise<OCSPCheckResult>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeScript interfaces and types for certificate verification
|
|
3
|
+
*/
|
|
4
|
+
import type { Context } from '../../resources/ResourceInterface.ts';
|
|
5
|
+
export type CertificateStatus = 'good' | 'revoked' | 'unknown';
|
|
6
|
+
export type VerificationMethod = 'ocsp' | 'crl';
|
|
7
|
+
export type VerificationResultMethod = VerificationMethod | 'disabled';
|
|
8
|
+
export type FailureMode = 'fail-open' | 'fail-closed';
|
|
9
|
+
export interface PeerCertificate {
|
|
10
|
+
subject?: {
|
|
11
|
+
CN?: string;
|
|
12
|
+
[key: string]: any;
|
|
13
|
+
};
|
|
14
|
+
raw?: Buffer;
|
|
15
|
+
issuerCertificate?: PeerCertificate;
|
|
16
|
+
}
|
|
17
|
+
export interface CertificateVerificationResult {
|
|
18
|
+
valid: boolean;
|
|
19
|
+
status: string;
|
|
20
|
+
cached?: boolean;
|
|
21
|
+
error?: string;
|
|
22
|
+
method?: VerificationResultMethod;
|
|
23
|
+
}
|
|
24
|
+
export interface CertificateCacheEntry {
|
|
25
|
+
certificate_id: string;
|
|
26
|
+
status: CertificateStatus;
|
|
27
|
+
reason?: string;
|
|
28
|
+
checked_at: number;
|
|
29
|
+
expiresAt: number;
|
|
30
|
+
method: VerificationMethod;
|
|
31
|
+
}
|
|
32
|
+
export interface CRLCacheEntry {
|
|
33
|
+
distribution_point: string;
|
|
34
|
+
issuer_dn: string;
|
|
35
|
+
crl_blob: Buffer;
|
|
36
|
+
this_update: number;
|
|
37
|
+
next_update: number;
|
|
38
|
+
signature_valid: boolean;
|
|
39
|
+
expiresAt: number;
|
|
40
|
+
}
|
|
41
|
+
export interface RevokedCertificateEntry {
|
|
42
|
+
composite_id: string;
|
|
43
|
+
serial_number: string;
|
|
44
|
+
issuer_key_id: string;
|
|
45
|
+
revocation_date: number;
|
|
46
|
+
revocation_reason?: string;
|
|
47
|
+
crl_source: string;
|
|
48
|
+
crl_next_update: number;
|
|
49
|
+
expiresAt: number;
|
|
50
|
+
}
|
|
51
|
+
export interface CertificateChainEntry {
|
|
52
|
+
cert: Buffer;
|
|
53
|
+
issuer?: Buffer;
|
|
54
|
+
}
|
|
55
|
+
export interface OCSPCheckResult {
|
|
56
|
+
status: CertificateStatus;
|
|
57
|
+
reason?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface CRLCheckResult {
|
|
60
|
+
status: CertificateStatus;
|
|
61
|
+
reason?: string;
|
|
62
|
+
source?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface OCSPConfig {
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
timeout?: number;
|
|
67
|
+
cacheTtl?: number;
|
|
68
|
+
errorCacheTtl?: number;
|
|
69
|
+
failureMode?: FailureMode;
|
|
70
|
+
}
|
|
71
|
+
export interface CRLConfig {
|
|
72
|
+
enabled?: boolean;
|
|
73
|
+
timeout?: number;
|
|
74
|
+
cacheTtl?: number;
|
|
75
|
+
failureMode?: FailureMode;
|
|
76
|
+
gracePeriod?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CertificateVerificationConfig {
|
|
79
|
+
failureMode?: FailureMode;
|
|
80
|
+
ocsp?: OCSPConfig;
|
|
81
|
+
crl?: CRLConfig;
|
|
82
|
+
}
|
|
83
|
+
export interface CertificateVerificationContext extends Context {
|
|
84
|
+
certPem: string;
|
|
85
|
+
issuerPem: string;
|
|
86
|
+
ocspUrls?: string[];
|
|
87
|
+
distributionPoint?: string;
|
|
88
|
+
config?: CertificateVerificationConfig;
|
|
89
|
+
}
|
|
90
|
+
export interface CRLVerificationContext extends Context {
|
|
91
|
+
distributionPoint: string;
|
|
92
|
+
issuerPem: string;
|
|
93
|
+
config?: CRLConfig;
|
|
94
|
+
}
|
|
95
|
+
export interface VerificationDefaults {
|
|
96
|
+
timeout: number;
|
|
97
|
+
cacheTtl: number;
|
|
98
|
+
failureMode: FailureMode;
|
|
99
|
+
}
|
|
100
|
+
export interface OCSPDefaults extends VerificationDefaults {
|
|
101
|
+
errorCacheTtl: number;
|
|
102
|
+
}
|
|
103
|
+
export interface CRLDefaults extends VerificationDefaults {
|
|
104
|
+
gracePeriod: number;
|
|
105
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration parsing and default values for certificate verification
|
|
3
|
+
*/
|
|
4
|
+
import type { CertificateVerificationConfig } from './types.ts';
|
|
5
|
+
export declare const CRL_DEFAULT_VALIDITY_PERIOD: number;
|
|
6
|
+
export declare const ERROR_CACHE_TTL = 300000;
|
|
7
|
+
export declare const CRL_USER_AGENT: string;
|
|
8
|
+
/**
|
|
9
|
+
* Cached version of getCertificateVerificationConfig to avoid redundant parsing
|
|
10
|
+
* This is the recommended function to use in hot paths like certificate verification.
|
|
11
|
+
*
|
|
12
|
+
* MEMORY SAFETY:
|
|
13
|
+
* - Uses WeakMap for object configs to prevent memory leaks
|
|
14
|
+
* - Config objects can be garbage collected when no longer referenced elsewhere
|
|
15
|
+
* - Primitive values (boolean, null, undefined) use simple reference equality
|
|
16
|
+
* - No strong references held to config objects, preventing memory accumulation
|
|
17
|
+
*
|
|
18
|
+
* ERROR HANDLING:
|
|
19
|
+
* - Invalid config causes validation errors to be thrown on first access
|
|
20
|
+
* - Validation errors are logged once and then cached
|
|
21
|
+
* - Subsequent accesses with the same invalid config return false (disabled) to prevent
|
|
22
|
+
* repeated error logging and allow the application to continue running
|
|
23
|
+
* - This provides fail-safe behavior: invalid security config defaults to disabled
|
|
24
|
+
* rather than crashing on every request
|
|
25
|
+
*
|
|
26
|
+
* @param mtlsConfig - The mTLS configuration from env.get()
|
|
27
|
+
* @returns Configuration object or false if verification is disabled or invalid
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCachedCertificateVerificationConfig(mtlsConfig?: boolean | Record<string, any> | null): false | CertificateVerificationConfig;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utilities for certificate verification
|
|
3
|
+
*/
|
|
4
|
+
import type { PeerCertificate, CertificateChainEntry } from './types.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Convert a buffer to PEM format
|
|
7
|
+
* @param buffer - Certificate data as buffer
|
|
8
|
+
* @param type - Certificate type (e.g., 'CERTIFICATE')
|
|
9
|
+
* @returns PEM formatted string
|
|
10
|
+
*/
|
|
11
|
+
export declare function bufferToPem(buffer: Buffer, type: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Extract certificate chain from peer certificate object
|
|
14
|
+
* @param peerCertificate - Peer certificate object from TLS connection
|
|
15
|
+
* @returns Certificate chain with issuer relationships
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractCertificateChain(peerCertificate: PeerCertificate): CertificateChainEntry[];
|
|
18
|
+
/**
|
|
19
|
+
* Extract CRL Distribution Points from a certificate using PKI.js
|
|
20
|
+
* @param certPem - Certificate in PEM format
|
|
21
|
+
* @returns Array of CRL distribution point URLs
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractCRLDistributionPoints(certPem: string): string[];
|
|
24
|
+
/**
|
|
25
|
+
* Extract both CRL and OCSP URLs from a certificate in a single parse operation
|
|
26
|
+
* @param certPem - Certificate in PEM format
|
|
27
|
+
* @returns Object containing arrays of CRL and OCSP URLs
|
|
28
|
+
*/
|
|
29
|
+
export declare function extractRevocationUrls(certPem: string): {
|
|
30
|
+
crlUrls: string[];
|
|
31
|
+
ocspUrls: string[];
|
|
32
|
+
};
|
|
33
|
+
/**
|
|
34
|
+
* Extract OCSP responder URLs from a certificate
|
|
35
|
+
* @param certPem - Certificate in PEM format
|
|
36
|
+
* @returns Array of OCSP responder URLs
|
|
37
|
+
*/
|
|
38
|
+
export declare function extractOCSPUrls(certPem: string): string[];
|
|
39
|
+
/**
|
|
40
|
+
* Convert PEM string to buffer for PKI.js parsing
|
|
41
|
+
* @param pem - PEM formatted certificate
|
|
42
|
+
* @returns Buffer containing certificate data
|
|
43
|
+
*/
|
|
44
|
+
export declare function pemToBuffer(pem: string): ArrayBuffer;
|
|
45
|
+
/**
|
|
46
|
+
* Create a cache key for certificate verification
|
|
47
|
+
* @param certPem - Certificate in PEM format
|
|
48
|
+
* @param issuerPem - Issuer certificate in PEM format
|
|
49
|
+
* @param method - Verification method (ocsp, crl)
|
|
50
|
+
* @param additionalData - Additional data to include in hash
|
|
51
|
+
* @returns Cache key string
|
|
52
|
+
*/
|
|
53
|
+
export declare function createCacheKey(certPem: string, issuerPem: string, method: 'ocsp' | 'crl', additionalData?: Record<string, any>): string;
|
|
54
|
+
/**
|
|
55
|
+
* Create a cache key for CRL storage
|
|
56
|
+
* @param distributionPoint - CRL distribution point URL
|
|
57
|
+
* @returns Cache key string
|
|
58
|
+
*/
|
|
59
|
+
export declare function createCRLCacheKey(distributionPoint: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Create a composite ID for revoked certificate lookup
|
|
62
|
+
* @param issuerKeyId - Issuer key identifier or DN hash
|
|
63
|
+
* @param serialNumber - Certificate serial number
|
|
64
|
+
* @returns Composite ID string
|
|
65
|
+
*/
|
|
66
|
+
export declare function createRevokedCertificateId(issuerKeyId: string, serialNumber: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* Extract serial number from a certificate
|
|
69
|
+
* @param certPem - Certificate in PEM format
|
|
70
|
+
* @returns Certificate serial number as string
|
|
71
|
+
*/
|
|
72
|
+
export declare function extractSerialNumber(certPem: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Extract issuer key identifier from a certificate
|
|
75
|
+
* @param certPem - Certificate in PEM format
|
|
76
|
+
* @returns Issuer key identifier as hex string, or hash of issuer DN if not available
|
|
77
|
+
*/
|
|
78
|
+
export declare function extractIssuerKeyId(certPem: string): string;
|
|
79
|
+
export declare function getCertificateCacheTable(): unknown;
|