log-llm-config 1.3.23 → 1.3.24
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.
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { FILE_PATH_REGISTRY_FILE_PATTERNS_PATH, FILE_PATH_REGISTRY_SENSITIVE_PATHS_PATH, } from './types.js';
|
|
2
|
-
export { getFileCollectionPatterns, getSensitivePathsAuditCandidates } from './registry_api.js';
|
|
2
|
+
export { buildApiUrl, getFileCollectionPatterns, getSensitivePathsAuditCandidates, } from './registry_api.js';
|
|
3
3
|
export { postStartupPayload, patchPayload, classifyEndpointResponse } from './startup_api.js';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import { URL } from 'node:url';
|
|
1
2
|
import { executeGet } from './http_transport.js';
|
|
2
3
|
import { FILE_PATH_REGISTRY_FILE_PATTERNS_PATH, FILE_PATH_REGISTRY_SENSITIVE_PATHS_PATH, } from './types.js';
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
/** Join API base (may include a path prefix, e.g. https://host/optimus/) with an absolute API path. */
|
|
5
|
+
export function buildApiUrl(base, path) {
|
|
6
|
+
const normalizedBase = `${base.replace(/\/+$/, '')}/`;
|
|
7
|
+
const relativePath = path.replace(/^\/+/, '');
|
|
8
|
+
return new URL(relativePath, normalizedBase).href;
|
|
5
9
|
}
|
|
6
10
|
/**
|
|
7
11
|
* GET file collection patterns from the backend (what to look for).
|
|
@@ -10,7 +10,7 @@ import { loadEndpointBase } from '../sender/endpoint_config.js';
|
|
|
10
10
|
import { tryResolveHardwareUuid } from './hardware_uuid.js';
|
|
11
11
|
import { CURSOR_SCALAR_ITEMTABLE_FIELDS, persistVscdbComposerContractFromPatternsResponse, readVscdbItemTableJson, } from '../readers/vscdb_reader.js';
|
|
12
12
|
import { sendConfigFile } from '../sender/batch_sender.js';
|
|
13
|
-
import { getFileCollectionPatterns } from '../../endpoint_client/registry_api.js';
|
|
13
|
+
import { buildApiUrl, getFileCollectionPatterns } from '../../endpoint_client/registry_api.js';
|
|
14
14
|
import { resolveRemediationConfigPath } from './remediation_config_path.js';
|
|
15
15
|
import { resolveSqlite3Binary } from './sqlite_binary.js';
|
|
16
16
|
/** Best-effort detail from execFileSync failures (stderr, exit code, errno). */
|
|
@@ -119,17 +119,9 @@ async function ensureInstructionsForUuids(endpointBase, machineUuid, want, overl
|
|
|
119
119
|
// ---------------------------------------------------------------------------
|
|
120
120
|
// API helpers
|
|
121
121
|
// ---------------------------------------------------------------------------
|
|
122
|
-
function resolveOrigin(endpointBase) {
|
|
123
|
-
try {
|
|
124
|
-
return new URL(endpointBase).origin;
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
return endpointBase.replace(/\/+$/, '');
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
122
|
export async function fetchSync(endpointBase, machineUuid, activeUuids, timeoutMs = 8000) {
|
|
131
123
|
const uuidsParam = activeUuids.join(',');
|
|
132
|
-
const url = `${
|
|
124
|
+
const url = `${buildApiUrl(endpointBase, '/api/findings/remediations/sync/')}?machine_uuid=${encodeURIComponent(machineUuid)}&active_uuids=${encodeURIComponent(uuidsParam)}`;
|
|
133
125
|
const { statusCode, body } = await executeGet(url, timeoutMs);
|
|
134
126
|
if (statusCode !== 200 || !body) {
|
|
135
127
|
const line = `remediation_sync_get: url=${url} status=${statusCode} bytes=${body?.length ?? 0}`;
|
|
@@ -147,7 +139,7 @@ export async function fetchSync(endpointBase, machineUuid, activeUuids, timeoutM
|
|
|
147
139
|
}
|
|
148
140
|
}
|
|
149
141
|
async function fetchManifest(endpointBase, machineUuid, uuids, timeoutMs = 8000) {
|
|
150
|
-
const url = `${
|
|
142
|
+
const url = `${buildApiUrl(endpointBase, '/api/findings/remediations/manifest/')}?machine_uuid=${encodeURIComponent(machineUuid)}&uuids=${encodeURIComponent(uuids.join(','))}`;
|
|
151
143
|
const { statusCode, body } = await executeGet(url, timeoutMs);
|
|
152
144
|
if (statusCode !== 200 || !body) {
|
|
153
145
|
const line = `remediation_manifest_get: url=${url} status=${statusCode} bytes=${body?.length ?? 0}`;
|
|
@@ -1130,7 +1122,7 @@ export function reportAutofixApplied(remediationUuid, result) {
|
|
|
1130
1122
|
return Promise.resolve();
|
|
1131
1123
|
}
|
|
1132
1124
|
const endpointBase = loadEndpointBase();
|
|
1133
|
-
const url =
|
|
1125
|
+
const url = buildApiUrl(endpointBase, '/endpoint_security/api/autofix-applied/');
|
|
1134
1126
|
const payload = { hardware_uuid: hardwareUuid, remediation_uuid: remediationUuid, result };
|
|
1135
1127
|
const signature = createSignature(payload, authKey.key);
|
|
1136
1128
|
const body = JSON.stringify({ ...payload, signature });
|