@ai-pip/core 0.3.0 → 0.5.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/CHANGELOG.md +74 -1
- package/README.md +52 -1037
- package/dist/AAL/index.d.ts +4 -4
- package/dist/AAL/index.d.ts.map +1 -1
- package/dist/AAL/index.js +2 -2
- package/dist/AAL/index.js.map +1 -1
- package/dist/AAL/process/buildDecisionReason.d.ts.map +1 -1
- package/dist/AAL/process/buildDecisionReason.js +2 -4
- package/dist/AAL/process/buildDecisionReason.js.map +1 -1
- package/dist/AAL/process/buildRemediationPlan.d.ts +22 -0
- package/dist/AAL/process/buildRemediationPlan.d.ts.map +1 -0
- package/dist/AAL/process/buildRemediationPlan.js +81 -0
- package/dist/AAL/process/buildRemediationPlan.js.map +1 -0
- package/dist/AAL/process/index.d.ts +2 -3
- package/dist/AAL/process/index.d.ts.map +1 -1
- package/dist/AAL/process/index.js +2 -2
- package/dist/AAL/process/index.js.map +1 -1
- package/dist/AAL/process/resolveAgentAction.d.ts.map +1 -1
- package/dist/AAL/process/resolveAgentAction.js +3 -14
- package/dist/AAL/process/resolveAgentAction.js.map +1 -1
- package/dist/AAL/process/validatePolicy.d.ts +20 -0
- package/dist/AAL/process/validatePolicy.d.ts.map +1 -0
- package/dist/AAL/process/validatePolicy.js +40 -0
- package/dist/AAL/process/validatePolicy.js.map +1 -0
- package/dist/AAL/types.d.ts +18 -35
- package/dist/AAL/types.d.ts.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/isl/detect/detect.js +19 -19
- package/dist/isl/detect/detect.js.map +1 -1
- package/dist/isl/index.d.ts +2 -0
- package/dist/isl/index.d.ts.map +1 -1
- package/dist/isl/index.js +2 -0
- package/dist/isl/index.js.map +1 -1
- package/dist/isl/process/buildISLResult.d.ts +3 -1
- package/dist/isl/process/buildISLResult.d.ts.map +1 -1
- package/dist/isl/process/buildISLResult.js +3 -1
- package/dist/isl/process/buildISLResult.js.map +1 -1
- package/dist/isl/sanitize.d.ts.map +1 -1
- package/dist/isl/sanitize.js +15 -3
- package/dist/isl/sanitize.js.map +1 -1
- package/dist/isl/tags/index.d.ts +19 -0
- package/dist/isl/tags/index.d.ts.map +1 -0
- package/dist/isl/tags/index.js +17 -0
- package/dist/isl/tags/index.js.map +1 -0
- package/dist/isl/tags/namespace.d.ts +18 -0
- package/dist/isl/tags/namespace.d.ts.map +1 -0
- package/dist/isl/tags/namespace.js +18 -0
- package/dist/isl/tags/namespace.js.map +1 -0
- package/dist/isl/tags/serializer.d.ts +39 -0
- package/dist/isl/tags/serializer.d.ts.map +1 -0
- package/dist/isl/tags/serializer.js +45 -0
- package/dist/isl/tags/serializer.js.map +1 -0
- package/dist/isl/tags/tag-registry.d.ts +15 -0
- package/dist/isl/tags/tag-registry.d.ts.map +1 -0
- package/dist/isl/tags/tag-registry.js +17 -0
- package/dist/isl/tags/tag-registry.js.map +1 -0
- package/dist/isl/tags/threat-tag-type.d.ts +13 -0
- package/dist/isl/tags/threat-tag-type.d.ts.map +1 -0
- package/dist/isl/tags/threat-tag-type.js +9 -0
- package/dist/isl/tags/threat-tag-type.js.map +1 -0
- package/dist/isl/tags/threat-tag.d.ts +32 -0
- package/dist/isl/tags/threat-tag.d.ts.map +1 -0
- package/dist/isl/tags/threat-tag.js +43 -0
- package/dist/isl/tags/threat-tag.js.map +1 -0
- package/dist/isl/types.d.ts +13 -0
- package/dist/isl/types.d.ts.map +1 -1
- package/dist/shared/audit.d.ts +16 -18
- package/dist/shared/audit.d.ts.map +1 -1
- package/dist/shared/audit.js +27 -31
- package/dist/shared/audit.js.map +1 -1
- package/dist/shared/envelope/envelope.d.ts +23 -0
- package/dist/shared/envelope/envelope.d.ts.map +1 -0
- package/dist/{cpe → shared/envelope}/envelope.js +9 -21
- package/dist/shared/envelope/envelope.js.map +1 -0
- package/dist/{cpe → shared/envelope}/exceptions/EnvelopeError.d.ts +1 -1
- package/dist/shared/envelope/exceptions/EnvelopeError.d.ts.map +1 -0
- package/dist/{cpe → shared/envelope}/exceptions/EnvelopeError.js +1 -1
- package/dist/shared/envelope/exceptions/EnvelopeError.js.map +1 -0
- package/dist/shared/envelope/exceptions/index.d.ts +2 -0
- package/dist/shared/envelope/exceptions/index.d.ts.map +1 -0
- package/dist/shared/envelope/exceptions/index.js +2 -0
- package/dist/shared/envelope/exceptions/index.js.map +1 -0
- package/dist/shared/envelope/index.d.ts +18 -0
- package/dist/shared/envelope/index.d.ts.map +1 -0
- package/dist/shared/envelope/index.js +15 -0
- package/dist/shared/envelope/index.js.map +1 -0
- package/dist/shared/envelope/types.d.ts +45 -0
- package/dist/shared/envelope/types.d.ts.map +1 -0
- package/dist/shared/envelope/types.js +10 -0
- package/dist/shared/envelope/types.js.map +1 -0
- package/dist/shared/envelope/value-objects/Metadata.d.ts +27 -0
- package/dist/shared/envelope/value-objects/Metadata.d.ts.map +1 -0
- package/dist/{cpe → shared/envelope}/value-objects/Metadata.js +11 -19
- package/dist/shared/envelope/value-objects/Metadata.js.map +1 -0
- package/dist/shared/envelope/value-objects/Nonce.d.ts +26 -0
- package/dist/shared/envelope/value-objects/Nonce.d.ts.map +1 -0
- package/dist/{cpe → shared/envelope}/value-objects/Nonce.js +11 -17
- package/dist/shared/envelope/value-objects/Nonce.js.map +1 -0
- package/dist/shared/envelope/value-objects/Signature.d.ts +28 -0
- package/dist/shared/envelope/value-objects/Signature.d.ts.map +1 -0
- package/dist/shared/envelope/value-objects/Signature.js +50 -0
- package/dist/shared/envelope/value-objects/Signature.js.map +1 -0
- package/dist/{cpe → shared/envelope}/value-objects/index.d.ts +1 -1
- package/dist/shared/envelope/value-objects/index.d.ts.map +1 -0
- package/dist/{cpe → shared/envelope}/value-objects/index.js +1 -1
- package/dist/shared/envelope/value-objects/index.js.map +1 -0
- package/dist/shared/index.d.ts +1 -1
- package/dist/shared/index.d.ts.map +1 -1
- package/package.json +8 -6
- package/dist/AAL/process/applyRemovalPlan.d.ts +0 -21
- package/dist/AAL/process/applyRemovalPlan.d.ts.map +0 -1
- package/dist/AAL/process/applyRemovalPlan.js +0 -150
- package/dist/AAL/process/applyRemovalPlan.js.map +0 -1
- package/dist/AAL/process/buildRemovalPlan.d.ts +0 -39
- package/dist/AAL/process/buildRemovalPlan.d.ts.map +0 -1
- package/dist/AAL/process/buildRemovalPlan.js +0 -104
- package/dist/AAL/process/buildRemovalPlan.js.map +0 -1
- package/dist/cpe/envelope.d.ts +0 -34
- package/dist/cpe/envelope.d.ts.map +0 -1
- package/dist/cpe/envelope.js.map +0 -1
- package/dist/cpe/exceptions/EnvelopeError.d.ts.map +0 -1
- package/dist/cpe/exceptions/EnvelopeError.js.map +0 -1
- package/dist/cpe/exceptions/index.d.ts +0 -5
- package/dist/cpe/exceptions/index.d.ts.map +0 -1
- package/dist/cpe/exceptions/index.js +0 -5
- package/dist/cpe/exceptions/index.js.map +0 -1
- package/dist/cpe/index.d.ts +0 -24
- package/dist/cpe/index.d.ts.map +0 -1
- package/dist/cpe/index.js +0 -26
- package/dist/cpe/index.js.map +0 -1
- package/dist/cpe/types.d.ts +0 -58
- package/dist/cpe/types.d.ts.map +0 -1
- package/dist/cpe/types.js +0 -5
- package/dist/cpe/types.js.map +0 -1
- package/dist/cpe/utils.d.ts +0 -38
- package/dist/cpe/utils.d.ts.map +0 -1
- package/dist/cpe/utils.js +0 -47
- package/dist/cpe/utils.js.map +0 -1
- package/dist/cpe/value-objects/Metadata.d.ts +0 -32
- package/dist/cpe/value-objects/Metadata.d.ts.map +0 -1
- package/dist/cpe/value-objects/Metadata.js.map +0 -1
- package/dist/cpe/value-objects/Nonce.d.ts +0 -33
- package/dist/cpe/value-objects/Nonce.d.ts.map +0 -1
- package/dist/cpe/value-objects/Nonce.js.map +0 -1
- package/dist/cpe/value-objects/Signature.d.ts +0 -39
- package/dist/cpe/value-objects/Signature.d.ts.map +0 -1
- package/dist/cpe/value-objects/Signature.js +0 -60
- package/dist/cpe/value-objects/Signature.js.map +0 -1
- package/dist/cpe/value-objects/index.d.ts.map +0 -1
- package/dist/cpe/value-objects/index.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/envelope/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEjF,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACvG,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AAEvG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope types (transversal) – integrity and anti-replay
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The envelope is a cross-cutting concern: it wraps the pipeline result
|
|
6
|
+
* (e.g. ISL or AAL output) with metadata, nonce, and HMAC signature.
|
|
7
|
+
* It is not a processing layer; it applies to the result of the pipeline.
|
|
8
|
+
*/
|
|
9
|
+
import type { LineageEntry } from '../../csl/value-objects/index.js';
|
|
10
|
+
/** Protocol version string (e.g. "0.1.4") */
|
|
11
|
+
export type ProtocolVersion = string;
|
|
12
|
+
/** Unix timestamp in milliseconds */
|
|
13
|
+
export type Timestamp = number;
|
|
14
|
+
/** Nonce value for replay prevention */
|
|
15
|
+
export type NonceValue = string;
|
|
16
|
+
/** Supported signature algorithm */
|
|
17
|
+
export type SignatureAlgorithm = 'HMAC-SHA256';
|
|
18
|
+
/** Signature value (hex string) */
|
|
19
|
+
export type Signature = string;
|
|
20
|
+
/** Envelope security metadata: timestamp, nonce, protocol version, optional previous signatures */
|
|
21
|
+
export interface CPEMetadata {
|
|
22
|
+
readonly timestamp: Timestamp;
|
|
23
|
+
readonly nonce: NonceValue;
|
|
24
|
+
readonly protocolVersion: ProtocolVersion;
|
|
25
|
+
readonly previousSignatures?: {
|
|
26
|
+
readonly csl?: string | undefined;
|
|
27
|
+
readonly isl?: string | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
}
|
|
30
|
+
/** Full cryptographic envelope: payload, metadata, signature, lineage */
|
|
31
|
+
export interface CPEEvelope {
|
|
32
|
+
readonly payload: unknown;
|
|
33
|
+
readonly metadata: CPEMetadata;
|
|
34
|
+
readonly signature: {
|
|
35
|
+
readonly value: string;
|
|
36
|
+
readonly algorithm: string;
|
|
37
|
+
};
|
|
38
|
+
readonly lineage: readonly LineageEntry[];
|
|
39
|
+
}
|
|
40
|
+
/** Result of envelope generation (envelope + optional processing time) */
|
|
41
|
+
export interface CPEResult {
|
|
42
|
+
readonly envelope: CPEEvelope;
|
|
43
|
+
readonly processingTimeMs?: number;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/shared/envelope/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAA;AAEpE,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,MAAM,CAAA;AAEpC,qCAAqC;AACrC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,wCAAwC;AACxC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAA;AAE/B,oCAAoC;AACpC,MAAM,MAAM,kBAAkB,GAAG,aAAa,CAAA;AAE9C,mCAAmC;AACnC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAA;AAE9B,mGAAmG;AACnG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAA;IAC7B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;IAC1B,QAAQ,CAAC,eAAe,EAAE,eAAe,CAAA;IACzC,QAAQ,CAAC,kBAAkB,CAAC,EAAE;QAC5B,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QACjC,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KAClC,GAAG,SAAS,CAAA;CACd;AAED,yEAAyE;AACzE,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;IACzB,QAAQ,CAAC,QAAQ,EAAE,WAAW,CAAA;IAC9B,QAAQ,CAAC,SAAS,EAAE;QAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;QACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;KAC3B,CAAA;IACD,QAAQ,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,CAAA;CAC1C;AAED,0EAA0E;AAC1E,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CACnC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope types (transversal) – integrity and anti-replay
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* The envelope is a cross-cutting concern: it wraps the pipeline result
|
|
6
|
+
* (e.g. ISL or AAL output) with metadata, nonce, and HMAC signature.
|
|
7
|
+
* It is not a processing layer; it applies to the result of the pipeline.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/shared/envelope/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Envelope metadata – security metadata value object (timestamp, nonce, version).
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Immutable; validates timestamp (positive, not in the future) and protocol version.
|
|
6
|
+
*/
|
|
7
|
+
import type { CPEMetadata, ProtocolVersion, Timestamp } from '../types.js';
|
|
8
|
+
import type { Nonce as NonceVO } from './Nonce.js';
|
|
9
|
+
/** Current protocol version for envelope metadata */
|
|
10
|
+
export declare const CURRENT_PROTOCOL_VERSION: ProtocolVersion;
|
|
11
|
+
/**
|
|
12
|
+
* Creates envelope metadata (frozen).
|
|
13
|
+
*
|
|
14
|
+
* @param timestamp - Unix timestamp in ms
|
|
15
|
+
* @param nonce - Nonce value object
|
|
16
|
+
* @param protocolVersion - Protocol version (default: CURRENT_PROTOCOL_VERSION)
|
|
17
|
+
* @param previousSignatures - Optional previous layer signatures (csl, isl)
|
|
18
|
+
*/
|
|
19
|
+
export declare function createMetadata(timestamp: Timestamp, nonce: NonceVO, protocolVersion?: ProtocolVersion, previousSignatures?: {
|
|
20
|
+
csl?: string;
|
|
21
|
+
isl?: string;
|
|
22
|
+
}): CPEMetadata;
|
|
23
|
+
/**
|
|
24
|
+
* Validates metadata shape and values.
|
|
25
|
+
*/
|
|
26
|
+
export declare function isValidMetadata(metadata: CPEMetadata): boolean;
|
|
27
|
+
//# sourceMappingURL=Metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metadata.d.ts","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC1E,OAAO,KAAK,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,YAAY,CAAA;AAElD,qDAAqD;AACrD,eAAO,MAAM,wBAAwB,EAAE,eAAyB,CAAA;AAEhE;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,OAAO,EACd,eAAe,GAAE,eAA0C,EAC3D,kBAAkB,CAAC,EAAE;IAAE,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAClD,WAAW,CAyBb;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAS9D"}
|
|
@@ -1,32 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* Versión actual del protocolo
|
|
2
|
+
* Envelope metadata – security metadata value object (timestamp, nonce, version).
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Immutable; validates timestamp (positive, not in the future) and protocol version.
|
|
7
6
|
*/
|
|
7
|
+
/** Current protocol version for envelope metadata */
|
|
8
8
|
export const CURRENT_PROTOCOL_VERSION = '0.1.4';
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
* Según especificación: timestamp, nonce, protocolVersion, previousSignatures opcionales
|
|
10
|
+
* Creates envelope metadata (frozen).
|
|
12
11
|
*
|
|
13
|
-
* @param timestamp -
|
|
14
|
-
* @param nonce - Nonce
|
|
15
|
-
* @param protocolVersion -
|
|
16
|
-
* @param previousSignatures -
|
|
17
|
-
* @returns CPEMetadata inmutable
|
|
12
|
+
* @param timestamp - Unix timestamp in ms
|
|
13
|
+
* @param nonce - Nonce value object
|
|
14
|
+
* @param protocolVersion - Protocol version (default: CURRENT_PROTOCOL_VERSION)
|
|
15
|
+
* @param previousSignatures - Optional previous layer signatures (csl, isl)
|
|
18
16
|
*/
|
|
19
17
|
export function createMetadata(timestamp, nonce, protocolVersion = CURRENT_PROTOCOL_VERSION, previousSignatures) {
|
|
20
|
-
// Validar timestamp
|
|
21
18
|
if (timestamp <= 0) {
|
|
22
19
|
throw new Error('Timestamp must be a positive number');
|
|
23
20
|
}
|
|
24
|
-
// Validar que no sea del futuro (con margen de 5 minutos para sincronización)
|
|
25
21
|
const maxFutureTimestamp = Date.now() + 5 * 60 * 1000;
|
|
26
22
|
if (timestamp > maxFutureTimestamp) {
|
|
27
23
|
throw new Error('Timestamp cannot be in the future');
|
|
28
24
|
}
|
|
29
|
-
// Validar version del protocolo
|
|
30
25
|
if (!protocolVersion || typeof protocolVersion !== 'string') {
|
|
31
26
|
throw new Error('Protocol version must be a non-empty string');
|
|
32
27
|
}
|
|
@@ -43,10 +38,7 @@ export function createMetadata(timestamp, nonce, protocolVersion = CURRENT_PROTO
|
|
|
43
38
|
});
|
|
44
39
|
}
|
|
45
40
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @param metadata - Metadata a validar
|
|
49
|
-
* @returns true si es válida
|
|
41
|
+
* Validates metadata shape and values.
|
|
50
42
|
*/
|
|
51
43
|
export function isValidMetadata(metadata) {
|
|
52
44
|
try {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Metadata.js","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Metadata.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,qDAAqD;AACrD,MAAM,CAAC,MAAM,wBAAwB,GAAoB,OAAO,CAAA;AAEhE;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,SAAoB,EACpB,KAAc,EACd,kBAAmC,wBAAwB,EAC3D,kBAAmD;IAEnD,IAAI,SAAS,IAAI,CAAC,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAA;IACxD,CAAC;IAED,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAA;IACrD,IAAI,SAAS,GAAG,kBAAkB,EAAE,CAAC;QACnC,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAA;IACtD,CAAC;IAED,IAAI,CAAC,eAAe,IAAI,OAAO,eAAe,KAAK,QAAQ,EAAE,CAAC;QAC5D,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAA;IAChE,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,SAAS;QACT,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,eAAe;QACf,kBAAkB,EAAE,kBAAkB;YACpC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;gBACZ,GAAG,EAAE,kBAAkB,CAAC,GAAG,IAAI,SAAS;gBACxC,GAAG,EAAE,kBAAkB,CAAC,GAAG,IAAI,SAAS;aACzC,CAAC;YACJ,CAAC,CAAC,SAAS;KACd,CAAC,CAAA;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,QAAqB;IACnD,IAAI,CAAC;QACH,IAAI,QAAQ,CAAC,SAAS,IAAI,CAAC;YAAE,OAAO,KAAK,CAAA;QACzC,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE;YAAE,OAAO,KAAK,CAAA;QAC/D,IAAI,CAAC,QAAQ,CAAC,eAAe;YAAE,OAAO,KAAK,CAAA;QAC3C,OAAO,IAAI,CAAA;IACb,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAA;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nonce – unique value for replay prevention. Immutable value object.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used by the envelope to bind each wrapped result to a unique value;
|
|
6
|
+
* verification layer (SDK) should reject duplicate nonces within a time window.
|
|
7
|
+
*/
|
|
8
|
+
export type Nonce = {
|
|
9
|
+
readonly value: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Creates a unique nonce (default 16 bytes, hex-encoded).
|
|
13
|
+
*
|
|
14
|
+
* @param length - Length in bytes (8–64)
|
|
15
|
+
* @returns Frozen Nonce value object
|
|
16
|
+
*/
|
|
17
|
+
export declare function createNonce(length?: number): Nonce;
|
|
18
|
+
/**
|
|
19
|
+
* Validates that a string is a valid nonce format (hex, 16–128 chars).
|
|
20
|
+
*/
|
|
21
|
+
export declare function isValidNonce(value: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Compares two nonces for equality.
|
|
24
|
+
*/
|
|
25
|
+
export declare function equalsNonce(nonce1: Nonce, nonce2: Nonce): boolean;
|
|
26
|
+
//# sourceMappingURL=Nonce.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nonce.d.ts","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Nonce.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,MAAM,GAAE,MAAW,GAAG,KAAK,CAYtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAEnD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,OAAO,CAEjE"}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Nonce
|
|
3
|
-
*
|
|
2
|
+
* Nonce – unique value for replay prevention. Immutable value object.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used by the envelope to bind each wrapped result to a unique value;
|
|
6
|
+
* verification layer (SDK) should reject duplicate nonces within a time window.
|
|
4
7
|
*/
|
|
5
8
|
import { randomBytes } from 'node:crypto';
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
10
|
+
* Creates a unique nonce (default 16 bytes, hex-encoded).
|
|
8
11
|
*
|
|
9
|
-
* @param length -
|
|
10
|
-
* @returns Nonce
|
|
12
|
+
* @param length - Length in bytes (8–64)
|
|
13
|
+
* @returns Frozen Nonce value object
|
|
11
14
|
*/
|
|
12
15
|
export function createNonce(length = 16) {
|
|
13
16
|
if (length < 8) {
|
|
@@ -18,25 +21,16 @@ export function createNonce(length = 16) {
|
|
|
18
21
|
}
|
|
19
22
|
const bytes = randomBytes(length);
|
|
20
23
|
const value = bytes.toString('hex');
|
|
21
|
-
return Object.freeze({
|
|
22
|
-
value,
|
|
23
|
-
});
|
|
24
|
+
return Object.freeze({ value });
|
|
24
25
|
}
|
|
25
26
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param value - String a validar
|
|
29
|
-
* @returns true si es un nonce válido
|
|
27
|
+
* Validates that a string is a valid nonce format (hex, 16–128 chars).
|
|
30
28
|
*/
|
|
31
29
|
export function isValidNonce(value) {
|
|
32
30
|
return /^[a-f0-9]{16,128}$/i.test(value);
|
|
33
31
|
}
|
|
34
32
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* @param nonce1 - Primer nonce
|
|
38
|
-
* @param nonce2 - Segundo nonce
|
|
39
|
-
* @returns true si son iguales
|
|
33
|
+
* Compares two nonces for equality.
|
|
40
34
|
*/
|
|
41
35
|
export function equalsNonce(nonce1, nonce2) {
|
|
42
36
|
return nonce1.value === nonce2.value;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Nonce.js","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Nonce.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAMzC;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,SAAiB,EAAE;IAC7C,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IACD,IAAI,MAAM,GAAG,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC1D,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IACjC,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IAEnC,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;AACjC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,MAAa,EAAE,MAAa;IACtD,OAAO,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,KAAK,CAAA;AACtC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signature – HMAC-SHA256 cryptographic signature. Immutable value object.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used by the envelope to sign payload + metadata; verification is responsibility of the SDK.
|
|
6
|
+
*/
|
|
7
|
+
import type { SignatureAlgorithm } from '../types.js';
|
|
8
|
+
export type SignatureVO = {
|
|
9
|
+
readonly value: string;
|
|
10
|
+
readonly algorithm: SignatureAlgorithm;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Creates HMAC-SHA256 signature of the given content.
|
|
14
|
+
*
|
|
15
|
+
* @param content - String to sign (e.g. JSON.stringify(payload + metadata))
|
|
16
|
+
* @param secretKey - Secret key for HMAC (must not be logged or serialized)
|
|
17
|
+
* @returns Frozen Signature value object
|
|
18
|
+
*/
|
|
19
|
+
export declare function createSignature(content: string, secretKey: string): SignatureVO;
|
|
20
|
+
/**
|
|
21
|
+
* Verifies that a signature matches the content (constant-time comparison should be used in production).
|
|
22
|
+
*/
|
|
23
|
+
export declare function verifySignature(content: string, signature: string, secretKey: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Validates signature format (64 hex chars for HMAC-SHA256).
|
|
26
|
+
*/
|
|
27
|
+
export declare function isValidSignatureFormat(signature: string): boolean;
|
|
28
|
+
//# sourceMappingURL=Signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Signature.d.ts","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Signature.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAErD,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,SAAS,EAAE,kBAAkB,CAAA;CACvC,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAiB/E;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAChB,OAAO,CAQT;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAEjE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Signature – HMAC-SHA256 cryptographic signature. Immutable value object.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Used by the envelope to sign payload + metadata; verification is responsibility of the SDK.
|
|
6
|
+
*/
|
|
7
|
+
import { createHmac } from 'node:crypto';
|
|
8
|
+
/**
|
|
9
|
+
* Creates HMAC-SHA256 signature of the given content.
|
|
10
|
+
*
|
|
11
|
+
* @param content - String to sign (e.g. JSON.stringify(payload + metadata))
|
|
12
|
+
* @param secretKey - Secret key for HMAC (must not be logged or serialized)
|
|
13
|
+
* @returns Frozen Signature value object
|
|
14
|
+
*/
|
|
15
|
+
export function createSignature(content, secretKey) {
|
|
16
|
+
if (!secretKey || secretKey.length === 0) {
|
|
17
|
+
throw new Error('Secret key is required for signature generation');
|
|
18
|
+
}
|
|
19
|
+
if (typeof content !== 'string') {
|
|
20
|
+
throw new TypeError('Content must be a string');
|
|
21
|
+
}
|
|
22
|
+
const hmac = createHmac('sha256', secretKey);
|
|
23
|
+
hmac.update(content);
|
|
24
|
+
const signature = hmac.digest('hex');
|
|
25
|
+
return Object.freeze({
|
|
26
|
+
value: signature,
|
|
27
|
+
algorithm: 'HMAC-SHA256',
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Verifies that a signature matches the content (constant-time comparison should be used in production).
|
|
32
|
+
*/
|
|
33
|
+
export function verifySignature(content, signature, secretKey) {
|
|
34
|
+
if (!secretKey || secretKey.length === 0)
|
|
35
|
+
return false;
|
|
36
|
+
try {
|
|
37
|
+
const expected = createSignature(content, secretKey);
|
|
38
|
+
return expected.value === signature;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Validates signature format (64 hex chars for HMAC-SHA256).
|
|
46
|
+
*/
|
|
47
|
+
export function isValidSignatureFormat(signature) {
|
|
48
|
+
return /^[a-f0-9]{64}$/i.test(signature);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=Signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Signature.js","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/Signature.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAQxC;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,SAAiB;IAChE,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,iDAA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;AAC/D,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/shared/envelope/value-objects/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAE/D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/shared/index.d.ts
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export { addLineageEntry, addLineageEntries, filterLineageByStep, getLastLineageEntry } from './lineage.js';
|
|
8
8
|
export { formatLineageForAudit, formatCSLForAudit, formatISLForAudit, formatISLSignalForAudit, formatAALForAudit, formatCPEForAudit, formatPipelineAudit, formatPipelineAuditFull, formatPipelineAuditAsJson, createAuditRunId, buildAuditLogEntry, buildFullAuditPayload } from './audit.js';
|
|
9
|
-
export type { LineageEntryLike, CSLResultLike, ISLResultLike, ISLSignalLike, DecisionReasonLike,
|
|
9
|
+
export type { LineageEntryLike, CSLResultLike, ISLResultLike, ISLSignalLike, DecisionReasonLike, RemediationPlanLike, CPEResultLike, AuditRunInfo, AuditLogSummary, FullPipelineAuditOptions, PipelineAuditJsonOptions } from './audit.js';
|
|
10
10
|
export type { Position, SegmentRef } from './types.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,cAAc,CAAA;AAGrB,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,uBAAuB,EACvB,yBAAyB,EACzB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,EACb,YAAY,EACZ,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACzB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,QAAQ,EACR,UAAU,EACX,MAAM,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-pip/core",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Core implementation of the AI-PIP protocol. Provides layered, zero-trust context processing (CSL, ISL, AAL
|
|
3
|
+
"version": "0.5.0",
|
|
4
|
+
"description": "Core implementation of the AI-PIP protocol. Provides layered, zero-trust context processing (CSL, ISL, AAL) and transversal integrity (CPE)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"default": "./dist/AAL/index.js"
|
|
28
28
|
},
|
|
29
29
|
"./cpe": {
|
|
30
|
-
"types": "./dist/
|
|
31
|
-
"import": "./dist/
|
|
32
|
-
"default": "./dist/
|
|
30
|
+
"types": "./dist/shared/envelope/index.d.ts",
|
|
31
|
+
"import": "./dist/shared/envelope/index.js",
|
|
32
|
+
"default": "./dist/shared/envelope/index.js"
|
|
33
33
|
},
|
|
34
34
|
"./shared": {
|
|
35
35
|
"types": "./dist/shared/index.d.ts",
|
|
@@ -87,9 +87,11 @@
|
|
|
87
87
|
"test:ui": "vitest --ui",
|
|
88
88
|
"test:coverage": "vitest --coverage",
|
|
89
89
|
"test:install": "node test-package-install.js",
|
|
90
|
+
"test:tags": "node scripts/test-tags-exhaustive.mjs",
|
|
90
91
|
"verify-risk": "node scripts/verify-risk-score.mjs",
|
|
91
92
|
"demo-menu": "node scripts/interactive-risk-menu.mjs",
|
|
92
93
|
"demo-full": "node scripts/demo-full-flow.mjs",
|
|
93
|
-
"audit-report": "node scripts/audit-report.mjs"
|
|
94
|
+
"audit-report": "node scripts/audit-report.mjs",
|
|
95
|
+
"scan-removal": "node scripts/scan-removal.mjs"
|
|
94
96
|
}
|
|
95
97
|
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* applyRemovalPlan - Applies a removal plan to ISL result (pure, deterministic).
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Removes malicious ranges from each segment's sanitizedContent according to the plan.
|
|
6
|
-
* Only instructions with segmentId are applied; others are skipped.
|
|
7
|
-
* Overlapping ranges per segment are merged before removal.
|
|
8
|
-
*/
|
|
9
|
-
import type { RemovalPlan } from './buildRemovalPlan.js';
|
|
10
|
-
import type { ISLResult } from '../../isl/types.js';
|
|
11
|
-
/**
|
|
12
|
-
* Applies a removal plan to an ISL result.
|
|
13
|
-
* Produces a new ISLResult with segment sanitizedContent updated (malicious ranges removed).
|
|
14
|
-
* Instructions without segmentId are ignored. Positions are clamped to [0, content.length] per segment; invalid or empty ranges are dropped. Lineage and metadata are preserved.
|
|
15
|
-
*
|
|
16
|
-
* @param islResult - ISL result (segments with sanitizedContent and optional piDetection)
|
|
17
|
-
* @param plan - Removal plan from buildRemovalPlanFromResult (must include segmentIds for removal)
|
|
18
|
-
* @returns New ISLResult with sanitizedContent updated per segment
|
|
19
|
-
*/
|
|
20
|
-
export declare function applyRemovalPlan(islResult: ISLResult, plan: RemovalPlan): ISLResult;
|
|
21
|
-
//# sourceMappingURL=applyRemovalPlan.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyRemovalPlan.d.ts","sourceRoot":"","sources":["../../../src/AAL/process/applyRemovalPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,SAAS,EAAc,MAAM,oBAAoB,CAAA;AAwG/D;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,GAAG,SAAS,CAmCnF"}
|
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* applyRemovalPlan - Applies a removal plan to ISL result (pure, deterministic).
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Removes malicious ranges from each segment's sanitizedContent according to the plan.
|
|
6
|
-
* Only instructions with segmentId are applied; others are skipped.
|
|
7
|
-
* Overlapping ranges per segment are merged before removal.
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* Clamps position ranges to valid [0, contentLength) and drops empty or invalid ranges.
|
|
11
|
-
* Ensures 0 <= start <= end <= contentLength and start < end.
|
|
12
|
-
*/
|
|
13
|
-
function clampRangesToContent(ranges, contentLength) {
|
|
14
|
-
if (contentLength <= 0 || ranges.length === 0)
|
|
15
|
-
return [];
|
|
16
|
-
const result = [];
|
|
17
|
-
for (const r of ranges) {
|
|
18
|
-
const start = Math.max(0, Math.min(Number(r.start), contentLength));
|
|
19
|
-
const end = Math.max(0, Math.min(Number(r.end), contentLength));
|
|
20
|
-
if (start < end)
|
|
21
|
-
result.push({ start, end });
|
|
22
|
-
}
|
|
23
|
-
return result;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Merges overlapping ranges (start inclusive, end exclusive). Sorted by start.
|
|
27
|
-
*/
|
|
28
|
-
function mergeRanges(ranges) {
|
|
29
|
-
if (ranges.length === 0)
|
|
30
|
-
return [];
|
|
31
|
-
const sorted = [...ranges].sort((a, b) => a.start - b.start);
|
|
32
|
-
const merged = [{ start: sorted[0].start, end: sorted[0].end }];
|
|
33
|
-
for (let i = 1; i < sorted.length; i++) {
|
|
34
|
-
const r = sorted[i];
|
|
35
|
-
const last = merged.at(-1);
|
|
36
|
-
if (r.start <= last.end) {
|
|
37
|
-
merged[merged.length - 1] = { start: last.start, end: Math.max(last.end, r.end) };
|
|
38
|
-
}
|
|
39
|
-
else {
|
|
40
|
-
merged.push({ start: r.start, end: r.end });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return merged;
|
|
44
|
-
}
|
|
45
|
-
/** Max gap (chars) between ranges to consider for merging when gap is only punctuation/whitespace */
|
|
46
|
-
const MAX_PUNCTUATION_GAP = 10;
|
|
47
|
-
/** True if the substring is only whitespace and/or common punctuation (no words). */
|
|
48
|
-
function isOnlyPunctuationOrWhitespace(s) {
|
|
49
|
-
return /^[\s.,;:!?'"-]*$/.test(s);
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Merges consecutive ranges when the gap between them is only punctuation/whitespace,
|
|
53
|
-
* so we remove one contiguous block instead of leaving fragments like ", . ".
|
|
54
|
-
*/
|
|
55
|
-
function mergeAdjacentByPunctuation(ranges, content) {
|
|
56
|
-
if (ranges.length <= 1)
|
|
57
|
-
return [...ranges];
|
|
58
|
-
const result = [{ ...ranges[0] }];
|
|
59
|
-
for (let i = 1; i < ranges.length; i++) {
|
|
60
|
-
const r = ranges[i];
|
|
61
|
-
const last = result.at(-1);
|
|
62
|
-
const gapStart = last.end;
|
|
63
|
-
const gapEnd = r.start;
|
|
64
|
-
if (gapEnd > gapStart && gapEnd - gapStart <= MAX_PUNCTUATION_GAP) {
|
|
65
|
-
const gap = content.slice(gapStart, gapEnd);
|
|
66
|
-
if (isOnlyPunctuationOrWhitespace(gap)) {
|
|
67
|
-
result[result.length - 1] = { start: last.start, end: r.end };
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
result.push({ ...r });
|
|
72
|
-
}
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Removes given ranges from content. Ranges must be non-overlapping and sorted by start.
|
|
77
|
-
*/
|
|
78
|
-
function removeRanges(content, ranges) {
|
|
79
|
-
if (ranges.length === 0)
|
|
80
|
-
return content;
|
|
81
|
-
let result = '';
|
|
82
|
-
let pos = 0;
|
|
83
|
-
for (const r of ranges) {
|
|
84
|
-
if (r.start > pos)
|
|
85
|
-
result += content.slice(pos, r.start);
|
|
86
|
-
pos = Math.max(pos, r.end);
|
|
87
|
-
}
|
|
88
|
-
if (pos < content.length)
|
|
89
|
-
result += content.slice(pos);
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
function assertApplyRemovalPlanArgs(islResult, plan) {
|
|
93
|
-
if (islResult == null || typeof islResult !== 'object') {
|
|
94
|
-
throw new TypeError('AAL applyRemovalPlan: islResult must be a non-null object');
|
|
95
|
-
}
|
|
96
|
-
if (!Array.isArray(islResult.segments)) {
|
|
97
|
-
throw new TypeError('AAL applyRemovalPlan: islResult.segments must be an array');
|
|
98
|
-
}
|
|
99
|
-
if (plan == null || typeof plan !== 'object') {
|
|
100
|
-
throw new TypeError('AAL applyRemovalPlan: plan must be a non-null object');
|
|
101
|
-
}
|
|
102
|
-
if (!Array.isArray(plan.instructionsToRemove)) {
|
|
103
|
-
throw new TypeError('AAL applyRemovalPlan: plan.instructionsToRemove must be an array');
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Applies a removal plan to an ISL result.
|
|
108
|
-
* Produces a new ISLResult with segment sanitizedContent updated (malicious ranges removed).
|
|
109
|
-
* Instructions without segmentId are ignored. Positions are clamped to [0, content.length] per segment; invalid or empty ranges are dropped. Lineage and metadata are preserved.
|
|
110
|
-
*
|
|
111
|
-
* @param islResult - ISL result (segments with sanitizedContent and optional piDetection)
|
|
112
|
-
* @param plan - Removal plan from buildRemovalPlanFromResult (must include segmentIds for removal)
|
|
113
|
-
* @returns New ISLResult with sanitizedContent updated per segment
|
|
114
|
-
*/
|
|
115
|
-
export function applyRemovalPlan(islResult, plan) {
|
|
116
|
-
assertApplyRemovalPlanArgs(islResult, plan);
|
|
117
|
-
if (!plan.shouldRemove || plan.instructionsToRemove.length === 0) {
|
|
118
|
-
return islResult;
|
|
119
|
-
}
|
|
120
|
-
const bySegmentId = new Map();
|
|
121
|
-
for (const inst of plan.instructionsToRemove) {
|
|
122
|
-
if (inst.segmentId == null)
|
|
123
|
-
continue;
|
|
124
|
-
const list = bySegmentId.get(inst.segmentId) ?? [];
|
|
125
|
-
list.push(inst.position);
|
|
126
|
-
bySegmentId.set(inst.segmentId, list);
|
|
127
|
-
}
|
|
128
|
-
if (bySegmentId.size === 0)
|
|
129
|
-
return islResult;
|
|
130
|
-
const newSegments = islResult.segments.map((seg) => {
|
|
131
|
-
const ranges = bySegmentId.get(seg.id);
|
|
132
|
-
if (ranges == null || ranges.length === 0)
|
|
133
|
-
return seg;
|
|
134
|
-
const content = seg.sanitizedContent ?? '';
|
|
135
|
-
const len = typeof content === 'string' ? content.length : 0;
|
|
136
|
-
const clamped = clampRangesToContent(ranges, len);
|
|
137
|
-
if (clamped.length === 0)
|
|
138
|
-
return seg;
|
|
139
|
-
const merged = mergeRanges(clamped);
|
|
140
|
-
const mergedAdjacent = mergeAdjacentByPunctuation(merged, content);
|
|
141
|
-
const newContent = removeRanges(content, mergedAdjacent);
|
|
142
|
-
return { ...seg, sanitizedContent: newContent };
|
|
143
|
-
});
|
|
144
|
-
return {
|
|
145
|
-
segments: Object.freeze(newSegments),
|
|
146
|
-
lineage: islResult.lineage,
|
|
147
|
-
metadata: islResult.metadata
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
//# sourceMappingURL=applyRemovalPlan.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyRemovalPlan.js","sourceRoot":"","sources":["../../../src/AAL/process/applyRemovalPlan.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH;;;GAGG;AACH,SAAS,oBAAoB,CAC3B,MAA2B,EAC3B,aAAqB;IAErB,IAAI,aAAa,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAA;IACxD,MAAM,MAAM,GAAe,EAAE,CAAA;IAC7B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,CAAC,CAAA;QACnE,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC,CAAA;QAC/D,IAAI,KAAK,GAAG,GAAG;YAAE,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAA;IAC9C,CAAC;IACD,OAAO,MAAM,CAAA;AACf,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A;QACnC,MAAM,cAAc,GAAG,0BAA0B,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAClE,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;QACxD,OAAO,EAAE,GAAG,GAAG,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAA;IACjD,CAAC,CAAC,CAAA;IAEF,OAAO;QACL,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC;QACpC,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,QAAQ,EAAE,SAAS,CAAC,QAAQ;KAC7B,CAAA;AACH,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* buildRemovalPlan - Builds a plan for instruction removal
|
|
3
|
-
*
|
|
4
|
-
* @remarks
|
|
5
|
-
* Two entry points:
|
|
6
|
-
* - buildRemovalPlan(islSignal, policy): from signal only; no segmentId (descriptive).
|
|
7
|
-
* - buildRemovalPlanFromResult(islResult, policy): from result; includes segmentId for applyRemovalPlan.
|
|
8
|
-
*/
|
|
9
|
-
import type { RemovedInstruction } from '../types.js';
|
|
10
|
-
import type { AgentPolicy } from '../types.js';
|
|
11
|
-
import type { ISLSignal } from '../../isl/signals.js';
|
|
12
|
-
import type { ISLResult } from '../../isl/types.js';
|
|
13
|
-
/**
|
|
14
|
-
* Plan for instruction removal
|
|
15
|
-
*/
|
|
16
|
-
export interface RemovalPlan {
|
|
17
|
-
readonly instructionsToRemove: readonly RemovedInstruction[];
|
|
18
|
-
readonly shouldRemove: boolean;
|
|
19
|
-
readonly removalEnabled: boolean;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Builds a plan for instruction removal from ISL signal (no segment ids).
|
|
23
|
-
* Use when you only have the signal; plan is descriptive. For actionable removal use buildRemovalPlanFromResult.
|
|
24
|
-
*
|
|
25
|
-
* @param islSignal - ISL signal with detections
|
|
26
|
-
* @param policy - Agent policy
|
|
27
|
-
* @returns RemovalPlan with instructions to remove (no segmentId)
|
|
28
|
-
*/
|
|
29
|
-
export declare function buildRemovalPlan(islSignal: ISLSignal, policy: AgentPolicy): RemovalPlan;
|
|
30
|
-
/**
|
|
31
|
-
* Builds a plan for instruction removal from ISL result (with segment ids).
|
|
32
|
-
* Use with applyRemovalPlan to produce content with malicious ranges removed.
|
|
33
|
-
*
|
|
34
|
-
* @param islResult - ISL result with segments and per-segment piDetection
|
|
35
|
-
* @param policy - Agent policy
|
|
36
|
-
* @returns RemovalPlan with instructions to remove (segmentId set per instruction)
|
|
37
|
-
*/
|
|
38
|
-
export declare function buildRemovalPlanFromResult(islResult: ISLResult, policy: AgentPolicy): RemovalPlan;
|
|
39
|
-
//# sourceMappingURL=buildRemovalPlan.d.ts.map
|