log-llm-config 1.0.24 → 1.0.26
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/endpoint_client.js +15 -7
- package/dist/log_config_files.js +265 -1005
- package/dist/log_sensitive_paths_audit.js +1 -1
- package/package.json +1 -1
package/dist/endpoint_client.js
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import https from 'node:https';
|
|
3
3
|
import { URL } from 'node:url';
|
|
4
|
+
/** Path suffix for file collection patterns (backend: api/file-path-registry/file-patterns/). */
|
|
5
|
+
export const FILE_PATH_REGISTRY_FILE_PATTERNS_PATH = '/api/file-path-registry/file-patterns/';
|
|
6
|
+
/** Path suffix for sensitive paths audit candidates (backend: api/file-path-registry/sensitive-paths-audit-candidates/). */
|
|
7
|
+
export const FILE_PATH_REGISTRY_SENSITIVE_PATHS_PATH = '/api/file-path-registry/sensitive-paths-audit-candidates/';
|
|
4
8
|
/**
|
|
5
9
|
* GET file collection patterns from the backend (what to look for).
|
|
6
|
-
* No auth required. Returns the complete list of
|
|
10
|
+
* No auth required. Returns the complete list of path + type + file_type.
|
|
7
11
|
*/
|
|
8
12
|
export const getFileCollectionPatterns = async (apiBaseUrl, timeoutMs = 5000) => {
|
|
9
13
|
const base = apiBaseUrl.replace(/\/+$/, '');
|
|
10
|
-
const fullUrl = base
|
|
11
|
-
? `${base}/api/file-patterns/`.replace(/([^/])\/+/g, '$1/')
|
|
12
|
-
: `${base}/endpoint_security/api/file-patterns/`;
|
|
14
|
+
const fullUrl = `${base}${FILE_PATH_REGISTRY_FILE_PATTERNS_PATH}`.replace(/([^/])\/+/g, '$1/');
|
|
13
15
|
const url = new URL(fullUrl);
|
|
14
16
|
const isHttps = url.protocol === 'https:';
|
|
15
17
|
let hostname = url.hostname;
|
|
@@ -64,9 +66,7 @@ export const getFileCollectionPatterns = async (apiBaseUrl, timeoutMs = 5000) =>
|
|
|
64
66
|
*/
|
|
65
67
|
export const getSensitivePathsAuditCandidates = async (apiBaseUrl, timeoutMs = 5000) => {
|
|
66
68
|
const base = apiBaseUrl.replace(/\/+$/, '');
|
|
67
|
-
const fullUrl = base
|
|
68
|
-
? `${base}/api/sensitive-paths-audit-candidates/`.replace(/([^/])\/+/g, '$1/')
|
|
69
|
-
: `${base}/endpoint_security/api/sensitive-paths-audit-candidates/`;
|
|
69
|
+
const fullUrl = `${base}${FILE_PATH_REGISTRY_SENSITIVE_PATHS_PATH}`.replace(/([^/])\/+/g, '$1/');
|
|
70
70
|
const url = new URL(fullUrl);
|
|
71
71
|
const isHttps = url.protocol === 'https:';
|
|
72
72
|
let hostname = url.hostname;
|
|
@@ -157,6 +157,14 @@ export const postStartupPayload = async (endpointUrl, body, timeoutMs = 5000) =>
|
|
|
157
157
|
res.on('end', () => {
|
|
158
158
|
requestCompleted = true;
|
|
159
159
|
cleanup();
|
|
160
|
+
// Check for HTTP error status codes before parsing
|
|
161
|
+
if (res.statusCode && res.statusCode >= 400) {
|
|
162
|
+
const errorMsg = res.statusCode === 413
|
|
163
|
+
? `413 Request Entity Too Large: ${responseBody.substring(0, 200)}`
|
|
164
|
+
: `HTTP ${res.statusCode} ${res.statusMessage}: ${responseBody.substring(0, 200)}`;
|
|
165
|
+
reject(new Error(errorMsg));
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
160
168
|
if (!responseBody) {
|
|
161
169
|
resolve({ status: 'error', message: 'Empty response from endpoint' });
|
|
162
170
|
return;
|