@houtini/lm 1.0.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 +273 -0
- package/LICENSE +21 -0
- package/README.md +203 -0
- package/dist/cache/analysis-cache.d.ts +33 -0
- package/dist/cache/analysis-cache.d.ts.map +1 -0
- package/dist/cache/analysis-cache.js +56 -0
- package/dist/cache/analysis-cache.js.map +1 -0
- package/dist/cache/cache-manager.d.ts +29 -0
- package/dist/cache/cache-manager.d.ts.map +1 -0
- package/dist/cache/cache-manager.js +85 -0
- package/dist/cache/cache-manager.js.map +1 -0
- package/dist/cache/index.d.ts +16 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +17 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/prompt-cache.d.ts +33 -0
- package/dist/cache/prompt-cache.d.ts.map +1 -0
- package/dist/cache/prompt-cache.js +61 -0
- package/dist/cache/prompt-cache.js.map +1 -0
- package/dist/config.d.ts +43 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +70 -0
- package/dist/config.js.map +1 -0
- package/dist/core/ThreeStagePromptManager.d.ts +39 -0
- package/dist/core/ThreeStagePromptManager.d.ts.map +1 -0
- package/dist/core/ThreeStagePromptManager.js +176 -0
- package/dist/core/ThreeStagePromptManager.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins/base-plugin.d.ts +47 -0
- package/dist/plugins/base-plugin.d.ts.map +1 -0
- package/dist/plugins/base-plugin.js +90 -0
- package/dist/plugins/base-plugin.js.map +1 -0
- package/dist/plugins/index.d.ts +58 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +161 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/types.d.ts +5 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +5 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/prompts/analyze/code-quality.d.ts +116 -0
- package/dist/prompts/analyze/code-quality.d.ts.map +1 -0
- package/dist/prompts/analyze/code-quality.js +433 -0
- package/dist/prompts/analyze/code-quality.js.map +1 -0
- package/dist/prompts/analyze/compare-integration.d.ts +130 -0
- package/dist/prompts/analyze/compare-integration.d.ts.map +1 -0
- package/dist/prompts/analyze/compare-integration.js +543 -0
- package/dist/prompts/analyze/compare-integration.js.map +1 -0
- package/dist/prompts/analyze/count-files.d.ts +109 -0
- package/dist/prompts/analyze/count-files.d.ts.map +1 -0
- package/dist/prompts/analyze/count-files.js +399 -0
- package/dist/prompts/analyze/count-files.js.map +1 -0
- package/dist/prompts/analyze/database-queries.d.ts +156 -0
- package/dist/prompts/analyze/database-queries.d.ts.map +1 -0
- package/dist/prompts/analyze/database-queries.js +759 -0
- package/dist/prompts/analyze/database-queries.js.map +1 -0
- package/dist/prompts/analyze/dependencies.d.ts +97 -0
- package/dist/prompts/analyze/dependencies.d.ts.map +1 -0
- package/dist/prompts/analyze/dependencies.js +333 -0
- package/dist/prompts/analyze/dependencies.js.map +1 -0
- package/dist/prompts/analyze/diff-signatures.d.ts +139 -0
- package/dist/prompts/analyze/diff-signatures.d.ts.map +1 -0
- package/dist/prompts/analyze/diff-signatures.js +702 -0
- package/dist/prompts/analyze/diff-signatures.js.map +1 -0
- package/dist/prompts/analyze/find-patterns.d.ts +128 -0
- package/dist/prompts/analyze/find-patterns.d.ts.map +1 -0
- package/dist/prompts/analyze/find-patterns.js +520 -0
- package/dist/prompts/analyze/find-patterns.js.map +1 -0
- package/dist/prompts/analyze/find-unused-css.d.ts +151 -0
- package/dist/prompts/analyze/find-unused-css.d.ts.map +1 -0
- package/dist/prompts/analyze/find-unused-css.js +754 -0
- package/dist/prompts/analyze/find-unused-css.js.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts +137 -0
- package/dist/prompts/analyze/n8n-workflow.d.ts.map +1 -0
- package/dist/prompts/analyze/n8n-workflow.js +529 -0
- package/dist/prompts/analyze/n8n-workflow.js.map +1 -0
- package/dist/prompts/analyze/project-structure.d.ts +126 -0
- package/dist/prompts/analyze/project-structure.d.ts.map +1 -0
- package/dist/prompts/analyze/project-structure.js +569 -0
- package/dist/prompts/analyze/project-structure.js.map +1 -0
- package/dist/prompts/analyze/security-audit.d.ts +142 -0
- package/dist/prompts/analyze/security-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/security-audit.js +637 -0
- package/dist/prompts/analyze/security-audit.js.map +1 -0
- package/dist/prompts/analyze/single-file.d.ts +162 -0
- package/dist/prompts/analyze/single-file.d.ts.map +1 -0
- package/dist/prompts/analyze/single-file.js +665 -0
- package/dist/prompts/analyze/single-file.js.map +1 -0
- package/dist/prompts/analyze/trace-execution.d.ts +126 -0
- package/dist/prompts/analyze/trace-execution.d.ts.map +1 -0
- package/dist/prompts/analyze/trace-execution.js +609 -0
- package/dist/prompts/analyze/trace-execution.js.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts +116 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js +454 -0
- package/dist/prompts/analyze/wordpress-plugin-audit.js.map +1 -0
- package/dist/prompts/analyze/wordpress-security.d.ts +146 -0
- package/dist/prompts/analyze/wordpress-security.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-security.js +698 -0
- package/dist/prompts/analyze/wordpress-security.js.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts +114 -0
- package/dist/prompts/analyze/wordpress-theme-audit.d.ts.map +1 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js +538 -0
- package/dist/prompts/analyze/wordpress-theme-audit.js.map +1 -0
- package/dist/prompts/custom/custom-prompt.d.ts +135 -0
- package/dist/prompts/custom/custom-prompt.d.ts.map +1 -0
- package/dist/prompts/custom/custom-prompt.js +419 -0
- package/dist/prompts/custom/custom-prompt.js.map +1 -0
- package/dist/prompts/fun/arcade-game.d.ts +152 -0
- package/dist/prompts/fun/arcade-game.d.ts.map +1 -0
- package/dist/prompts/fun/arcade-game.js +653 -0
- package/dist/prompts/fun/arcade-game.js.map +1 -0
- package/dist/prompts/fun/create_text_adventure.d.ts +100 -0
- package/dist/prompts/fun/create_text_adventure.d.ts.map +1 -0
- package/dist/prompts/fun/create_text_adventure.js +397 -0
- package/dist/prompts/fun/create_text_adventure.js.map +1 -0
- package/dist/prompts/fun/css-art-generator.d.ts +168 -0
- package/dist/prompts/fun/css-art-generator.d.ts.map +1 -0
- package/dist/prompts/fun/css-art-generator.js +827 -0
- package/dist/prompts/fun/css-art-generator.js.map +1 -0
- package/dist/prompts/generate/project-documentation.d.ts +137 -0
- package/dist/prompts/generate/project-documentation.d.ts.map +1 -0
- package/dist/prompts/generate/project-documentation.js +666 -0
- package/dist/prompts/generate/project-documentation.js.map +1 -0
- package/dist/prompts/generate/refactoring.d.ts +164 -0
- package/dist/prompts/generate/refactoring.d.ts.map +1 -0
- package/dist/prompts/generate/refactoring.js +621 -0
- package/dist/prompts/generate/refactoring.js.map +1 -0
- package/dist/prompts/generate/responsive-component.d.ts +147 -0
- package/dist/prompts/generate/responsive-component.d.ts.map +1 -0
- package/dist/prompts/generate/responsive-component.js +955 -0
- package/dist/prompts/generate/responsive-component.js.map +1 -0
- package/dist/prompts/generate/typescript-conversion.d.ts +144 -0
- package/dist/prompts/generate/typescript-conversion.d.ts.map +1 -0
- package/dist/prompts/generate/typescript-conversion.js +527 -0
- package/dist/prompts/generate/typescript-conversion.js.map +1 -0
- package/dist/prompts/generate/unit-tests.d.ts +139 -0
- package/dist/prompts/generate/unit-tests.d.ts.map +1 -0
- package/dist/prompts/generate/unit-tests.js +578 -0
- package/dist/prompts/generate/unit-tests.js.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts +179 -0
- package/dist/prompts/generate/wordpress-plugin.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-plugin.js +763 -0
- package/dist/prompts/generate/wordpress-plugin.js.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts +177 -0
- package/dist/prompts/generate/wordpress-theme-from-static.d.ts.map +1 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js +695 -0
- package/dist/prompts/generate/wordpress-theme-from-static.js.map +1 -0
- package/dist/prompts/shared/cache-manager.d.ts +45 -0
- package/dist/prompts/shared/cache-manager.d.ts.map +1 -0
- package/dist/prompts/shared/cache-manager.js +129 -0
- package/dist/prompts/shared/cache-manager.js.map +1 -0
- package/dist/prompts/shared/helpers.d.ts +39 -0
- package/dist/prompts/shared/helpers.d.ts.map +1 -0
- package/dist/prompts/shared/helpers.js +151 -0
- package/dist/prompts/shared/helpers.js.map +1 -0
- package/dist/prompts/shared/templates.d.ts +35 -0
- package/dist/prompts/shared/templates.d.ts.map +1 -0
- package/dist/prompts/shared/templates.js +77 -0
- package/dist/prompts/shared/templates.js.map +1 -0
- package/dist/prompts/shared/types.d.ts +112 -0
- package/dist/prompts/shared/types.d.ts.map +1 -0
- package/dist/prompts/shared/types.js +5 -0
- package/dist/prompts/shared/types.js.map +1 -0
- package/dist/prompts/system/find-unused-files.d.ts +106 -0
- package/dist/prompts/system/find-unused-files.d.ts.map +1 -0
- package/dist/prompts/system/find-unused-files.js +353 -0
- package/dist/prompts/system/find-unused-files.js.map +1 -0
- package/dist/security/index.d.ts +39 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +46 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/integration-helpers.d.ts +121 -0
- package/dist/security/integration-helpers.d.ts.map +1 -0
- package/dist/security/integration-helpers.js +190 -0
- package/dist/security/integration-helpers.js.map +1 -0
- package/dist/security/output-encoder.d.ts +94 -0
- package/dist/security/output-encoder.d.ts.map +1 -0
- package/dist/security/output-encoder.js +295 -0
- package/dist/security/output-encoder.js.map +1 -0
- package/dist/security/prompt-injection-guard.d.ts +59 -0
- package/dist/security/prompt-injection-guard.d.ts.map +1 -0
- package/dist/security/prompt-injection-guard.js +249 -0
- package/dist/security/prompt-injection-guard.js.map +1 -0
- package/dist/security/sanitisation.d.ts +67 -0
- package/dist/security/sanitisation.d.ts.map +1 -0
- package/dist/security/sanitisation.js +398 -0
- package/dist/security/sanitisation.js.map +1 -0
- package/dist/security/security-service.d.ts +103 -0
- package/dist/security/security-service.d.ts.map +1 -0
- package/dist/security/security-service.js +303 -0
- package/dist/security/security-service.js.map +1 -0
- package/dist/security-config.d.ts +45 -0
- package/dist/security-config.d.ts.map +1 -0
- package/dist/security-config.js +63 -0
- package/dist/security-config.js.map +1 -0
- package/dist/system/function-list.d.ts +61 -0
- package/dist/system/function-list.d.ts.map +1 -0
- package/dist/system/function-list.js +111 -0
- package/dist/system/function-list.js.map +1 -0
- package/dist/system/function-registry.d.ts +23 -0
- package/dist/system/function-registry.d.ts.map +1 -0
- package/dist/system/function-registry.js +136 -0
- package/dist/system/function-registry.js.map +1 -0
- package/dist/system/health-check.d.ts +33 -0
- package/dist/system/health-check.d.ts.map +1 -0
- package/dist/system/health-check.js +98 -0
- package/dist/system/health-check.js.map +1 -0
- package/dist/system/path-resolver.d.ts +55 -0
- package/dist/system/path-resolver.d.ts.map +1 -0
- package/dist/system/path-resolver.js +90 -0
- package/dist/system/path-resolver.js.map +1 -0
- package/dist/templates/plugin-template.d.ts +121 -0
- package/dist/templates/plugin-template.d.ts.map +1 -0
- package/dist/templates/plugin-template.js +450 -0
- package/dist/templates/plugin-template.js.map +1 -0
- package/dist/types/chunking-types.d.ts +88 -0
- package/dist/types/chunking-types.d.ts.map +1 -0
- package/dist/types/chunking-types.js +18 -0
- package/dist/types/chunking-types.js.map +1 -0
- package/dist/types/prompt-stages.d.ts +42 -0
- package/dist/types/prompt-stages.d.ts.map +1 -0
- package/dist/types/prompt-stages.js +6 -0
- package/dist/types/prompt-stages.js.map +1 -0
- package/dist/types.d.ts +46 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/css-parser.d.ts +26 -0
- package/dist/utils/css-parser.d.ts.map +1 -0
- package/dist/utils/css-parser.js +117 -0
- package/dist/utils/css-parser.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +13 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +78 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/plugin-utilities.d.ts +171 -0
- package/dist/utils/plugin-utilities.d.ts.map +1 -0
- package/dist/utils/plugin-utilities.js +221 -0
- package/dist/utils/plugin-utilities.js.map +1 -0
- package/dist/utils/streamHandler.d.ts +3 -0
- package/dist/utils/streamHandler.d.ts.map +1 -0
- package/dist/utils/streamHandler.js +137 -0
- package/dist/utils/streamHandler.js.map +1 -0
- package/dist/validation/output-validator.d.ts +136 -0
- package/dist/validation/output-validator.d.ts.map +1 -0
- package/dist/validation/output-validator.js +262 -0
- package/dist/validation/output-validator.js.map +1 -0
- package/dist/validation/response-factory.d.ts +44 -0
- package/dist/validation/response-factory.d.ts.map +1 -0
- package/dist/validation/response-factory.js +202 -0
- package/dist/validation/response-factory.js.map +1 -0
- package/dist/validation/schemas.d.ts +519 -0
- package/dist/validation/schemas.d.ts.map +1 -0
- package/dist/validation/schemas.js +6 -0
- package/dist/validation/schemas.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Integration Helpers
|
|
3
|
+
*
|
|
4
|
+
* Provides easy-to-use wrapper functions and decorators for integrating
|
|
5
|
+
* security into existing plugins with minimal code changes.
|
|
6
|
+
*/
|
|
7
|
+
import { type PluginInterface } from './security-service.js';
|
|
8
|
+
/**
|
|
9
|
+
* Simple wrapper function that can be added to any plugin's execute method
|
|
10
|
+
*
|
|
11
|
+
* Usage in any plugin:
|
|
12
|
+
* import { withSecurity } from '../security/integration-helpers.js';
|
|
13
|
+
*
|
|
14
|
+
* async execute(params: any, llmClient: any) {
|
|
15
|
+
* return await withSecurity(this, params, llmClient, async (secureParams) => {
|
|
16
|
+
* // Your existing plugin logic here
|
|
17
|
+
* return await this.originalLogic(secureParams, llmClient);
|
|
18
|
+
* });
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare function withSecurity<T>(plugin: PluginInterface, params: any, llmClient: any, originalLogic: (secureParams: any) => Promise<T>): Promise<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Quick parameter validation helper
|
|
24
|
+
*
|
|
25
|
+
* Usage:
|
|
26
|
+
* const safePath = await secureParam(params.filePath, 'file-path');
|
|
27
|
+
* const safeCode = await secureParam(params.code, 'code');
|
|
28
|
+
*/
|
|
29
|
+
export declare function secureParam(value: any, context?: 'file-path' | 'code' | 'prompt' | 'general'): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* File path validation helper
|
|
32
|
+
*
|
|
33
|
+
* Usage:
|
|
34
|
+
* const safePath = await validatePath(params.filePath);
|
|
35
|
+
* const content = await readFileContent(safePath);
|
|
36
|
+
*/
|
|
37
|
+
export declare function validatePath(filePath: string): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Output encoding helper
|
|
40
|
+
*
|
|
41
|
+
* Usage:
|
|
42
|
+
* const safeHtml = encodeForContext(userContent, 'html');
|
|
43
|
+
* const safeJson = encodeForContext(responseData, 'json');
|
|
44
|
+
*/
|
|
45
|
+
export declare function encodeForContext(content: any, context: 'html' | 'json' | 'markdown' | 'plain-text' | 'code' | 'xml'): any;
|
|
46
|
+
/**
|
|
47
|
+
* Plugin wrapper class for complete security integration
|
|
48
|
+
*
|
|
49
|
+
* Usage:
|
|
50
|
+
* class MyPlugin extends SecurePlugin {
|
|
51
|
+
* // Your plugin implementation
|
|
52
|
+
* }
|
|
53
|
+
*/
|
|
54
|
+
export declare abstract class SecurePlugin implements PluginInterface {
|
|
55
|
+
abstract name: string;
|
|
56
|
+
abstract category: 'analyze' | 'generate' | 'multifile' | 'custom' | 'system';
|
|
57
|
+
abstract executeSecurely(params: any, llmClient: any): Promise<any>;
|
|
58
|
+
execute(params: any, llmClient: any): Promise<any>;
|
|
59
|
+
executeOriginal(params: any, llmClient: any): Promise<any>;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Utility function to wrap existing plugin execute methods
|
|
63
|
+
*
|
|
64
|
+
* Usage in plugin files:
|
|
65
|
+
* const originalExecute = plugin.execute.bind(plugin);
|
|
66
|
+
* plugin.execute = wrapPluginExecution(plugin, originalExecute);
|
|
67
|
+
*/
|
|
68
|
+
export declare function wrapPluginExecution(plugin: PluginInterface, originalExecute: (params: any, llmClient: any) => Promise<any>): (params: any, llmClient: any) => Promise<any>;
|
|
69
|
+
/**
|
|
70
|
+
* Batch security processing for multiple parameters
|
|
71
|
+
*
|
|
72
|
+
* Usage:
|
|
73
|
+
* const secureParams = await secureMultipleParams({
|
|
74
|
+
* filePath: params.filePath,
|
|
75
|
+
* code: params.code,
|
|
76
|
+
* userInput: params.userInput
|
|
77
|
+
* }, {
|
|
78
|
+
* filePath: 'file-path',
|
|
79
|
+
* code: 'code',
|
|
80
|
+
* userInput: 'general'
|
|
81
|
+
* });
|
|
82
|
+
*/
|
|
83
|
+
export declare function secureMultipleParams(params: Record<string, any>, contexts: Record<string, 'file-path' | 'code' | 'prompt' | 'general'>): Promise<Record<string, any>>;
|
|
84
|
+
/**
|
|
85
|
+
* Security configuration helper
|
|
86
|
+
*/
|
|
87
|
+
export declare const SecurityConfig: {
|
|
88
|
+
/**
|
|
89
|
+
* Enable/disable security features globally
|
|
90
|
+
*/
|
|
91
|
+
setGlobal(config: {
|
|
92
|
+
sanitisation?: boolean;
|
|
93
|
+
injectionDetection?: boolean;
|
|
94
|
+
outputEncoding?: boolean;
|
|
95
|
+
logEvents?: boolean;
|
|
96
|
+
}): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get current security status
|
|
99
|
+
*/
|
|
100
|
+
getStatus(): {
|
|
101
|
+
enabled: boolean;
|
|
102
|
+
features: Record<string, boolean>;
|
|
103
|
+
diagnostics: any;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Run security diagnostics
|
|
107
|
+
*/
|
|
108
|
+
runTests(): {
|
|
109
|
+
sanitisation: boolean;
|
|
110
|
+
injection: {
|
|
111
|
+
passed: number;
|
|
112
|
+
failed: number;
|
|
113
|
+
};
|
|
114
|
+
encoding: {
|
|
115
|
+
passed: boolean;
|
|
116
|
+
errors: string[];
|
|
117
|
+
};
|
|
118
|
+
serviceHealth: boolean;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=integration-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-helpers.d.ts","sourceRoot":"","sources":["../../src/security/integration-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoC,KAAK,eAAe,EAAuB,MAAM,uBAAuB,CAAC;AAEpH;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,MAAM,EAAE,eAAe,EACvB,MAAM,EAAE,GAAG,EACX,SAAS,EAAE,GAAG,EACd,aAAa,EAAE,CAAC,YAAY,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,GAC/C,OAAO,CAAC,CAAC,CAAC,CAaZ;AAED;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,KAAK,EAAE,GAAG,EACV,OAAO,GAAE,WAAW,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAqB,GAC/D,OAAO,CAAC,GAAG,CAAC,CAgBd;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQpE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,GAAG,EACZ,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,GACpE,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ASR;;OAEG;iBACU;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QAClC,WAAW,EAAE,GAAG,CAAC;KAClB;IAgBD;;OAEG;;;;;;;;;;;;;CAIJ,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Integration Helpers
|
|
3
|
+
*
|
|
4
|
+
* Provides easy-to-use wrapper functions and decorators for integrating
|
|
5
|
+
* security into existing plugins with minimal code changes.
|
|
6
|
+
*/
|
|
7
|
+
import { securityService } from './security-service.js';
|
|
8
|
+
/**
|
|
9
|
+
* Simple wrapper function that can be added to any plugin's execute method
|
|
10
|
+
*
|
|
11
|
+
* Usage in any plugin:
|
|
12
|
+
* import { withSecurity } from '../security/integration-helpers.js';
|
|
13
|
+
*
|
|
14
|
+
* async execute(params: any, llmClient: any) {
|
|
15
|
+
* return await withSecurity(this, params, llmClient, async (secureParams) => {
|
|
16
|
+
* // Your existing plugin logic here
|
|
17
|
+
* return await this.originalLogic(secureParams, llmClient);
|
|
18
|
+
* });
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export async function withSecurity(plugin, params, llmClient, originalLogic) {
|
|
22
|
+
// Use the singleton security service
|
|
23
|
+
const securityResult = await securityService.secureParameters(params, plugin.name);
|
|
24
|
+
if (securityResult.blocked) {
|
|
25
|
+
throw new Error(`Security violation: ${securityResult.warnings.join(', ')}`);
|
|
26
|
+
}
|
|
27
|
+
// Execute original logic with secured parameters
|
|
28
|
+
const result = await originalLogic(securityResult.sanitised);
|
|
29
|
+
// Secure the output
|
|
30
|
+
return await securityService.secureOutput(result, plugin.category);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Quick parameter validation helper
|
|
34
|
+
*
|
|
35
|
+
* Usage:
|
|
36
|
+
* const safePath = await secureParam(params.filePath, 'file-path');
|
|
37
|
+
* const safeCode = await secureParam(params.code, 'code');
|
|
38
|
+
*/
|
|
39
|
+
export async function secureParam(value, context = 'general') {
|
|
40
|
+
if (typeof value !== 'string') {
|
|
41
|
+
return value; // Non-string values pass through
|
|
42
|
+
}
|
|
43
|
+
const result = await securityService.quickCheck(value, 'parameter');
|
|
44
|
+
if (result.blocked) {
|
|
45
|
+
throw new Error(`Parameter blocked: ${result.warnings.join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
if (result.warnings.length > 0) {
|
|
48
|
+
console.warn('Parameter security warnings:', result.warnings);
|
|
49
|
+
}
|
|
50
|
+
return result.sanitised;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* File path validation helper
|
|
54
|
+
*
|
|
55
|
+
* Usage:
|
|
56
|
+
* const safePath = await validatePath(params.filePath);
|
|
57
|
+
* const content = await readFileContent(safePath);
|
|
58
|
+
*/
|
|
59
|
+
export async function validatePath(filePath) {
|
|
60
|
+
const result = await securityService.validateFilePath(filePath);
|
|
61
|
+
if (result.blocked) {
|
|
62
|
+
throw new Error(`File path blocked: ${result.warnings.join(', ')}`);
|
|
63
|
+
}
|
|
64
|
+
return result.sanitised;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Output encoding helper
|
|
68
|
+
*
|
|
69
|
+
* Usage:
|
|
70
|
+
* const safeHtml = encodeForContext(userContent, 'html');
|
|
71
|
+
* const safeJson = encodeForContext(responseData, 'json');
|
|
72
|
+
*/
|
|
73
|
+
export function encodeForContext(content, context) {
|
|
74
|
+
const result = securityService.encodeOutput(content, context);
|
|
75
|
+
if (result.warnings.length > 0) {
|
|
76
|
+
console.warn('Output encoding warnings:', result.warnings);
|
|
77
|
+
}
|
|
78
|
+
return result.encoded;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Plugin wrapper class for complete security integration
|
|
82
|
+
*
|
|
83
|
+
* Usage:
|
|
84
|
+
* class MyPlugin extends SecurePlugin {
|
|
85
|
+
* // Your plugin implementation
|
|
86
|
+
* }
|
|
87
|
+
*/
|
|
88
|
+
export class SecurePlugin {
|
|
89
|
+
// This is called by the MCP system
|
|
90
|
+
async execute(params, llmClient) {
|
|
91
|
+
return await securityService.executeSecurely(this, params, llmClient);
|
|
92
|
+
}
|
|
93
|
+
// Redirect to executeSecurely for the security service
|
|
94
|
+
async executeOriginal(params, llmClient) {
|
|
95
|
+
return await this.executeSecurely(params, llmClient);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Utility function to wrap existing plugin execute methods
|
|
100
|
+
*
|
|
101
|
+
* Usage in plugin files:
|
|
102
|
+
* const originalExecute = plugin.execute.bind(plugin);
|
|
103
|
+
* plugin.execute = wrapPluginExecution(plugin, originalExecute);
|
|
104
|
+
*/
|
|
105
|
+
export function wrapPluginExecution(plugin, originalExecute) {
|
|
106
|
+
return async (params, llmClient) => {
|
|
107
|
+
// Create a temporary plugin interface for the security service
|
|
108
|
+
const wrappedPlugin = {
|
|
109
|
+
name: plugin.name,
|
|
110
|
+
category: plugin.category,
|
|
111
|
+
execute: originalExecute
|
|
112
|
+
};
|
|
113
|
+
return await securityService.executeSecurely(wrappedPlugin, params, llmClient);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Batch security processing for multiple parameters
|
|
118
|
+
*
|
|
119
|
+
* Usage:
|
|
120
|
+
* const secureParams = await secureMultipleParams({
|
|
121
|
+
* filePath: params.filePath,
|
|
122
|
+
* code: params.code,
|
|
123
|
+
* userInput: params.userInput
|
|
124
|
+
* }, {
|
|
125
|
+
* filePath: 'file-path',
|
|
126
|
+
* code: 'code',
|
|
127
|
+
* userInput: 'general'
|
|
128
|
+
* });
|
|
129
|
+
*/
|
|
130
|
+
export async function secureMultipleParams(params, contexts) {
|
|
131
|
+
const secured = {};
|
|
132
|
+
const warnings = [];
|
|
133
|
+
for (const [key, value] of Object.entries(params)) {
|
|
134
|
+
if (typeof value === 'string' && contexts[key]) {
|
|
135
|
+
try {
|
|
136
|
+
secured[key] = await secureParam(value, contexts[key]);
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
throw new Error(`Security violation in parameter '${key}': ${error.message}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
secured[key] = value;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
if (warnings.length > 0) {
|
|
147
|
+
console.warn('Batch security warnings:', warnings);
|
|
148
|
+
}
|
|
149
|
+
return secured;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Security configuration helper
|
|
153
|
+
*/
|
|
154
|
+
export const SecurityConfig = {
|
|
155
|
+
/**
|
|
156
|
+
* Enable/disable security features globally
|
|
157
|
+
*/
|
|
158
|
+
setGlobal(config) {
|
|
159
|
+
securityService.updateConfig({
|
|
160
|
+
enableSanitisation: config.sanitisation,
|
|
161
|
+
enableInjectionDetection: config.injectionDetection,
|
|
162
|
+
enableOutputEncoding: config.outputEncoding,
|
|
163
|
+
logSecurityEvents: config.logEvents
|
|
164
|
+
});
|
|
165
|
+
},
|
|
166
|
+
/**
|
|
167
|
+
* Get current security status
|
|
168
|
+
*/
|
|
169
|
+
getStatus() {
|
|
170
|
+
const config = securityService.getConfig();
|
|
171
|
+
const diagnostics = securityService.runDiagnostics();
|
|
172
|
+
return {
|
|
173
|
+
enabled: config.enableSanitisation || config.enableInjectionDetection || config.enableOutputEncoding,
|
|
174
|
+
features: {
|
|
175
|
+
sanitisation: config.enableSanitisation || false,
|
|
176
|
+
injectionDetection: config.enableInjectionDetection || false,
|
|
177
|
+
outputEncoding: config.enableOutputEncoding || false,
|
|
178
|
+
logging: config.logSecurityEvents || false
|
|
179
|
+
},
|
|
180
|
+
diagnostics
|
|
181
|
+
};
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* Run security diagnostics
|
|
185
|
+
*/
|
|
186
|
+
runTests() {
|
|
187
|
+
return securityService.runDiagnostics();
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
//# sourceMappingURL=integration-helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration-helpers.js","sourceRoot":"","sources":["../../src/security/integration-helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAmB,eAAe,EAA6C,MAAM,uBAAuB,CAAC;AAEpH;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,MAAW,EACX,SAAc,EACd,aAAgD;IAEhD,qCAAqC;IACrC,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IAEnF,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;QAC3B,MAAM,IAAI,KAAK,CAAC,uBAAuB,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED,iDAAiD;IACjD,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IAE7D,oBAAoB;IACpB,OAAO,MAAM,eAAe,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAM,CAAC;AAC1E,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,KAAU,EACV,UAAuD,SAAS;IAEhE,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,iCAAiC;IACjD,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,UAAU,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;IAEpE,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,sBAAsB,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACtE,CA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,CAAC,CAAC;IACrD,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B;;OAEG;IACH,SAAS,CAAC,MAKT;QACC,eAAe,CAAC,YAAY,CAAC;YAC3B,kBAAkB,EAAE,MAAM,CAAC,YAAY;YACvC,wBAAwB,EAAE,MAAM,CAAC,kBAAkB;YACnD,oBAAoB,EAAE,MAAM,CAAC,cAAc;YAC3C,iBAAiB,EAAE,MAAM,CAAC,SAAS;SACpC,CAAC,CAAC;IACL,CAAC;IAED;;OAEG;IACH,SAAS;QAKP,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,EAAE,CAAC;QAC3C,MAAM,WAAW,GAAG,eAAe,CAAC,cAAc,EAAE,CAAC;QAErD,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,kBAAkB,IAAI,MAAM,CAAC,wBAAwB,IAAI,MAAM,CAAC,oBAAoB;YACpG,QAAQ,EAAE;gBACR,YAAY,EAAE,MAAM,CAAC,kBAAkB,IAAI,KAAK;gBAChD,kBAAkB,EAAE,MAAM,CAAC,wBAAwB,IAAI,KAAK;gBAC5D,cAAc,EAAE,MAAM,CAAC,oBAAoB,IAAI,KAAK;gBACpD,OAAO,EAAE,MAAM,CAAC,iBAAiB,IAAI,KAAK;aAC3C;YACD,WAAW;SACZ,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,QAAQ;QACN,OAAO,eAAe,CAAC,cAAc,EAAE,CAAC;IAC1C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Encoding and Sanitisation
|
|
3
|
+
*
|
|
4
|
+
* Provides safe encoding of LLM outputs for different contexts
|
|
5
|
+
* preventing XSS and other injection attacks in responses
|
|
6
|
+
*/
|
|
7
|
+
export type OutputContext = 'html' | 'json' | 'markdown' | 'plain-text' | 'code' | 'xml';
|
|
8
|
+
export interface EncodingOptions {
|
|
9
|
+
context: OutputContext;
|
|
10
|
+
preserveFormatting?: boolean;
|
|
11
|
+
allowedTags?: string[];
|
|
12
|
+
maxLength?: number;
|
|
13
|
+
}
|
|
14
|
+
export interface EncodingResult {
|
|
15
|
+
encoded: string;
|
|
16
|
+
truncated: boolean;
|
|
17
|
+
removedElements: string[];
|
|
18
|
+
warnings: string[];
|
|
19
|
+
}
|
|
20
|
+
export declare class OutputEncoder {
|
|
21
|
+
private static readonly HTML_ENTITIES;
|
|
22
|
+
private static readonly SAFE_HTML_TAGS;
|
|
23
|
+
private static readonly DANGEROUS_PATTERNS;
|
|
24
|
+
/**
|
|
25
|
+
* Encode output based on context
|
|
26
|
+
*/
|
|
27
|
+
static encode(content: any, options: EncodingOptions): EncodingResult;
|
|
28
|
+
/**
|
|
29
|
+
* Encode for HTML context
|
|
30
|
+
*/
|
|
31
|
+
private static encodeForHtml;
|
|
32
|
+
/**
|
|
33
|
+
* Encode for JSON context
|
|
34
|
+
*/
|
|
35
|
+
private static encodeForJson;
|
|
36
|
+
/**
|
|
37
|
+
* Encode for Markdown context
|
|
38
|
+
*/
|
|
39
|
+
private static encodeForMarkdown;
|
|
40
|
+
/**
|
|
41
|
+
* Encode for code context
|
|
42
|
+
*/
|
|
43
|
+
private static encodeForCode;
|
|
44
|
+
/**
|
|
45
|
+
* Encode for XML context
|
|
46
|
+
*/
|
|
47
|
+
private static encodeForXml;
|
|
48
|
+
/**
|
|
49
|
+
* Encode for plain text context
|
|
50
|
+
*/
|
|
51
|
+
private static encodeForPlainText;
|
|
52
|
+
/**
|
|
53
|
+
* Escape HTML entities
|
|
54
|
+
*/
|
|
55
|
+
private static escapeHtmlEntities;
|
|
56
|
+
/**
|
|
57
|
+
* Sanitise HTML while preserving whitelisted tags
|
|
58
|
+
*/
|
|
59
|
+
private static sanitiseHtmlWithWhitelist;
|
|
60
|
+
/**
|
|
61
|
+
* Encode streaming response chunks safely
|
|
62
|
+
*/
|
|
63
|
+
static encodeStreamChunk(chunk: string, context: OutputContext, chunkIndex: number): {
|
|
64
|
+
encoded: string;
|
|
65
|
+
safe: boolean;
|
|
66
|
+
warnings: string[];
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Batch encode multiple outputs
|
|
70
|
+
*/
|
|
71
|
+
static encodeBatch(contents: string[], options: EncodingOptions): EncodingResult[];
|
|
72
|
+
/**
|
|
73
|
+
* Create safe output object for API responses
|
|
74
|
+
*/
|
|
75
|
+
static createSafeResponse(data: any, context?: OutputContext): {
|
|
76
|
+
data: any;
|
|
77
|
+
metadata: {
|
|
78
|
+
encoded: boolean;
|
|
79
|
+
warnings: string[];
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Recursively encode object properties
|
|
84
|
+
*/
|
|
85
|
+
private static encodeObjectRecursively;
|
|
86
|
+
/**
|
|
87
|
+
* Validate encoding is working correctly
|
|
88
|
+
*/
|
|
89
|
+
static validateEncoding(): {
|
|
90
|
+
passed: boolean;
|
|
91
|
+
errors: string[];
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=output-encoder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-encoder.d.ts","sourceRoot":"","sources":["../../src/security/output-encoder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,CAAC;AAEzF,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,aAAa,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;IACnB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC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