mirror of
https://github.com/morluto/rea.git
synced 2026-11-16 11:43:20 +00:00
refactor(cli): bind web capture caller paths through the CLI delivery owner (#11322)
WebNetworkCaptureService.inspect took a CLI-only callerPaths argument and bound caller_input_path and caller_input_paths itself, with its own copy of the sensitive-literal filter. deliverCliAnalysisEvidence already binds caller paths for one-shot commands, so the service no longer takes them. The CLI delivery now omits a caller path, or a named caller-path choice, that contains a declared sensitive literal, using the same predicate as bundle receipts. environment-build binds its HAR spelling with finishCliEvidenceCommand.
This commit is contained in:
1 parent
0d35ea065d
commit
5c5c87d0fe
6 files changed
+54
-56
No files matched your search
@@ -10,11 +10,7 @@ import {
|
||||
cancelledBy,
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { createAnalysisProfile } from "../domain/analysisProfile.js";
|
||||
import {
|
||||
createEvidence,
|
||||
withEvidenceCallerInputPath,
|
||||
type Evidence,
|
||||
} from "../domain/evidence.js";
|
||||
import { createEvidence, type Evidence } from "../domain/evidence.js";
|
||||
import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js";
|
||||
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
@@ -43,7 +39,6 @@ export class WebNetworkCaptureService {
|
||||
async inspect(
|
||||
rawInput: unknown,
|
||||
options?: ExecutionOptions,
|
||||
callerPaths?: { readonly capture: string; readonly descriptor?: string },
|
||||
): Promise<Result<Evidence, AnalysisError>> {
|
||||
if (options?.signal?.aborted)
|
||||
return err(cancelledBy(OPERATION, options.signal));
|
||||
@@ -88,11 +83,7 @@ export class WebNetworkCaptureService {
|
||||
);
|
||||
let partialFailure: AnalysisError | undefined;
|
||||
if (partial.success) {
|
||||
const projected = this.#projectCapture(
|
||||
input,
|
||||
partial.data,
|
||||
callerPaths,
|
||||
);
|
||||
const projected = this.#projectCapture(input, partial.data);
|
||||
if (projected.ok) loaded.error.partialObservation = projected.value;
|
||||
else partialFailure = projected.error;
|
||||
} else if (isCapturePartialCandidate(loaded.error.partialObservation)) {
|
||||
@@ -133,7 +124,7 @@ export class WebNetworkCaptureService {
|
||||
"Capture adapter returned malformed historical evidence.",
|
||||
),
|
||||
);
|
||||
const projected = this.#projectCapture(input, report.data, callerPaths);
|
||||
const projected = this.#projectCapture(input, report.data);
|
||||
if (!projected.ok) return failure(projected.error);
|
||||
return completeProviderEvidence(projected.value, options?.signal);
|
||||
}
|
||||
@@ -141,7 +132,6 @@ export class WebNetworkCaptureService {
|
||||
#projectCapture(
|
||||
input: InspectWebNetworkCaptureInput,
|
||||
value: WebNetworkCapture,
|
||||
callerPaths?: { readonly capture: string; readonly descriptor?: string },
|
||||
): Result<Evidence, AnalysisError> {
|
||||
const artifactSha256 = value.artifact.sha256;
|
||||
if (artifactSha256 === null)
|
||||
@@ -294,20 +284,7 @@ export class WebNetworkCaptureService {
|
||||
safePath === "" ? [] : [{ kind: "artifact-path", path: safePath }],
|
||||
},
|
||||
);
|
||||
if (callerPaths === undefined) return ok(evidence);
|
||||
const safeCallerPath = (path: string | undefined) =>
|
||||
path === undefined || isSensitive(path) ? undefined : path;
|
||||
const callerPath = safeCallerPath(callerPaths.capture);
|
||||
const descriptor = safeCallerPath(callerPaths.descriptor);
|
||||
return ok(
|
||||
withEvidenceCallerInputPath(
|
||||
evidence,
|
||||
callerPath,
|
||||
descriptor === undefined
|
||||
? undefined
|
||||
: { descriptor_set_path: descriptor },
|
||||
),
|
||||
);
|
||||
return ok(evidence);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user