From 86a154a60c369533d23931221d429e5606ce494b Mon Sep 17 00:00:00 2001 From: prdai Date: Sun, 22 Nov 2026 16:31:22 +0530 Subject: [PATCH 01/13] feat(sce): sign run results with the attested enclave key Co-authored-by: Codex --- README.md | 2 +- docs/e2e-secure-rads.txt | 14 +-- docs/getting-started.md | 21 +++-- secure/result-consumer/README.md | 21 ++++- secure/result-consumer/serverless.yml | 4 + .../result-consumer/src/handlers/consume.ts | 87 +++++++++++++------ secure/result-consumer/src/lib/verify.ts | 80 +++++++++++++++++ secure/sce-unit/README.md | 7 +- secure/sce-unit/attest.go | 30 ++++--- secure/sce-unit/main.go | 36 ++++++-- secure/sce-unit/result.go | 75 ++++++++++++++++ secure/sce/execution-service/README.md | 2 +- secure/sce/execution-service/userdata.sh.tmpl | 22 ++++- secure/verifier-service/README.md | 2 +- secure/verifier-service/serverless.yml | 2 + secure/verifier-service/src/lib/attestFlow.ts | 9 +- .../src/lib/runAttestation.ts | 3 +- 17 files changed, 343 insertions(+), 74 deletions(-) create mode 100644 secure/result-consumer/src/lib/verify.ts create mode 100644 secure/sce-unit/result.go diff --git a/README.md b/README.md index 3afd7842..26943f4e 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Every rads AWS resource is prefixed `rads-`; every secure-rads resource is prefi **Build phase (CSAV).** A Data Controller uploads an OCI image and assigns it an `algorithmId`. registry-service unpacks the image (daemonless: skopeo + umoci), layers the SCE Unit and nsjail on top, and builds a single Nitro Enclave Image File (EIF). It registers the EIF's PCR measurements against that `algorithmId` with the Verifier Service (over mTLS) and stores the EIF in S3, recording `algorithmId -> S3 path` in DynamoDB. -**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave host publishes the result to SQS, a consumer Lambda persists it, and the caller polls `GET /run/{runId}`. +**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and the host forwards it to SQS, a consumer Lambda verifies the signature and persists it, and the caller polls `GET /run/{runId}`. Throughout both phases every component posts timestamped events to the telemetry-service, so a run's full timeline - build to execution - can be exported for benchmarking. The log-service records only the subject-access trail. Components also report selected, attributable AWS operations to the cost-service, keyed by the same `(AlgorithmId, runId)`, so their estimated costs can be summed per AWS service ([`docs/cost-service.md`](docs/cost-service.md)). Event-by-event plaintext flows: [`docs/e2e-rads.txt`](docs/e2e-rads.txt), [`docs/e2e-secure-rads.txt`](docs/e2e-secure-rads.txt). diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 75253731..491d4386 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -55,7 +55,7 @@ Input: 9 RUN-ENCLAVE(EIF) 10 emit enclave-launched // direct, auth none 11 wait for enclave exit -12 publish result to SQS +12 publish signed result to SQS // host forwards the enclave-signed envelope 13 cost sqs:send // message bytes 14 emit executor-finished // direct, auth none 15 cost ec2:instance // captured before the cost POST and terminate request @@ -87,7 +87,7 @@ Input: 20 wait for nsjail exit 21 output ← read /data/result.json 22 emit dc-app-completed // on success, else run-failed -23 STREAM output to parent // vsock :5000 +23 SIGN result and STREAM to parent // signature key registered at attestation, vsock :5000 24 emit output-sent 25 // on failure: emit run-failed @@ -111,7 +111,9 @@ SECURE-RADS-RESULT-CONSUMER(result) Input: result ← processing result returned by the SCE-UNIT 1 SQS delivers result batch; invoke Lambda // receive is billed before the handler runs -2 persist result to DynamoDB -3 cost dynamodb:write-capacity; emit result-persisted -4 cost sqs:receive + lambda:invocation + lambda:compute // reported by handler after processing -5 cost sqs:delete // reported on success; Lambda deletes after return +2 key ← GET-RUN-ATTESTATION(result.runId) // public key verifier recorded at /attest +3 if not VERIFY-SIGNATURE(key, result) then reject +4 persist verified result to DynamoDB +5 cost dynamodb:write-capacity; emit result-persisted +6 cost sqs:receive + lambda:invocation + lambda:compute // reported by handler after processing +7 cost sqs:delete // reported on success; Lambda deletes after return diff --git a/docs/getting-started.md b/docs/getting-started.md index ac3c06e8..02ca574c 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -143,13 +143,7 @@ export SECURE_COST_CERT_ARN= export RADS_COST_CERT_ARN= ``` -Deploy the result consumer first because the execution-service stack needs its queue and table: - -```sh -(cd secure/result-consumer && bun install && bunx serverless deploy --param="region=$REGION") -``` - -Generate the mTLS client certificate, then deploy verifier-service once to create its truststore bucket: +Generate the mTLS client certificate, then deploy verifier-service once to create its truststore bucket and run-attestation table: ```sh make -C secure/csav/registry-service gen-client-cert @@ -159,13 +153,24 @@ make -C secure/csav/registry-service gen-client-cert --param="certificateArn=$VERIFIER_CERT_ARN" \ --param="publicDomainName=verifier-attest.sr.secure-rads.org" \ --param="publicCertificateArn=$VERIFIER_ATTEST_CERT_ARN") +RUN_ATTESTATION_TABLE=$(aws cloudformation describe-stacks --region "$REGION" \ + --stack-name secure-rads-verifier-service-dev \ + --query "Stacks[0].Outputs[?OutputKey=='RunAttestationTableName'].OutputValue" --output text) +``` + +Deploy the result consumer next because it needs the verifier's run-attestation table to verify result signatures, and the execution-service stack needs its queue and table: + +```sh +(cd secure/result-consumer && bun install && bunx serverless deploy \ + --param="region=$REGION" \ + --param="runAttestationTable=$RUN_ATTESTATION_TABLE") ``` Upload the truststore, then deploy verifier-service again with its immutable S3 object version: ```sh TRUSTSTORE_BUCKET=$(aws cloudformation describe-stacks --region "$REGION" \ - --stack-name verifier-service-dev \ + --stack-name secure-rads-verifier-service-dev \ --query "Stacks[0].Outputs[?OutputKey=='TruststoreBucketName'].OutputValue" --output text) TRUSTSTORE_VERSION=$(aws s3api put-object --bucket "$TRUSTSTORE_BUCKET" \ --key truststore.pem --body secure/csav/registry-service/tls/client.crt \ diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index 58cca5db..3d5a91c1 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -4,13 +4,21 @@ Serverless Framework v4, TypeScript. The consumer half of the async run-result f ## Resources -- `RunResultsQueue` - standard SQS queue the enclave host produces JSON run results to. 60s visibility timeout, 14-day retention, redrive to `RunResultsDLQ` after 3 receives. +- `RunResultsQueue` - standard SQS queue the enclave host forwards signed run results to. 60s visibility timeout, 14-day retention, redrive to `RunResultsDLQ` after 3 receives. - `RunResultsDLQ` - dead-letter queue for messages that keep failing. - `RunResultsTable` - PAY_PER_REQUEST DynamoDB table, PK `RunId`. -The `consume` Lambda parses each message `{ runId, instanceId?, algorithmId?, status?, output?, diag? }` and `PutItem`s it (idempotent on `RunId`). A message with no valid `runId` is skipped, not thrown, so it can't block the rest of the batch; it ages out to the DLQ. DynamoDB errors throw so the batch retries. +The enclave signs the result fields with the ephemeral key it registered during attestation. The host only forwards `{ runId, algorithmId, instanceId?, payload, signature }`, where `payload` is base64 of the exact signed JSON bytes. -When `algorithmId` is present it also writes `result-persisted` to telemetry-service over plain HTTPS. It does not emit host or terminal events; the enclave owns those. +For each message the `consume` Lambda: + +1. reads the run's attested public key from `RunAttestationTable`; +2. verifies the signature and checks the signed `runId`/`algorithmId` match the attested run; +3. `PutItem`s the verified fields (idempotent on `RunId`). + +A message with no valid `runId`, no attested key, or an invalid signature is skipped, not thrown, so it can't block the rest of the batch; it ages out to the DLQ. DynamoDB errors throw so the batch retries. + +When the signature verifies it also writes `result-persisted` to telemetry-service over plain HTTPS. It does not emit host or terminal events; the enclave owns those. The stack Outputs (`RunResultsQueueUrl`, `RunResultsQueueArn`, `RunResultsTableName`, `RunResultsTableArn`) are consumed by execution-service. @@ -18,7 +26,12 @@ Bun is used as the local dev/bundle tool only (`bun install`) - the Lambda itsel ## Deploy +Deploy verifier-service first, then pass its run-attestation table name: + ```sh +RUN_ATTESTATION_TABLE=$(aws cloudformation describe-stacks \ + --stack-name secure-rads-verifier-service-dev \ + --query "Stacks[0].Outputs[?OutputKey=='RunAttestationTableName'].OutputValue" --output text) bun install -bunx serverless deploy +bunx serverless deploy --param="runAttestationTable=$RUN_ATTESTATION_TABLE" ``` diff --git a/secure/result-consumer/serverless.yml b/secure/result-consumer/serverless.yml index bdf7a09d..25666f0b 100644 --- a/secure/result-consumer/serverless.yml +++ b/secure/result-consumer/serverless.yml @@ -18,8 +18,12 @@ provider: - Effect: Allow Action: dynamodb:PutItem Resource: !GetAtt RunResultsTable.Arn + - Effect: Allow + Action: dynamodb:GetItem + Resource: !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:runAttestationTable}" environment: RUN_RESULTS_TABLE: !Ref RunResultsTable + RUN_ATTESTATION_TABLE: ${param:runAttestationTable} TELEMETRY_HOST: ${env:TELEMETRY_HOST_SECURE_RADS} COST_HOST: ${env:COST_HOST_SECURE_RADS} diff --git a/secure/result-consumer/src/handlers/consume.ts b/secure/result-consumer/src/handlers/consume.ts index 71d467eb..e9956176 100644 --- a/secure/result-consumer/src/handlers/consume.ts +++ b/secure/result-consumer/src/handlers/consume.ts @@ -1,25 +1,23 @@ import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; -import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb"; +import { DynamoDBDocumentClient, GetCommand, PutCommand } from "@aws-sdk/lib-dynamodb"; import { CostPhase, costEvent, recordLambda } from "@srads/common/cost"; import { requiredEnv } from "@srads/common/env"; import { emitEvent } from "@srads/common/log"; import type { SQSHandler, SQSRecord } from "aws-lambda"; +import { type SignedResultMessage, verifySignedResult } from "../lib/verify.js"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const table = requiredEnv("RUN_RESULTS_TABLE"); +const attestationTable = requiredEnv("RUN_ATTESTATION_TABLE"); -interface RunResultMessage { - runId: string; - instanceId?: string; - algorithmId?: string; - status?: string; - output?: string; - diag?: unknown; +interface AttestedRun { + AlgorithmId?: unknown; + PublicKey?: unknown; } function messageId(record: SQSRecord): { algorithmId: string; runId: string } | undefined { try { - const message = JSON.parse(record.body) as RunResultMessage; + const message = JSON.parse(record.body) as SignedResultMessage; if (typeof message.algorithmId === "string" && typeof message.runId === "string") { return { algorithmId: message.algorithmId, runId: message.runId }; } @@ -32,37 +30,72 @@ function messageId(record: SQSRecord): { algorithmId: string; runId: string } | // Consumes enclave run-result messages off RunResultsQueue and persists them to the RunResults table, // where execution-service's GET /run/{runId} reads them back. The batch's records are handled concurrently. async function persist(record: SQSRecord): Promise { - const message: RunResultMessage = JSON.parse(record.body); + let message: SignedResultMessage; + try { + message = JSON.parse(record.body) as SignedResultMessage; + } catch { + console.error("skipping message with invalid JSON", record.messageId); + return; + } // A malformed message shouldn't poison the batch and block good ones - skip it, let it age to the DLQ. if (typeof message.runId !== "string") { console.error("skipping message with missing/invalid runId", record.messageId); return; } - const item = { - RunId: message.runId, - InstanceId: message.instanceId, - AlgorithmId: message.algorithmId, - Status: message.status, - Output: message.output ?? "", - Diag: message.diag ?? null, - ReceivedAt: new Date().toISOString(), - }; - - // PutItem is idempotent on RunId, so a batch retry on a DynamoDB error is safe. - const write = await ddb.send(new PutCommand({ TableName: table, Item: item, ReturnConsumedCapacity: "TOTAL" })); - - if (message.algorithmId) { + const attestation = await ddb.send( + new GetCommand({ + TableName: attestationTable, + Key: { RunId: message.runId }, + ConsistentRead: true, + ReturnConsumedCapacity: "TOTAL", + }), + ); + if (typeof message.algorithmId === "string") { await costEvent( message.algorithmId, message.runId, CostPhase.Execution, "dynamodb", - "write-capacity", - write.ConsumedCapacity?.CapacityUnits ?? 0, + "read-capacity", + attestation.ConsumedCapacity?.CapacityUnits ?? 0, ); - await emitEvent(message.algorithmId, message.runId, "result-persisted", { status: message.status }); } + + const attested = attestation.Item as AttestedRun | undefined; + if (typeof attested?.AlgorithmId !== "string" || typeof attested.PublicKey !== "string") { + console.error("skipping result with no attested signing key", message.runId); + return; + } + + const result = verifySignedResult(message, attested.AlgorithmId, attested.PublicKey); + if (!result) { + console.error("skipping result with invalid signature", message.runId); + return; + } + + const item = { + RunId: result.runId, + InstanceId: typeof message.instanceId === "string" ? message.instanceId : undefined, + AlgorithmId: result.algorithmId, + Status: result.status, + Output: result.output, + Diag: result.diag, + ReceivedAt: new Date().toISOString(), + }; + + // PutItem is idempotent on RunId, so a batch retry on a DynamoDB error is safe. + const write = await ddb.send(new PutCommand({ TableName: table, Item: item, ReturnConsumedCapacity: "TOTAL" })); + + await costEvent( + result.algorithmId, + result.runId, + CostPhase.Execution, + "dynamodb", + "write-capacity", + write.ConsumedCapacity?.CapacityUnits ?? 0, + ); + await emitEvent(result.algorithmId, result.runId, "result-persisted", { status: result.status }); } export const handler: SQSHandler = async (event) => { diff --git a/secure/result-consumer/src/lib/verify.ts b/secure/result-consumer/src/lib/verify.ts new file mode 100644 index 00000000..0bea0206 --- /dev/null +++ b/secure/result-consumer/src/lib/verify.ts @@ -0,0 +1,80 @@ +import { createPublicKey, verify as verifySignature } from "node:crypto"; + +const SIGNATURE_CONTEXT = "sce-result-v1\n"; + +export interface SignedResultMessage { + runId?: unknown; + algorithmId?: unknown; + instanceId?: unknown; + payload?: unknown; + signature?: unknown; +} + +export interface VerifiedResult { + runId: string; + algorithmId: string; + status: string; + output: string; + diag: unknown; +} + +interface ResultPayload { + runId: string; + algorithmId: string; + status: string; + output: string; + diag?: unknown; +} + +function isResultPayload(value: unknown): value is ResultPayload { + if (typeof value !== "object" || value === null) return false; + const payload = value as Record; + return ( + typeof payload.runId === "string" && + typeof payload.algorithmId === "string" && + typeof payload.status === "string" && + typeof payload.output === "string" + ); +} + +// The enclave signs the exact payload bytes it sent, so verification never depends on JSON re-serialization. +export function verifySignedResult( + message: SignedResultMessage, + attestedAlgorithmId: string, + publicKeyBase64: string, +): VerifiedResult | undefined { + if ( + typeof message.runId !== "string" || + typeof message.payload !== "string" || + typeof message.signature !== "string" + ) { + return undefined; + } + + let payload: unknown; + try { + payload = JSON.parse(Buffer.from(message.payload, "base64").toString("utf8")); + } catch { + return undefined; + } + if (!isResultPayload(payload)) return undefined; + if (payload.runId !== message.runId || payload.algorithmId !== attestedAlgorithmId) return undefined; + + try { + const payloadBytes = Buffer.from(message.payload, "base64"); + const key = createPublicKey({ key: Buffer.from(publicKeyBase64, "base64"), format: "der", type: "spki" }); + const signature = Buffer.from(message.signature, "base64"); + const signedBytes = Buffer.concat([Buffer.from(SIGNATURE_CONTEXT), payloadBytes]); + if (!verifySignature("sha256", signedBytes, { key, dsaEncoding: "der" }, signature)) return undefined; + } catch { + return undefined; + } + + return { + runId: payload.runId, + algorithmId: payload.algorithmId, + status: payload.status, + output: payload.output, + diag: payload.diag ?? null, + }; +} diff --git a/secure/sce-unit/README.md b/secure/sce-unit/README.md index a6245c85..06cc0ccd 100644 --- a/secure/sce-unit/README.md +++ b/secure/sce-unit/README.md @@ -5,9 +5,10 @@ challenge, attests to the Verifier Service with that challenge as the NSM nonce, fetches and decrypts PDM records, writes `records.json` under the DC rootfs `/data` (JSON shape `algorithmId` + `records`, same load path as rads), starts nsjail with -`RECORDS_PATH` / `RESULT_PATH` set, reads the DC app's `result.json`, then streams -that result to the parent instance over vsock (CID 3, port 5000) - the enclave's -only channel out. +`RECORDS_PATH` / `RESULT_PATH` set, reads the DC app's `result.json`, then signs +the result fields with the ephemeral key it registered during attestation and +streams the signed envelope to the parent instance over vsock (CID 3, port 5000) - +the enclave's only channel out. PDM returns a standalone `dataSubjectIds` list aligned with the records. sce-unit keeps those ids in memory, writes `records.json` without them, and after a diff --git a/secure/sce-unit/attest.go b/secure/sce-unit/attest.go index 6e6235ef..b11b123a 100644 --- a/secure/sce-unit/attest.go +++ b/secure/sce-unit/attest.go @@ -6,6 +6,7 @@ import ( "crypto/ecdsa" "crypto/elliptic" "crypto/rand" + "crypto/x509" "encoding/base64" "encoding/json" "fmt" @@ -19,38 +20,41 @@ import ( const attestRequestTimeout = 30 * time.Second -func attest(cfg runConfig, runID string) (tokenPair, error) { +func attest(cfg runConfig, runID string) (tokenPair, *ecdsa.PrivateKey, error) { priv, err := ecdsa.GenerateKey(elliptic.P384(), rand.Reader) if err != nil { - return tokenPair{}, fmt.Errorf("generate ephemeral key: %w", err) + return tokenPair{}, nil, fmt.Errorf("generate ephemeral key: %w", err) + } + pubKey, err := x509.MarshalPKIXPublicKey(&priv.PublicKey) + if err != nil { + return tokenPair{}, nil, fmt.Errorf("marshal ephemeral public key: %w", err) } - pubKey := elliptic.Marshal(elliptic.P384(), priv.PublicKey.X, priv.PublicKey.Y) // The verifier issues the nonce, so the document it receives is bound to this specific /attest request. challenge, err := fetchChallenge(cfg, runID) if err != nil { - return tokenPair{}, fmt.Errorf("request challenge: %w", err) + return tokenPair{}, nil, fmt.Errorf("request challenge: %w", err) } nonce, err := base64.RawURLEncoding.DecodeString(challenge) if err != nil { - return tokenPair{}, fmt.Errorf("decode challenge: %w", err) + return tokenPair{}, nil, fmt.Errorf("decode challenge: %w", err) } sess, err := nsm.OpenDefaultSession() if err != nil { - return tokenPair{}, fmt.Errorf("open NSM session: %w", err) + return tokenPair{}, nil, fmt.Errorf("open NSM session: %w", err) } defer sess.Close() res, err := sess.Send(&request.Attestation{Nonce: nonce, PublicKey: pubKey}) if err != nil { - return tokenPair{}, fmt.Errorf("request attestation document: %w", err) + return tokenPair{}, nil, fmt.Errorf("request attestation document: %w", err) } if res.Error != "" { - return tokenPair{}, fmt.Errorf("NSM: %s", res.Error) + return tokenPair{}, nil, fmt.Errorf("NSM: %s", res.Error) } if res.Attestation == nil || res.Attestation.Document == nil { - return tokenPair{}, fmt.Errorf("NSM returned no attestation document") + return tokenPair{}, nil, fmt.Errorf("NSM returned no attestation document") } body, err := json.Marshal(struct { @@ -65,10 +69,14 @@ func attest(cfg runConfig, runID string) (tokenPair, error) { Challenge: challenge, }) if err != nil { - return tokenPair{}, err + return tokenPair{}, nil, err } - return postForTokens(cfg, "/attest", body) + tokens, err := postForTokens(cfg, "/attest", body) + if err != nil { + return tokenPair{}, nil, err + } + return tokens, priv, nil } // fetchChallenge gets a single-use nonce from verifier-service before the NSM attestation request, so the diff --git a/secure/sce-unit/main.go b/secure/sce-unit/main.go index 1dd91e10..b1d27f55 100644 --- a/secure/sce-unit/main.go +++ b/secure/sce-unit/main.go @@ -82,6 +82,7 @@ func main() { log.Printf("sce-unit: nsjail exited: %v", waitErr) output, readErr := os.ReadFile(resultFileHost) + status := resultStatus(waitErr, readErr, len(output)) failed := waitErr != nil || readErr != nil || len(output) == 0 if failed { @@ -111,8 +112,13 @@ func main() { } else if output[len(output)-1] != '\n' { output = append(output, '\n') } - if err := sendOutput(output); err != nil { - log.Printf("sce-unit: send output to host failed: %v", err) + if err := sendResult(resultPayload{ + RunID: runID, + AlgorithmID: cfg.AlgorithmId, + Status: status, + Output: string(output), + }); err != nil { + log.Printf("sce-unit: send signed result to host failed: %v", err) timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) os.Exit(1) } @@ -122,6 +128,16 @@ func main() { } } +func resultStatus(waitErr, readErr error, outputLen int) string { + if exitErr, ok := waitErr.(*exec.ExitError); ok { + return fmt.Sprintf("exit:%d", exitErr.ExitCode()) + } + if waitErr != nil || readErr != nil || outputLen == 0 { + return "exit:1" + } + return "exit:0" +} + func failRun(timelineLog *sharedlog.Client, algorithmID, runID string, err error) { log.Printf("sce-unit: %v", err) if runID != "" { @@ -130,8 +146,17 @@ func failRun(timelineLog *sharedlog.Client, algorithmID, runID string, err error failure, _ := json.Marshal(struct { Error string `json:"error"` }{Error: err.Error()}) - if err := sendOutput(append(failure, '\n')); err != nil { - log.Printf("sce-unit: send error to host failed: %v", err) + payload := resultPayload{ + RunID: runID, + AlgorithmID: algorithmID, + Status: "exit:1", + Output: string(append(failure, '\n')), + } + if sendErr := sendResult(payload); sendErr != nil { + log.Printf("sce-unit: send signed failure to host failed: %v", sendErr) + if err := sendOutput(append(failure, '\n')); err != nil { + log.Printf("sce-unit: send error to host failed: %v", err) + } } os.Exit(1) } @@ -140,10 +165,11 @@ func failRun(timelineLog *sharedlog.Client, algorithmID, runID string, err error // records.json the DC app loads via RECORDS_PATH. It also returns the data subjects whose records were // handed to the DC app, for the post-completion subject-access trail. func prepareRecordsFile(cfg runConfig, timelineLog *sharedlog.Client, runID string, limit int) ([]string, error) { - tp, err := attest(cfg, runID) + tp, signer, err := attest(cfg, runID) if err != nil { return nil, fmt.Errorf("attestation failed: %w", err) } + setResultSigner(signer) log.Printf("sce-unit: attested successfully, access token expires %s", tp.AccessTokenExpiresAt.Format(time.RFC3339)) setTokens(tp) go refreshLoop(cfg, runID) diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go new file mode 100644 index 00000000..11ef459d --- /dev/null +++ b/secure/sce-unit/result.go @@ -0,0 +1,75 @@ +package main + +import ( + "crypto/ecdsa" + "crypto/rand" + "crypto/sha256" + "encoding/base64" + "encoding/json" + "fmt" + "sync" +) + +const resultSignatureContext = "sce-result-v1\n" + +type resultPayload struct { + RunID string `json:"runId"` + AlgorithmID string `json:"algorithmId"` + Status string `json:"status"` + Output string `json:"output"` + Diag any `json:"diag,omitempty"` +} + +type signedResult struct { + RunID string `json:"runId"` + AlgorithmID string `json:"algorithmId"` + Payload string `json:"payload"` + Signature string `json:"signature"` +} + +var resultSigner struct { + mu sync.RWMutex + key *ecdsa.PrivateKey +} + +func setResultSigner(key *ecdsa.PrivateKey) { + resultSigner.mu.Lock() + defer resultSigner.mu.Unlock() + resultSigner.key = key +} + +func getResultSigner() *ecdsa.PrivateKey { + resultSigner.mu.RLock() + defer resultSigner.mu.RUnlock() + return resultSigner.key +} + +// sendResult signs the enclave-owned result fields and streams the envelope to the host. The host may add +// instanceId, but it cannot change the signed payload or signature without the consumer rejecting it. +func sendResult(p resultPayload) error { + key := getResultSigner() + if key == nil { + return fmt.Errorf("no result signing key: enclave has not attested") + } + + payload, err := json.Marshal(p) + if err != nil { + return fmt.Errorf("marshal result payload: %w", err) + } + digest := sha256.Sum256(append([]byte(resultSignatureContext), payload...)) + signature, err := ecdsa.SignASN1(rand.Reader, key, digest[:]) + if err != nil { + return fmt.Errorf("sign result payload: %w", err) + } + + envelope, err := json.Marshal(signedResult{ + RunID: p.RunID, + AlgorithmID: p.AlgorithmID, + Payload: base64.StdEncoding.EncodeToString(payload), + Signature: base64.StdEncoding.EncodeToString(signature), + }) + if err != nil { + return fmt.Errorf("marshal signed result: %w", err) + } + return sendOutput(envelope) +} diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index df4c6adc..c05e7212 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -2,7 +2,7 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given an `AlgorithmId`, it looks up the EIF in S3 (via registry-service's `AlgorithmTable`), starts a Nitro-Enclave-capable EC2 instance, and returns immediately. The per-run EC2 instance remains necessary as the Nitro Enclave parent; the service itself has no persistent EC2 host. -`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. The enclave host sends its result (exit status plus what the DC app returned over vsock) to the run-results SQS queue when it finishes; a consumer Lambda (result-consumer) writes it to the RunResults table. +`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. The enclave signs the run result (run id, algorithm id, status, and output) with its attested ephemeral key and streams the signed envelope to the host over vsock. The host forwards that envelope to the run-results SQS queue unchanged apart from adding its instance id; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. `GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result once the consumer has written it. `algorithmId` is required so every poll can be attributed to its run. diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index c56b3a9f..a39c690f 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -32,10 +32,24 @@ def read(path): except FileNotFoundError: return "" out = read("/tmp/output.txt") -# When the DC app produced no output, surface the enclave launch log so an empty result is diagnosable -# instead of silent (the enclave console is otherwise lost when the host terminates). -diag = {"runEnclave": read("/tmp/run-enclave.log")} if not out else {} -print(json.dumps({"runId": "{{.RunId}}", "algorithmId": "{{.AlgorithmId}}", "instanceId": sys.argv[2], "status": "exit:" + sys.argv[1], "output": out, "diag": diag})) +# The enclave signs the result fields; this host only forwards the envelope plus its instance id. +# Anything the host builds itself has no signature and result-consumer rejects it. +try: + message = json.loads(out) +except json.JSONDecodeError: + message = None +if isinstance(message, dict) and isinstance(message.get("payload"), str) and isinstance(message.get("signature"), str): + message["instanceId"] = sys.argv[2] +else: + message = { + "runId": "{{.RunId}}", + "algorithmId": "{{.AlgorithmId}}", + "instanceId": sys.argv[2], + "status": "exit:" + sys.argv[1], + "output": out, + "diag": {"runEnclave": read("/tmp/run-enclave.log")}, + } +print(json.dumps(message)) PYEOF aws sqs send-message --queue-url "{{.QueueUrl}}" --message-body file:///tmp/result.json --region "$REGION" || true emit_event executor-finished diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index 7bcf2458..a3c7a19a 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -6,7 +6,7 @@ Serverless Framework v4, TypeScript. Receives `AlgorithmId` + PCR values from re - `POST /algorithms` (mTLS domain) - registry-service registers `AlgorithmId` -> PCR0/1/2 at build time. - `POST /challenge` (public domain) - sce-unit asks for a single-use nonce before attesting. The row is stored hashed in `AttestationChallengeTable` with a 60 s TTL and is bound to the `algorithmId` and `runId` in the request. -- `POST /attest` (public domain) - sce-unit submits a real Nitro attestation document (base64 COSE_Sign1 bytes) + `algorithmId` + `runId` + the `challenge` it was issued. The document's `nonce` must equal the challenge, and the challenge is consumed atomically before the PCR check, so a captured document cannot be replayed. After the PCR check, the run is claimed in `RunAttestationTable` with a conditional put, so only the first attestation for a `runId` succeeds; later ones get 409. Verified against the pinned AWS Nitro root cert chain and the registered PCRs; on success, issues a signed access JWT + opaque refresh token (persisted in `AttestationSessionTable`, including `RunId`). +- `POST /attest` (public domain) - sce-unit submits a real Nitro attestation document (base64 COSE_Sign1 bytes) + `algorithmId` + `runId` + the `challenge` it was issued. The document's `nonce` must equal the challenge, and the challenge is consumed atomically before the PCR check, so a captured document cannot be replayed. After the PCR check, the run is claimed in `RunAttestationTable` with a conditional put, so only the first attestation for a `runId` succeeds; later ones get 409. The attestation document's `public_key` is stored on the `RunAttestationTable` row with `AlgorithmId`; result-consumer uses it to verify signed run results. Verified against the pinned AWS Nitro root cert chain and the registered PCRs; on success, issues a signed access JWT + opaque refresh token (persisted in `AttestationSessionTable`, including `RunId`). - `POST /refresh` (public domain) - exchanges a still-valid refresh token plus its `runId` for a new access JWT, without requiring a fresh attestation document. The `runId` must match the one stored on the session. - `GET /.well-known/jwks.json` (public domain) - the ML-DSA-87 public key downstream services use to verify access JWTs locally. Public by definition, no auth. diff --git a/secure/verifier-service/serverless.yml b/secure/verifier-service/serverless.yml index 8fb37967..d731c2cd 100644 --- a/secure/verifier-service/serverless.yml +++ b/secure/verifier-service/serverless.yml @@ -302,6 +302,8 @@ resources: Value: !Ref AttestationSessionTable AttestationChallengeTableName: Value: !Ref AttestationChallengeTable + RunAttestationTableName: + Value: !Ref RunAttestationTable TruststoreBucketName: Value: !Ref TruststoreBucket ApiRegionalDomainName: diff --git a/secure/verifier-service/src/lib/attestFlow.ts b/secure/verifier-service/src/lib/attestFlow.ts index bbb97d9f..5923f22a 100644 --- a/secure/verifier-service/src/lib/attestFlow.ts +++ b/secure/verifier-service/src/lib/attestFlow.ts @@ -18,7 +18,7 @@ export interface AttestDeps { registered: RegisteredPcrs; verifyDocument(raw: Buffer): AttestationDocument; consumeChallenge(challenge: string, algorithmId: string, runId: string): Promise; - claimRunAttestation(algorithmId: string, runId: string): Promise; + claimRunAttestation(algorithmId: string, runId: string, publicKey: Buffer): Promise; issueTokens(algorithmId: string, runId: string): Promise; } @@ -44,6 +44,11 @@ export async function attestRequest(body: AttestBody, deps: AttestDeps): Promise return { statusCode: 401, body: `attestation verification failed: ${(err as Error).message}` }; } + // The public key is what result-consumer later verifies signed run results against. + if (!doc.publicKey || doc.publicKey.length === 0) { + return { statusCode: 401, body: "attestation document is missing a public key" }; + } + const challenge = decodeChallenge(body.challenge); if (!challenge || !doc.nonce || doc.nonce.length !== challenge.length || !timingSafeEqual(doc.nonce, challenge)) { return { @@ -64,7 +69,7 @@ export async function attestRequest(body: AttestBody, deps: AttestDeps): Promise } // A run attests once. Claiming after the measurement check keeps a wrong-image request from burning a run. - if (!(await deps.claimRunAttestation(body.algorithmId, body.runId))) { + if (!(await deps.claimRunAttestation(body.algorithmId, body.runId, doc.publicKey))) { return { statusCode: 409, body: "run already attested" }; } diff --git a/secure/verifier-service/src/lib/runAttestation.ts b/secure/verifier-service/src/lib/runAttestation.ts index bd3a8324..be033185 100644 --- a/secure/verifier-service/src/lib/runAttestation.ts +++ b/secure/verifier-service/src/lib/runAttestation.ts @@ -6,7 +6,7 @@ import { requiredEnv } from "@srads/common/env"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const tableName = requiredEnv("RUN_ATTESTATION_TABLE"); -export async function claimRunAttestation(algorithmId: string, runId: string): Promise { +export async function claimRunAttestation(algorithmId: string, runId: string, publicKey: Buffer): Promise { try { const write = await ddb.send( new PutCommand({ @@ -15,6 +15,7 @@ export async function claimRunAttestation(algorithmId: string, runId: string): P RunId: runId, AlgorithmId: algorithmId, AttestedAt: new Date().toISOString(), + PublicKey: publicKey.toString("base64"), }, ConditionExpression: "attribute_not_exists(RunId)", ReturnConsumedCapacity: "TOTAL", From ba15e227a3f92969916179475b8e60dc7c94b0fd Mon Sep 17 00:00:00 2001 From: prdai Date: Sun, 22 Nov 2026 18:02:04 +0530 Subject: [PATCH 02/13] feat(verifier): expose run attestation for result verification Co-authored-by: Codex --- docs/e2e-secure-rads.txt | 2 +- docs/getting-started.md | 9 +--- packages/common/package.json | 4 ++ secure/result-consumer/README.md | 11 ++--- secure/result-consumer/serverless.yml | 6 +-- .../result-consumer/src/handlers/consume.ts | 38 +++----------- secure/result-consumer/src/lib/attestation.ts | 47 ++++++++++++++++++ secure/verifier-service/README.md | 1 + secure/verifier-service/serverless.yml | 31 +++++++++++- .../src/handlers/runAttestation.ts | 49 +++++++++++++++++++ 10 files changed, 148 insertions(+), 50 deletions(-) create mode 100644 secure/result-consumer/src/lib/attestation.ts create mode 100644 secure/verifier-service/src/handlers/runAttestation.ts diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 491d4386..e61c0b50 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -111,7 +111,7 @@ SECURE-RADS-RESULT-CONSUMER(result) Input: result ← processing result returned by the SCE-UNIT 1 SQS delivers result batch; invoke Lambda // receive is billed before the handler runs -2 key ← GET-RUN-ATTESTATION(result.runId) // public key verifier recorded at /attest +2 key ← GET-VERIFIER-RUN-ATTESTATION(result.runId) // verifier GET /runs/{runId} 3 if not VERIFY-SIGNATURE(key, result) then reject 4 persist verified result to DynamoDB 5 cost dynamodb:write-capacity; emit result-persisted diff --git a/docs/getting-started.md b/docs/getting-started.md index 02ca574c..8a195470 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -153,17 +153,12 @@ make -C secure/csav/registry-service gen-client-cert --param="certificateArn=$VERIFIER_CERT_ARN" \ --param="publicDomainName=verifier-attest.sr.secure-rads.org" \ --param="publicCertificateArn=$VERIFIER_ATTEST_CERT_ARN") -RUN_ATTESTATION_TABLE=$(aws cloudformation describe-stacks --region "$REGION" \ - --stack-name secure-rads-verifier-service-dev \ - --query "Stacks[0].Outputs[?OutputKey=='RunAttestationTableName'].OutputValue" --output text) ``` -Deploy the result consumer next because it needs the verifier's run-attestation table to verify result signatures, and the execution-service stack needs its queue and table: +Deploy the result consumer next because the execution-service stack needs its queue and table. It calls verifier-service's `/runs/{runId}` at runtime, so verifier-service must be deployed first: ```sh -(cd secure/result-consumer && bun install && bunx serverless deploy \ - --param="region=$REGION" \ - --param="runAttestationTable=$RUN_ATTESTATION_TABLE") +(cd secure/result-consumer && bun install && bunx serverless deploy --param="region=$REGION") ``` Upload the truststore, then deploy verifier-service again with its immutable S3 object version: diff --git a/packages/common/package.json b/packages/common/package.json index 556e362a..2844507c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,6 +19,10 @@ "./jwt": { "types": "./src/jwt.ts", "import": "./src/jwt.ts" + }, + "./tls": { + "types": "./src/tls.ts", + "import": "./src/tls.ts" } }, "scripts": { diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index 3d5a91c1..dcc460b1 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -12,8 +12,8 @@ The enclave signs the result fields with the ephemeral key it registered during For each message the `consume` Lambda: -1. reads the run's attested public key from `RunAttestationTable`; -2. verifies the signature and checks the signed `runId`/`algorithmId` match the attested run; +1. fetches the run's attestation from verifier-service `GET /runs/{runId}`, pinned to the verifier leaf SPKI; +2. checks the returned `runId` matches the message, then verifies the signature and signed `algorithmId`; 3. `PutItem`s the verified fields (idempotent on `RunId`). A message with no valid `runId`, no attested key, or an invalid signature is skipped, not thrown, so it can't block the rest of the batch; it ages out to the DLQ. DynamoDB errors throw so the batch retries. @@ -26,12 +26,9 @@ Bun is used as the local dev/bundle tool only (`bun install`) - the Lambda itsel ## Deploy -Deploy verifier-service first, then pass its run-attestation table name: +Deploy verifier-service first so `GET /runs/{runId}` exists, then set the usual environment: ```sh -RUN_ATTESTATION_TABLE=$(aws cloudformation describe-stacks \ - --stack-name secure-rads-verifier-service-dev \ - --query "Stacks[0].Outputs[?OutputKey=='RunAttestationTableName'].OutputValue" --output text) bun install -bunx serverless deploy --param="runAttestationTable=$RUN_ATTESTATION_TABLE" +bunx serverless deploy ``` diff --git a/secure/result-consumer/serverless.yml b/secure/result-consumer/serverless.yml index 25666f0b..15c4e43c 100644 --- a/secure/result-consumer/serverless.yml +++ b/secure/result-consumer/serverless.yml @@ -18,12 +18,10 @@ provider: - Effect: Allow Action: dynamodb:PutItem Resource: !GetAtt RunResultsTable.Arn - - Effect: Allow - Action: dynamodb:GetItem - Resource: !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:runAttestationTable}" environment: RUN_RESULTS_TABLE: !Ref RunResultsTable - RUN_ATTESTATION_TABLE: ${param:runAttestationTable} + VERIFIER_ATTEST_HOST: ${env:VERIFIER_ATTEST_HOST} + VERIFIER_ATTEST_PUBKEY_SHA256: ${env:VERIFIER_PUBKEY_SHA256} TELEMETRY_HOST: ${env:TELEMETRY_HOST_SECURE_RADS} COST_HOST: ${env:COST_HOST_SECURE_RADS} diff --git a/secure/result-consumer/src/handlers/consume.ts b/secure/result-consumer/src/handlers/consume.ts index e9956176..f92750eb 100644 --- a/secure/result-consumer/src/handlers/consume.ts +++ b/secure/result-consumer/src/handlers/consume.ts @@ -1,19 +1,16 @@ import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; -import { DynamoDBDocumentClient, GetCommand, PutCommand } from "@aws-sdk/lib-dynamodb"; +import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb"; import { CostPhase, costEvent, recordLambda } from "@srads/common/cost"; import { requiredEnv } from "@srads/common/env"; import { emitEvent } from "@srads/common/log"; import type { SQSHandler, SQSRecord } from "aws-lambda"; +import { fetchRunAttestation } from "../lib/attestation.js"; import { type SignedResultMessage, verifySignedResult } from "../lib/verify.js"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const table = requiredEnv("RUN_RESULTS_TABLE"); -const attestationTable = requiredEnv("RUN_ATTESTATION_TABLE"); - -interface AttestedRun { - AlgorithmId?: unknown; - PublicKey?: unknown; -} +const verifierAttestHost = requiredEnv("VERIFIER_ATTEST_HOST"); +const verifierAttestPin = requiredEnv("VERIFIER_ATTEST_PUBKEY_SHA256"); function messageId(record: SQSRecord): { algorithmId: string; runId: string } | undefined { try { @@ -43,32 +40,13 @@ async function persist(record: SQSRecord): Promise { return; } - const attestation = await ddb.send( - new GetCommand({ - TableName: attestationTable, - Key: { RunId: message.runId }, - ConsistentRead: true, - ReturnConsumedCapacity: "TOTAL", - }), - ); - if (typeof message.algorithmId === "string") { - await costEvent( - message.algorithmId, - message.runId, - CostPhase.Execution, - "dynamodb", - "read-capacity", - attestation.ConsumedCapacity?.CapacityUnits ?? 0, - ); - } - - const attested = attestation.Item as AttestedRun | undefined; - if (typeof attested?.AlgorithmId !== "string" || typeof attested.PublicKey !== "string") { - console.error("skipping result with no attested signing key", message.runId); + const attested = await fetchRunAttestation(verifierAttestHost, verifierAttestPin, message.runId); + if (!attested || attested.runId !== message.runId) { + console.error("skipping result with no matching run attestation", message.runId); return; } - const result = verifySignedResult(message, attested.AlgorithmId, attested.PublicKey); + const result = verifySignedResult(message, attested.algorithmId, attested.publicKey); if (!result) { console.error("skipping result with invalid signature", message.runId); return; diff --git a/secure/result-consumer/src/lib/attestation.ts b/secure/result-consumer/src/lib/attestation.ts new file mode 100644 index 00000000..aba57218 --- /dev/null +++ b/secure/result-consumer/src/lib/attestation.ts @@ -0,0 +1,47 @@ +import https from "node:https"; +import { pinnedServerIdentity } from "@srads/common/tls"; + +export interface RunAttestation { + runId: string; + algorithmId: string; + publicKey: string; +} + +// Fetches the key verifier-service bound to this run during attestation. The response is pinned to the +// verifier leaf SPKI, the same way downstream services pin the JWKS endpoint. +export function fetchRunAttestation( + host: string, + pinSha256: string, + runId: string, +): Promise { + const checkServerIdentity = pinnedServerIdentity(pinSha256, "verifier attestation server"); + const url = new URL(`https://${host}/runs/${encodeURIComponent(runId)}`); + + return new Promise((resolve, reject) => { + https + .get(url, { rejectUnauthorized: true, checkServerIdentity }, async (res) => { + try { + const chunks: Buffer[] = []; + for await (const chunk of res) chunks.push(chunk as Buffer); + if (res.statusCode === 404) { + resolve(undefined); + return; + } + if (res.statusCode !== 200) throw new Error(`run attestation fetch returned ${res.statusCode}`); + + const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record; + if ( + typeof parsed.runId !== "string" || + typeof parsed.algorithmId !== "string" || + typeof parsed.publicKey !== "string" + ) { + throw new Error("unexpected run attestation response shape"); + } + resolve({ runId: parsed.runId, algorithmId: parsed.algorithmId, publicKey: parsed.publicKey }); + } catch (err) { + reject(err); + } + }) + .on("error", reject); + }); +} diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index a3c7a19a..1b4d338e 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -8,6 +8,7 @@ Serverless Framework v4, TypeScript. Receives `AlgorithmId` + PCR values from re - `POST /challenge` (public domain) - sce-unit asks for a single-use nonce before attesting. The row is stored hashed in `AttestationChallengeTable` with a 60 s TTL and is bound to the `algorithmId` and `runId` in the request. - `POST /attest` (public domain) - sce-unit submits a real Nitro attestation document (base64 COSE_Sign1 bytes) + `algorithmId` + `runId` + the `challenge` it was issued. The document's `nonce` must equal the challenge, and the challenge is consumed atomically before the PCR check, so a captured document cannot be replayed. After the PCR check, the run is claimed in `RunAttestationTable` with a conditional put, so only the first attestation for a `runId` succeeds; later ones get 409. The attestation document's `public_key` is stored on the `RunAttestationTable` row with `AlgorithmId`; result-consumer uses it to verify signed run results. Verified against the pinned AWS Nitro root cert chain and the registered PCRs; on success, issues a signed access JWT + opaque refresh token (persisted in `AttestationSessionTable`, including `RunId`). - `POST /refresh` (public domain) - exchanges a still-valid refresh token plus its `runId` for a new access JWT, without requiring a fresh attestation document. The `runId` must match the one stored on the session. +- `GET /runs/{runId}` (public domain) - returns `{runId, algorithmId, publicKey}` for a run that has attested. result-consumer uses it to verify the enclave's result signature. Public keys are public, so no auth. - `GET /.well-known/jwks.json` (public domain) - the ML-DSA-87 public key downstream services use to verify access JWTs locally. Public by definition, no auth. ### Access token format (ML-DSA-87 compact JWS) diff --git a/secure/verifier-service/serverless.yml b/secure/verifier-service/serverless.yml index d731c2cd..fa86fc0b 100644 --- a/secure/verifier-service/serverless.yml +++ b/secure/verifier-service/serverless.yml @@ -38,7 +38,9 @@ provider: - dynamodb:UpdateItem Resource: !GetAtt AttestationChallengeTable.Arn - Effect: Allow - Action: dynamodb:PutItem + Action: + - dynamodb:PutItem + - dynamodb:GetItem Resource: !GetAtt RunAttestationTable.Arn - Effect: Allow Action: ssm:GetParameter @@ -74,6 +76,10 @@ functions: jwks: handler: src/handlers/jwks.handler + # result-consumer reads the public key recorded for one run. + runAttestation: + handler: src/handlers/runAttestation.handler + resources: Conditions: HasTruststoreVersion: @@ -281,6 +287,29 @@ resources: Principal: apigateway.amazonaws.com SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${PublicHttpApi}/*/*/*" + RunAttestationIntegration: + Type: AWS::ApiGatewayV2::Integration + Properties: + ApiId: !Ref PublicHttpApi + IntegrationType: AWS_PROXY + IntegrationUri: !GetAtt RunAttestationLambdaFunction.Arn + PayloadFormatVersion: "2.0" + + RunAttestationRoute: + Type: AWS::ApiGatewayV2::Route + Properties: + ApiId: !Ref PublicHttpApi + RouteKey: "GET /runs/{runId}" + Target: !Sub "integrations/${RunAttestationIntegration}" + + RunAttestationInvokePermission: + Type: AWS::Lambda::Permission + Properties: + FunctionName: !Ref RunAttestationLambdaFunction + Action: lambda:InvokeFunction + Principal: apigateway.amazonaws.com + SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${PublicHttpApi}/*/*/*" + PublicApiCustomDomain: Type: AWS::ApiGatewayV2::DomainName Properties: diff --git a/secure/verifier-service/src/handlers/runAttestation.ts b/secure/verifier-service/src/handlers/runAttestation.ts new file mode 100644 index 00000000..ed59f27b --- /dev/null +++ b/secure/verifier-service/src/handlers/runAttestation.ts @@ -0,0 +1,49 @@ +import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; +import { DynamoDBDocumentClient, GetCommand } from "@aws-sdk/lib-dynamodb"; +import { CostPhase, costEvent, recordRequest } from "@srads/common/cost"; +import { requiredEnv } from "@srads/common/env"; +import type { APIGatewayProxyHandlerV2 } from "aws-lambda"; + +const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); +const tableName = requiredEnv("RUN_ATTESTATION_TABLE"); + +interface AttestedRun { + AlgorithmId?: unknown; + PublicKey?: unknown; +} + +// result-consumer fetches this by run id to verify the enclave's result signature against the key that was +// bound to the run during attestation. Public keys are public, so this needs no auth. +export const handler: APIGatewayProxyHandlerV2 = async (event) => { + const startedAt = process.hrtime.bigint(); + const runId = event.pathParameters?.runId; + if (!runId) return { statusCode: 400, body: "runId is required" }; + + const response = await ddb.send( + new GetCommand({ + TableName: tableName, + Key: { RunId: runId }, + ConsistentRead: true, + ReturnConsumedCapacity: "TOTAL", + }), + ); + const item = response.Item as AttestedRun | undefined; + if (typeof item?.AlgorithmId !== "string" || typeof item.PublicKey !== "string") { + return { statusCode: 404, body: "run has not attested" }; + } + + await costEvent( + item.AlgorithmId, + runId, + CostPhase.Execution, + "dynamodb", + "read-capacity", + response.ConsumedCapacity?.CapacityUnits ?? 0, + ); + await recordRequest(item.AlgorithmId, runId, CostPhase.Execution, startedAt); + return { + statusCode: 200, + headers: { "content-type": "application/json" }, + body: JSON.stringify({ runId, algorithmId: item.AlgorithmId, publicKey: item.PublicKey }), + }; +}; From ea00b9293d68a7e280655b90c23b137ff4b36c98 Mon Sep 17 00:00:00 2001 From: prdai Date: Mon, 23 Nov 2026 11:55:22 +0530 Subject: [PATCH 03/13] feat(sce-unit): send signed results to SQS from the enclave Co-authored-by: Codex --- README.md | 2 +- docs/e2e-secure-rads.txt | 18 +-- secure/result-consumer/README.md | 4 +- secure/sce-unit/README.md | 5 +- secure/sce-unit/creds.go | 41 +++++++ secure/sce-unit/go.mod | 12 ++ secure/sce-unit/go.sum | 35 ++++++ secure/sce-unit/main.go | 63 +++-------- secure/sce-unit/result.go | 6 +- secure/sce-unit/runinfo.go | 15 ++- secure/sce-unit/sqs.go | 83 ++++++++++++++ secure/sce/execution-service/README.md | 2 +- secure/sce/execution-service/userdata.sh.tmpl | 105 ++++++++---------- 13 files changed, 266 insertions(+), 125 deletions(-) create mode 100644 secure/sce-unit/creds.go create mode 100644 secure/sce-unit/sqs.go diff --git a/README.md b/README.md index 26943f4e..e7ced987 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Every rads AWS resource is prefixed `rads-`; every secure-rads resource is prefi **Build phase (CSAV).** A Data Controller uploads an OCI image and assigns it an `algorithmId`. registry-service unpacks the image (daemonless: skopeo + umoci), layers the SCE Unit and nsjail on top, and builds a single Nitro Enclave Image File (EIF). It registers the EIF's PCR measurements against that `algorithmId` with the Verifier Service (over mTLS) and stores the EIF in S3, recording `algorithmId -> S3 path` in DynamoDB. -**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and the host forwards it to SQS, a consumer Lambda verifies the signature and persists it, and the caller polls `GET /run/{runId}`. +**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and sends it to SQS itself, a consumer Lambda verifies the signature and persists it, and the caller polls `GET /run/{runId}`. Throughout both phases every component posts timestamped events to the telemetry-service, so a run's full timeline - build to execution - can be exported for benchmarking. The log-service records only the subject-access trail. Components also report selected, attributable AWS operations to the cost-service, keyed by the same `(AlgorithmId, runId)`, so their estimated costs can be summed per AWS service ([`docs/cost-service.md`](docs/cost-service.md)). Event-by-event plaintext flows: [`docs/e2e-rads.txt`](docs/e2e-rads.txt), [`docs/e2e-secure-rads.txt`](docs/e2e-secure-rads.txt). diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index e61c0b50..163db1d4 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -50,16 +50,14 @@ Input: 4 cost s3:get // EIF pull 5 EIF ← GET-S3(key) 6 emit artifact-retrieved // direct, auth none -7 start vsock listeners // output :5000, runInfo :5001 +7 start vsock listeners // runInfo :5001, creds :5002 8 configure vsock-proxy 9 RUN-ENCLAVE(EIF) 10 emit enclave-launched // direct, auth none 11 wait for enclave exit -12 publish signed result to SQS // host forwards the enclave-signed envelope -13 cost sqs:send // message bytes -14 emit executor-finished // direct, auth none -15 cost ec2:instance // captured before the cost POST and terminate request -16 terminate instance +12 emit executor-finished // direct, auth none +13 cost ec2:instance // captured before the cost POST and terminate request +14 terminate instance SCE-UNIT(a) @@ -87,9 +85,11 @@ Input: 20 wait for nsjail exit 21 output ← read /data/result.json 22 emit dc-app-completed // on success, else run-failed -23 SIGN result and STREAM to parent // signature key registered at attestation, vsock :5000 -24 emit output-sent -25 // on failure: emit run-failed +23 SIGN result // signature key registered at attestation +24 SEND signed envelope to SQS // host-role credentials over vsock :5002, TLS to SQS +25 cost sqs:send +26 emit output-sent +27 // on failure: emit run-failed diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index dcc460b1..d3ef4299 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -4,11 +4,11 @@ Serverless Framework v4, TypeScript. The consumer half of the async run-result f ## Resources -- `RunResultsQueue` - standard SQS queue the enclave host forwards signed run results to. 60s visibility timeout, 14-day retention, redrive to `RunResultsDLQ` after 3 receives. +- `RunResultsQueue` - standard SQS queue sce-unit sends signed run results to. 60s visibility timeout, 14-day retention, redrive to `RunResultsDLQ` after 3 receives. - `RunResultsDLQ` - dead-letter queue for messages that keep failing. - `RunResultsTable` - PAY_PER_REQUEST DynamoDB table, PK `RunId`. -The enclave signs the result fields with the ephemeral key it registered during attestation. The host only forwards `{ runId, algorithmId, instanceId?, payload, signature }`, where `payload` is base64 of the exact signed JSON bytes. +The enclave signs the result fields with the ephemeral key it registered during attestation and sends `{ runId, algorithmId, instanceId?, payload, signature }` itself, where `payload` is base64 of the exact signed JSON bytes. For each message the `consume` Lambda: diff --git a/secure/sce-unit/README.md b/secure/sce-unit/README.md index 06cc0ccd..11d234ce 100644 --- a/secure/sce-unit/README.md +++ b/secure/sce-unit/README.md @@ -7,8 +7,9 @@ PDM records, writes `records.json` under the DC rootfs `/data` (JSON shape `algorithmId` + `records`, same load path as rads), starts nsjail with `RECORDS_PATH` / `RESULT_PATH` set, reads the DC app's `result.json`, then signs the result fields with the ephemeral key it registered during attestation and -streams the signed envelope to the parent instance over vsock (CID 3, port 5000) - -the enclave's only channel out. +sends the signed envelope to the run-results SQS queue. SQS access uses +credentials the parent serves over vsock (port 5002); the signature, not the +credential split, is what keeps a compromised host from forging a result. PDM returns a standalone `dataSubjectIds` list aligned with the records. sce-unit keeps those ids in memory, writes `records.json` without them, and after a diff --git a/secure/sce-unit/creds.go b/secure/sce-unit/creds.go new file mode 100644 index 00000000..567d63cf --- /dev/null +++ b/secure/sce-unit/creds.go @@ -0,0 +1,41 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "time" + + "github.com/mdlayher/vsock" +) + +// The enclave has no IMDS and no user-data, so its AWS credentials come from the parent host, which serves +// fresh IMDSv2 role credentials over vsock (port 5002, see userdata.sh.tmpl). The host holds the same role, +// so this gives the enclave no capability the host lacks - it only lets sce-unit send the result itself. +const hostCredsPort = 5002 + +type awsCreds struct { + AccessKeyID string `json:"accessKeyId"` + SecretAccessKey string `json:"secretAccessKey"` + SessionToken string `json:"sessionToken"` +} + +func fetchAWSCreds() (awsCreds, error) { + conn, err := vsock.Dial(hostCID, hostCredsPort, nil) + if err != nil { + return awsCreds{}, fmt.Errorf("dial host creds vsock: %w", err) + } + defer conn.Close() + if err := conn.SetDeadline(time.Now().Add(10 * time.Second)); err != nil { + return awsCreds{}, err + } + data, err := io.ReadAll(io.LimitReader(conn, 1<<16)) + if err != nil { + return awsCreds{}, fmt.Errorf("read host creds: %w", err) + } + var creds awsCreds + if err := json.Unmarshal(data, &creds); err != nil { + return awsCreds{}, fmt.Errorf("parse host creds: %w", err) + } + return creds, nil +} diff --git a/secure/sce-unit/go.mod b/secure/sce-unit/go.mod index 81120465..6e826646 100644 --- a/secure/sce-unit/go.mod +++ b/secure/sce-unit/go.mod @@ -4,6 +4,10 @@ go 1.25.0 require ( github.com/Secure-RADS/st-dp/packages/go-common v0.0.0 + github.com/aws/aws-sdk-go-v2 v1.16.11 + github.com/aws/aws-sdk-go-v2/config v1.17.0 + github.com/aws/aws-sdk-go-v2/credentials v1.12.13 + github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0 github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0 github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9 github.com/mdlayher/vsock v1.3.0 @@ -13,6 +17,14 @@ require ( replace github.com/Secure-RADS/st-dp/packages/go-common => ../../packages/go-common require ( + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 // indirect + github.com/aws/smithy-go v1.12.1 // indirect github.com/fxamacker/cbor/v2 v2.4.0 // indirect github.com/mdlayher/socket v0.6.0 // indirect github.com/x448/float16 v0.8.4 // indirect diff --git a/secure/sce-unit/go.sum b/secure/sce-unit/go.sum index 602b5df0..080ab789 100644 --- a/secure/sce-unit/go.sum +++ b/secure/sce-unit/go.sum @@ -1,3 +1,32 @@ +github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw= +github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ= +github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo= +github.com/aws/aws-sdk-go-v2/config v1.17.0 h1:e0tIuubcjp0gJQdllgEMwolWWXGK/sKAFd1tS5S6m6I= +github.com/aws/aws-sdk-go-v2/config v1.17.0/go.mod h1:4SKzBMiB8lV0fw2w7eDBo/LjQyHFITN4vUUuqpurFmI= +github.com/aws/aws-sdk-go-v2/credentials v1.12.13 h1:cuPzIsjKAWBUAAk8ZUR2l02Sxafl9hiaMsc7tlnjwAY= +github.com/aws/aws-sdk-go-v2/credentials v1.12.13/go.mod h1:9fDEemXizwXrxPU1MTzv69LP/9D8HVl5qHAQO9A9ikY= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ= +github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= +github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0 h1:DIfxowLm7VUMqipBd/3y7EGiQTHeAiHelFHEhkRIS+E= +github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0/go.mod h1:p2Kn1XCPZLA5Z+dE859RGRCuP3TUC3pTgU7j1bcj5bY= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 h1:YK8L7TNlGwMWHYqLs+i6dlITpxqzq08FqQUy26nm+T8= +github.com/aws/aws-sdk-go-v2/service/sso v1.11.16/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII= +github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= +github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= +github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0 h1:PkHLQAsU3gMDb5Q+3KJeSPOKXFgNNcn0y+/jBYg1cQg= @@ -5,16 +34,20 @@ github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0/go.mod h1:hDAX5hYfgVR/TzewAODj github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= +github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9 h1:pU32bJGmZwF4WXb9Yaz0T8vHDtIPVxqDOdmYdwTQPqw= github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9/go.mod h1:MJsac5D0fKcNWfriUERtln6segcGfD6Nu0V5uGBbPf8= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/mdlayher/socket v0.6.0 h1:ScZPaAGyO1icQnbFrhPM8mnXyMu9qukC1K4ZoM2IQKU= github.com/mdlayher/socket v0.6.0/go.mod h1:q7vozUAnxSqnjHc12Fik5yUKIzfZ8ITCfMkhOtE9z18= github.com/mdlayher/vsock v1.3.0 h1:bqQfZ1OznI03y6YiXp2sze05RVdzLn/zsfjnjd4+ivI= github.com/mdlayher/vsock v1.3.0/go.mod h1:WsuksavOvwCnV5UqGHUkvAvCy+Dqy81y4goKQTzxxNY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -49,5 +82,7 @@ golang.org/x/tools v0.0.0-20210105210202-9ed45478a130/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/secure/sce-unit/main.go b/secure/sce-unit/main.go index b1d27f55..e1d49c0f 100644 --- a/secure/sce-unit/main.go +++ b/secure/sce-unit/main.go @@ -11,7 +11,6 @@ import ( "time" sharedlog "github.com/Secure-RADS/st-dp/packages/go-common/log" - "golang.org/x/sys/unix" ) const ( @@ -25,7 +24,6 @@ const ( // The parent EC2 instance is always CID 3 on Nitro; the host's user data listens on this port. hostCID = 3 - hostOutputPort = 5000 vsockRetryWait = 500 * time.Millisecond vsockRetryLimit = 20 ) @@ -51,14 +49,14 @@ func main() { } info, err := readRunInfo() if err != nil { - failRun(timelineLog, cfg.AlgorithmId, "", err) + failRun(timelineLog, cfg.AlgorithmId, runInfo{}, err) } runID := info.RunID timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventEnclaveStarted, nil) // Must run before any crypto/rand use (attestation, TLS) - see entropy.go. if err := seedEntropy(); err != nil { - failRun(timelineLog, cfg.AlgorithmId, runID, fmt.Errorf("seed entropy: %w", err)) + failRun(timelineLog, cfg.AlgorithmId, info, fmt.Errorf("seed entropy: %w", err)) } log.Printf("sce-unit: seeded kernel entropy from NSM") timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventUnitReady, nil) @@ -66,7 +64,7 @@ func main() { // Attest, fetch, decrypt, and write records.json before nsjail starts - same file contract as rads. subjectIDs, err := prepareRecordsFile(cfg, timelineLog, runID, info.Size) if err != nil { - failRun(timelineLog, cfg.AlgorithmId, runID, err) + failRun(timelineLog, cfg.AlgorithmId, info, err) } var jailLog bytes.Buffer @@ -74,7 +72,7 @@ func main() { cmd.Stdout = io.MultiWriter(os.Stdout, &jailLog) cmd.Stderr = io.MultiWriter(os.Stderr, &jailLog) if err := cmd.Start(); err != nil { - failRun(timelineLog, cfg.AlgorithmId, runID, fmt.Errorf("start nsjail: %w", err)) + failRun(timelineLog, cfg.AlgorithmId, info, fmt.Errorf("start nsjail: %w", err)) } log.Printf("sce-unit: nsjail started (pid %d)", cmd.Process.Pid) @@ -112,13 +110,13 @@ func main() { } else if output[len(output)-1] != '\n' { output = append(output, '\n') } - if err := sendResult(resultPayload{ + if err := sendResult(info, resultPayload{ RunID: runID, AlgorithmID: cfg.AlgorithmId, Status: status, Output: string(output), }); err != nil { - log.Printf("sce-unit: send signed result to host failed: %v", err) + log.Printf("sce-unit: send signed result to SQS failed: %v", err) timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) os.Exit(1) } @@ -138,25 +136,25 @@ func resultStatus(waitErr, readErr error, outputLen int) string { return "exit:0" } -func failRun(timelineLog *sharedlog.Client, algorithmID, runID string, err error) { +func failRun(timelineLog *sharedlog.Client, algorithmID string, info runInfo, err error) { log.Printf("sce-unit: %v", err) - if runID != "" { - timelineLog.EmitEvent(algorithmID, &runID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) + if info.RunID != "" { + timelineLog.EmitEvent(algorithmID, &info.RunID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) + } + if info.RunID == "" || info.QueueURL == "" { + os.Exit(1) } failure, _ := json.Marshal(struct { Error string `json:"error"` }{Error: err.Error()}) payload := resultPayload{ - RunID: runID, + RunID: info.RunID, AlgorithmID: algorithmID, Status: "exit:1", Output: string(append(failure, '\n')), } - if sendErr := sendResult(payload); sendErr != nil { - log.Printf("sce-unit: send signed failure to host failed: %v", sendErr) - if err := sendOutput(append(failure, '\n')); err != nil { - log.Printf("sce-unit: send error to host failed: %v", err) - } + if sendErr := sendResult(info, payload); sendErr != nil { + log.Printf("sce-unit: send signed failure to SQS failed: %v", sendErr) } os.Exit(1) } @@ -222,34 +220,3 @@ func prepareRecordsFile(cfg runConfig, timelineLog *sharedlog.Client, runID stri timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventRecordsStoredLocally, nil) return subjectIDs, nil } - -// sendOutput streams the DC app's response to the parent instance over vsock - the enclave's only channel out. -func sendOutput(output []byte) error { - fd, err := unix.Socket(unix.AF_VSOCK, unix.SOCK_STREAM, 0) - if err != nil { - return err - } - defer unix.Close(fd) - - addr := &unix.SockaddrVM{CID: hostCID, Port: hostOutputPort} - for i := 0; ; i++ { - err = unix.Connect(fd, addr) - if err == nil { - break - } - if i >= vsockRetryLimit { - return err - } - time.Sleep(vsockRetryWait) - } - log.Printf("sce-unit: connected to host vsock %d:%d, sending %d bytes", hostCID, hostOutputPort, len(output)) - - for len(output) > 0 { - n, err := unix.Write(fd, output) - if err != nil { - return err - } - output = output[n:] - } - return nil -} diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index 11ef459d..b882a84b 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -23,6 +23,7 @@ type resultPayload struct { type signedResult struct { RunID string `json:"runId"` AlgorithmID string `json:"algorithmId"` + InstanceID string `json:"instanceId,omitempty"` Payload string `json:"payload"` Signature string `json:"signature"` } @@ -46,7 +47,7 @@ func getResultSigner() *ecdsa.PrivateKey { // sendResult signs the enclave-owned result fields and streams the envelope to the host. The host may add // instanceId, but it cannot change the signed payload or signature without the consumer rejecting it. -func sendResult(p resultPayload) error { +func sendResult(info runInfo, p resultPayload) error { key := getResultSigner() if key == nil { return fmt.Errorf("no result signing key: enclave has not attested") @@ -65,11 +66,12 @@ func sendResult(p resultPayload) error { envelope, err := json.Marshal(signedResult{ RunID: p.RunID, AlgorithmID: p.AlgorithmID, + InstanceID: info.InstanceID, Payload: base64.StdEncoding.EncodeToString(payload), Signature: base64.StdEncoding.EncodeToString(signature), }) if err != nil { return fmt.Errorf("marshal signed result: %w", err) } - return sendOutput(envelope) + return sendSQSResult(info, envelope) } diff --git a/secure/sce-unit/runinfo.go b/secure/sce-unit/runinfo.go index 5013b7df..863ba3a3 100644 --- a/secure/sce-unit/runinfo.go +++ b/secure/sce-unit/runinfo.go @@ -14,11 +14,15 @@ import ( // no other way to learn the per-run id it was launched for (the EIF only carries the per-algorithm config). const hostRunIDPort = 5001 -// runInfo is the per-run data the host serves on hostRunIDPort: the run id and how many records to read -// (0 = the whole dataset). The enclave takes no user-data, so this is its only source for both. +// runInfo is the per-run data the host serves on hostRunIDPort: the run id, record limit (0 = whole +// dataset), instance id, region, and run-results queue URL. The enclave takes no user-data, so this is its +// only source for all of them. type runInfo struct { - RunID string `json:"runId"` - Size int `json:"size"` + RunID string `json:"runId"` + Size int `json:"size"` + InstanceID string `json:"instanceId"` + Region string `json:"region"` + QueueURL string `json:"queueUrl"` } func readRunInfo() (runInfo, error) { @@ -66,5 +70,8 @@ func readRunInfo() (runInfo, error) { if info.RunID == "" || info.Size < 0 { return runInfo{}, fmt.Errorf("invalid run-info: runId must be nonempty and size must be nonnegative") } + if info.InstanceID == "" || info.Region == "" || info.QueueURL == "" { + return runInfo{}, fmt.Errorf("invalid run-info: instanceId, region, and queueUrl must be nonempty") + } return info, nil } diff --git a/secure/sce-unit/sqs.go b/secure/sce-unit/sqs.go new file mode 100644 index 00000000..b7c8ec24 --- /dev/null +++ b/secure/sce-unit/sqs.go @@ -0,0 +1,83 @@ +package main + +import ( + "context" + "crypto/tls" + "fmt" + "net" + "net/http" + "time" + + "github.com/aws/aws-sdk-go-v2/aws" + "github.com/aws/aws-sdk-go-v2/config" + "github.com/aws/aws-sdk-go-v2/credentials" + "github.com/aws/aws-sdk-go-v2/service/sqs" +) + +// The host forwards this port over vsock to sqs..amazonaws.com:443 (see userdata.sh.tmpl). TLS still +// terminates at the real SQS endpoint, so the host relays bytes but cannot read or change the result. +const sqsProxyPort = 8005 + +const sqsRequestTimeout = 30 * time.Second + +// sendSQSResult writes the already-signed envelope straight to the run-results queue using credentials +// borrowed from the host. The host relays the TLS bytes but cannot read or change the signed payload. +func sendSQSResult(info runInfo, envelope []byte) error { + creds, err := fetchAWSCreds() + if err != nil { + return fmt.Errorf("fetch host credentials: %w", err) + } + + awsCfg, err := config.LoadDefaultConfig(context.Background(), + config.WithRegion(info.Region), + config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider( + creds.AccessKeyID, creds.SecretAccessKey, creds.SessionToken)), + config.WithHTTPClient(vsockSQSHTTPClient(info.Region)), + ) + if err != nil { + return fmt.Errorf("load AWS config: %w", err) + } + + ctx, cancel := context.WithTimeout(context.Background(), sqsRequestTimeout) + defer cancel() + _, err = sqs.NewFromConfig(awsCfg).SendMessage(ctx, &sqs.SendMessageInput{ + QueueUrl: aws.String(info.QueueURL), + MessageBody: aws.String(string(envelope)), + }) + if err != nil { + return fmt.Errorf("sqs send-message: %w", err) + } + return nil +} + +// vsockSQSHTTPClient routes SQS HTTP/TLS through the host's vsock-proxy instead of real TCP. TLS verifies the +// real SQS endpoint certificate through the relay, so a compromised host cannot impersonate SQS. +func vsockSQSHTTPClient(region string) *http.Client { + endpoint := fmt.Sprintf("sqs.%s.amazonaws.com", region) + return &http.Client{ + Timeout: sqsRequestTimeout, + Transport: &http.Transport{ + DisableKeepAlives: true, + DialTLSContext: func(ctx context.Context, _ string, _ string) (net.Conn, error) { + conn, err := dialVsock(ctx, hostCID, sqsProxyPort) + if err != nil { + return nil, err + } + if err := conn.SetDeadline(time.Now().Add(tlsHandshakeTimeout)); err != nil { + conn.Close() + return nil, err + } + tlsConn := tls.Client(conn, &tls.Config{ServerName: endpoint}) + if err := tlsConn.Handshake(); err != nil { + conn.Close() + return nil, err + } + if err := conn.SetDeadline(time.Time{}); err != nil { + tlsConn.Close() + return nil, err + } + return tlsConn, nil + }, + }, + } +} diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index c05e7212..9ee16980 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -2,7 +2,7 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given an `AlgorithmId`, it looks up the EIF in S3 (via registry-service's `AlgorithmTable`), starts a Nitro-Enclave-capable EC2 instance, and returns immediately. The per-run EC2 instance remains necessary as the Nitro Enclave parent; the service itself has no persistent EC2 host. -`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. The enclave signs the run result (run id, algorithm id, status, and output) with its attested ephemeral key and streams the signed envelope to the host over vsock. The host forwards that envelope to the run-results SQS queue unchanged apart from adding its instance id; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. +`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. The enclave signs the run result (run id, algorithm id, status, and output) with its attested ephemeral key and sends the signed envelope straight to the run-results SQS queue, borrowing the host's instance role credentials over vsock port 5002. The host no longer builds or publishes results; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. `GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result once the consumer has written it. `algorithmId` is required so every poll can be attributed to its run. diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index a39c690f..6afc4755 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -16,45 +16,15 @@ emit_cost() { -d "{\"algorithmId\":\"{{.AlgorithmId}}\",\"runId\":\"{{.RunId}}\",\"eventId\":\"$(cat /proc/sys/kernel/random/uuid)\",\"phase\":\"execution\",\"service\":\"$1\",\"operation\":\"$2\",\"quantity\":$3,\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)\"}" >/dev/null || true } -# Always self-terminate on exit and send the run result to SQS, where a consumer Lambda persists it for the -# caller to poll (GET /run/). The result carries the runId execution-service assigned at launch. +# Always self-terminate on exit. sce-unit sends the signed result to SQS itself using credentials served on +# port 5002, so the host no longer builds or publishes results. finish() { - STATUS=$? set +e TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") INSTANCE_ID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id) REGION=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/placement/region) - python3 - "$STATUS" "$INSTANCE_ID" > /tmp/result.json <<'PYEOF' -import json, sys -def read(path): - try: - return open(path, "rb").read().decode("utf-8", "replace") - except FileNotFoundError: - return "" -out = read("/tmp/output.txt") -# The enclave signs the result fields; this host only forwards the envelope plus its instance id. -# Anything the host builds itself has no signature and result-consumer rejects it. -try: - message = json.loads(out) -except json.JSONDecodeError: - message = None -if isinstance(message, dict) and isinstance(message.get("payload"), str) and isinstance(message.get("signature"), str): - message["instanceId"] = sys.argv[2] -else: - message = { - "runId": "{{.RunId}}", - "algorithmId": "{{.AlgorithmId}}", - "instanceId": sys.argv[2], - "status": "exit:" + sys.argv[1], - "output": out, - "diag": {"runEnclave": read("/tmp/run-enclave.log")}, - } -print(json.dumps(message)) -PYEOF - aws sqs send-message --queue-url "{{.QueueUrl}}" --message-body file:///tmp/result.json --region "$REGION" || true emit_event executor-finished - emit_cost sqs send "$(wc -c < /tmp/result.json)" - # The runtime estimate is captured before this cost POST and the terminate request. + # The runtime estimate is captured before the cost POST and the terminate request. emit_cost ec2 instance "$(( $(date +%s) - {{.LaunchEpoch}} ))" aws ec2 terminate-instances --instance-ids "$INSTANCE_ID" --region "$REGION" } @@ -80,34 +50,58 @@ emit_cost s3 get 1 # Checkpoint: the algorithm artifact (EIF) is now on the host, before the enclave is launched. emit_event artifact-retrieved -# sce-unit connects back to the parent (CID 3) on port 5000 and streams the DC app's output; one connection per run. -python3 - <<'PYEOF' & -import socket +# Serve this run's id, record limit, instance id, region, and queue URL to the enclave on port 5001 - the +# enclave takes no user-data, so it has no other way to learn them (the EIF carries per-algorithm config). +TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") +INSTANCE_ID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id) +python3 - "$INSTANCE_ID" > /dev/null <<'PYEOF' & +import json, socket, sys s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) -s.settimeout(3600) -s.bind((socket.VMADDR_CID_ANY, 5000)) -s.listen(1) -conn, _ = s.accept() -conn.settimeout(3600) -with open("/tmp/output.txt", "wb") as f: - while chunk := conn.recv(65536): - f.write(chunk) +s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +s.bind((socket.VMADDR_CID_ANY, 5001)) +s.listen(5) +body = json.dumps({ + "runId": "{{.RunId}}", + "size": {{.Size}}, + "instanceId": sys.argv[1], + "region": "{{.Region}}", + "queueUrl": "{{.QueueUrl}}", +}).encode() +while True: + conn, _ = s.accept() + conn.sendall(body) + conn.close() PYEOF -OUTPUT_LISTENER_PID=$! +RUNINFO_LISTENER_PID=$! -# Serve this run's id and record limit to the enclave on port 5001 - the enclave takes no user-data, so it -# has no other way to learn the per-run id or how many records to read (the EIF carries per-algorithm config). +# Serve fresh IMDSv2 role credentials to the enclave on port 5002 so it can call SQS. The enclave has no +# IMDS access; the host holds the role. The role also lets the host send to the queue, so result integrity +# still comes from the enclave signature, not from this credential split. python3 - <<'PYEOF' & -import json, socket +import json, socket, urllib.request +def get(path, token=None): + req = urllib.request.Request("http://169.254.169.254"+path) + if token: + req.add_header("X-aws-ec2-metadata-token", token) + return urllib.request.urlopen(req, timeout=5).read().decode() s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -s.bind((socket.VMADDR_CID_ANY, 5001)) +s.bind((socket.VMADDR_CID_ANY, 5002)) s.listen(5) -body = json.dumps({"runId": "{{.RunId}}", "size": {{.Size}}}).encode() while True: conn, _ = s.accept() - conn.sendall(body) - conn.close() + try: + token = urllib.request.urlopen(urllib.request.Request("http://169.254.169.254/latest/api/token", + data=b"", method="PUT", headers={"X-aws-ec2-metadata-token-ttl-seconds": "21600"}), timeout=5).read().decode() + role = get("/latest/meta-data/iam/security-credentials/", token) + creds = json.loads(get("/latest/meta-data/iam/security-credentials/"+role, token)) + conn.sendall(json.dumps({ + "accessKeyId": creds["AccessKeyId"], + "secretAccessKey": creds["SecretAccessKey"], + "sessionToken": creds["Token"], + }).encode()) + finally: + conn.close() PYEOF # Only way out of the enclave: one vsock-proxy per allowed host forwards vsock traffic over real TCP/TLS, resolving DNS here since the enclave has none. @@ -118,12 +112,14 @@ allowlist: - {address: "{{.LogHost}}", port: 443} - {address: "{{.TelemetryHost}}", port: 443} - {address: "{{.KmsHost}}", port: 443} + - {address: "sqs.{{.Region}}.amazonaws.com", port: 443} EOF vsock-proxy 8000 "{{.KmsHost}}" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & vsock-proxy 8001 "{{.VerifierHost}}" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & vsock-proxy 8002 "{{.PdmHost}}" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & vsock-proxy 8003 "{{.LogHost}}" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & vsock-proxy 8004 "{{.TelemetryHost}}" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & +vsock-proxy 8005 "sqs.{{.Region}}.amazonaws.com" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml & # run-enclave can transiently fail right after the allocator starts (hugepages not yet reserved) - retry. launched=false @@ -138,15 +134,12 @@ done if [ "$launched" = true ]; then emit_event enclave-launched - # Wait for output first so a transient describe-enclaves miss cannot publish an empty result. - wait "$OUTPUT_LISTENER_PID" || exit $? while true; do ENCLAVE_COUNT=$(nitro-cli describe-enclaves | python3 -c 'import json, sys; print(sum(e.get("EnclaveCID") == 16 for e in json.load(sys.stdin)))') || exit 1 [ "$ENCLAVE_COUNT" -eq 0 ] && break sleep 1 done else - kill "$OUTPUT_LISTENER_PID" 2>/dev/null || true - wait "$OUTPUT_LISTENER_PID" 2>/dev/null || true + kill "$RUNINFO_LISTENER_PID" 2>/dev/null || true exit 1 fi From 50ad6d841cadfeab98a0d74df2733dca9b5bb959 Mon Sep 17 00:00:00 2001 From: prdai Date: Mon, 23 Nov 2026 14:11:46 +0530 Subject: [PATCH 04/13] refactor(verifier): rename run attestation handler to runSigningKey Co-authored-by: Codex --- secure/verifier-service/serverless.yml | 16 ++++++++-------- .../{runAttestation.ts => runSigningKey.ts} | 0 2 files changed, 8 insertions(+), 8 deletions(-) rename secure/verifier-service/src/handlers/{runAttestation.ts => runSigningKey.ts} (100%) diff --git a/secure/verifier-service/serverless.yml b/secure/verifier-service/serverless.yml index fa86fc0b..99a79e1e 100644 --- a/secure/verifier-service/serverless.yml +++ b/secure/verifier-service/serverless.yml @@ -77,8 +77,8 @@ functions: handler: src/handlers/jwks.handler # result-consumer reads the public key recorded for one run. - runAttestation: - handler: src/handlers/runAttestation.handler + runSigningKey: + handler: src/handlers/runSigningKey.handler resources: Conditions: @@ -287,25 +287,25 @@ resources: Principal: apigateway.amazonaws.com SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${PublicHttpApi}/*/*/*" - RunAttestationIntegration: + RunSigningKeyIntegration: Type: AWS::ApiGatewayV2::Integration Properties: ApiId: !Ref PublicHttpApi IntegrationType: AWS_PROXY - IntegrationUri: !GetAtt RunAttestationLambdaFunction.Arn + IntegrationUri: !GetAtt RunSigningKeyLambdaFunction.Arn PayloadFormatVersion: "2.0" - RunAttestationRoute: + RunSigningKeyRoute: Type: AWS::ApiGatewayV2::Route Properties: ApiId: !Ref PublicHttpApi RouteKey: "GET /runs/{runId}" - Target: !Sub "integrations/${RunAttestationIntegration}" + Target: !Sub "integrations/${RunSigningKeyIntegration}" - RunAttestationInvokePermission: + RunSigningKeyInvokePermission: Type: AWS::Lambda::Permission Properties: - FunctionName: !Ref RunAttestationLambdaFunction + FunctionName: !Ref RunSigningKeyLambdaFunction Action: lambda:InvokeFunction Principal: apigateway.amazonaws.com SourceArn: !Sub "arn:aws:execute-api:${AWS::Region}:${AWS::AccountId}:${PublicHttpApi}/*/*/*" diff --git a/secure/verifier-service/src/handlers/runAttestation.ts b/secure/verifier-service/src/handlers/runSigningKey.ts similarity index 100% rename from secure/verifier-service/src/handlers/runAttestation.ts rename to secure/verifier-service/src/handlers/runSigningKey.ts From 10db8c00dd48f51eaff66f03b5d4b1d188458c71 Mon Sep 17 00:00:00 2001 From: prdai Date: Thu, 26 Nov 2026 15:48:15 +0530 Subject: [PATCH 05/13] feat(sce): deliver signed results to per-run webhooks Co-authored-by: Codex --- docs/e2e-secure-rads.txt | 5 +- secure/result-consumer/README.md | 2 + secure/sce-unit/README.md | 11 ++- secure/sce-unit/result.go | 3 + secure/sce-unit/runinfo.go | 1 + secure/sce-unit/webhook.go | 97 +++++++++++++++++++ secure/sce/execution-service/README.md | 12 ++- .../sce/execution-service/src/handlers/run.ts | 31 +++++- .../sce/execution-service/src/lib/userdata.ts | 45 +++++++++ secure/sce/execution-service/userdata.sh.tmpl | 37 ++----- secure/verifier-service/README.md | 18 ++++ 11 files changed, 222 insertions(+), 40 deletions(-) create mode 100644 secure/sce-unit/webhook.go diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 163db1d4..8c37da09 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -86,8 +86,9 @@ Input: 21 output ← read /data/result.json 22 emit dc-app-completed // on success, else run-failed 23 SIGN result // signature key registered at attestation -24 SEND signed envelope to SQS // host-role credentials over vsock :5002, TLS to SQS -25 cost sqs:send +24 SEND signed envelope to delivery // webhook: TLS via vsock :8006 + // or SQS: host-role credentials over vsock :5002, TLS to SQS +25 cost sqs:send // SQS path only 26 emit output-sent 27 // on failure: emit run-failed diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index d3ef4299..3f7fee03 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -18,6 +18,8 @@ For each message the `consume` Lambda: A message with no valid `runId`, no attested key, or an invalid signature is skipped, not thrown, so it can't block the rest of the batch; it ages out to the DLQ. DynamoDB errors throw so the batch retries. +Runs created with a `webhookUrl` are delivered to the DC webhook instead and do not produce an SQS message, so `GET /run/{runId}` stays `pending` for those runs. + When the signature verifies it also writes `result-persisted` to telemetry-service over plain HTTPS. It does not emit host or terminal events; the enclave owns those. The stack Outputs (`RunResultsQueueUrl`, `RunResultsQueueArn`, `RunResultsTableName`, `RunResultsTableArn`) are consumed by execution-service. diff --git a/secure/sce-unit/README.md b/secure/sce-unit/README.md index 11d234ce..da342507 100644 --- a/secure/sce-unit/README.md +++ b/secure/sce-unit/README.md @@ -6,10 +6,13 @@ fetches and decrypts PDM records, writes `records.json` under the DC rootfs `/data` (JSON shape `algorithmId` + `records`, same load path as rads), starts nsjail with `RECORDS_PATH` / `RESULT_PATH` set, reads the DC app's `result.json`, then signs -the result fields with the ephemeral key it registered during attestation and -sends the signed envelope to the run-results SQS queue. SQS access uses -credentials the parent serves over vsock (port 5002); the signature, not the -credential split, is what keeps a compromised host from forging a result. +the result fields with the ephemeral key it registered during attestation. + +Delivery depends on the run: if the run requested a webhook, sce-unit POSTs the +signed envelope to it over CA-verified TLS through a per-run vsock-proxy. Otherwise +it sends the envelope to the run-results SQS queue using credentials the parent +serves over vsock (port 5002). In both paths the signature, not the transport, is +what keeps a compromised host from forging a result. PDM returns a standalone `dataSubjectIds` list aligned with the records. sce-unit keeps those ids in memory, writes `records.json` without them, and after a diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index b882a84b..f886e1d9 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -73,5 +73,8 @@ func sendResult(info runInfo, p resultPayload) error { if err != nil { return fmt.Errorf("marshal signed result: %w", err) } + if info.WebhookURL != "" { + return sendWebhookResult(info, envelope) + } return sendSQSResult(info, envelope) } diff --git a/secure/sce-unit/runinfo.go b/secure/sce-unit/runinfo.go index 863ba3a3..3725f0ea 100644 --- a/secure/sce-unit/runinfo.go +++ b/secure/sce-unit/runinfo.go @@ -23,6 +23,7 @@ type runInfo struct { InstanceID string `json:"instanceId"` Region string `json:"region"` QueueURL string `json:"queueUrl"` + WebhookURL string `json:"webhookUrl"` } func readRunInfo() (runInfo, error) { diff --git a/secure/sce-unit/webhook.go b/secure/sce-unit/webhook.go new file mode 100644 index 00000000..40f72a9e --- /dev/null +++ b/secure/sce-unit/webhook.go @@ -0,0 +1,97 @@ +package main + +import ( + "bytes" + "context" + "crypto/tls" + "fmt" + "io" + "net" + "net/http" + "net/url" + "time" +) + +// The host forwards this port over vsock to the DC webhook host:port (see userdata.sh.tmpl). The host is +// untrusted, so TLS uses the normal CA chain and the webhook hostname - unlike the fixed internal services, +// the webhook can be any public host and cannot be pinned ahead of time. +const webhookProxyPort = 8006 + +const webhookRequestTimeout = 30 * time.Second + +func sendWebhookResult(info runInfo, envelope []byte) error { + target, err := url.Parse(info.WebhookURL) + if err != nil || target.Scheme != "https" || target.Hostname() == "" { + return fmt.Errorf("invalid webhook URL") + } + + body := bytes.NewReader(envelope) + for attempt := 1; ; attempt++ { + err := postWebhook(target, body) + if err == nil { + return nil + } + if attempt >= 3 { + return err + } + time.Sleep(time.Duration(attempt) * time.Second) + body = bytes.NewReader(envelope) + } +} + +func postWebhook(target *url.URL, body *bytes.Reader) error { + ctx, cancel := context.WithTimeout(context.Background(), webhookRequestTimeout) + defer cancel() + + req, err := http.NewRequestWithContext(ctx, http.MethodPost, target.String(), body) + if err != nil { + return fmt.Errorf("build webhook request: %w", err) + } + req.Header.Set("Content-Type", "application/json") + + resp, err := vsockWebhookHTTPClient(target.Hostname()).Do(req) + if err != nil { + return fmt.Errorf("POST webhook: %w", err) + } + defer resp.Body.Close() + if resp.StatusCode < 200 || resp.StatusCode >= 300 { + respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 1024)) + return fmt.Errorf("webhook returned %s: %s", resp.Status, respBody) + } + return nil +} + +func vsockWebhookHTTPClient(host string) *http.Client { + return &http.Client{ + Timeout: webhookRequestTimeout, + CheckRedirect: func(_ *http.Request, _ []*http.Request) error { + return http.ErrUseLastResponse + }, + Transport: &http.Transport{ + DisableKeepAlives: true, + DialTLSContext: func(ctx context.Context, _ string, _ string) (net.Conn, error) { + conn, err := dialVsock(ctx, hostCID, webhookProxyPort) + if err != nil { + return nil, err + } + if err := conn.SetDeadline(time.Now().Add(tlsHandshakeTimeout)); err != nil { + conn.Close() + return nil, err + } + tlsConn := tls.Client(conn, &tls.Config{ + ServerName: host, + MinVersion: tls.VersionTLS12, + }) + if err := tlsConn.Handshake(); err != nil { + conn.Close() + return nil, err + } + if err := conn.SetDeadline(time.Time{}); err != nil { + tlsConn.Close() + return nil, err + } + return tlsConn, nil + }, + }, + } +} diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index 9ee16980..f353340f 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -2,7 +2,17 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given an `AlgorithmId`, it looks up the EIF in S3 (via registry-service's `AlgorithmTable`), starts a Nitro-Enclave-capable EC2 instance, and returns immediately. The per-run EC2 instance remains necessary as the Nitro Enclave parent; the service itself has no persistent EC2 host. -`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. The enclave signs the run result (run id, algorithm id, status, and output) with its attested ephemeral key and sends the signed envelope straight to the run-results SQS queue, borrowing the host's instance role credentials over vsock port 5002. The host no longer builds or publishes results; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. +`POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. + +The request accepts an optional `webhookUrl`: + +```json +{ "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } +``` + +The URL must be `https` and must not target localhost or an obvious private/internal address. When present, the enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. The DC verifies the envelope with verifier-service `GET /runs/{runId}`; no SQS message or host credentials are involved, and `GET /run/{runId}` stays `pending` for that run. + +Without `webhookUrl`, the enclave sends the signed envelope to the run-results SQS queue, borrowing the host instance role over vsock port 5002. The host never builds or publishes results; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. `GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result once the consumer has written it. `algorithmId` is required so every poll can be attributed to its run. diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 9adab820..3951c0be 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -31,6 +31,26 @@ const region = requiredEnv("AWS_REGION"); interface RunRequest { algorithmId: string; size?: number; + webhookUrl?: string; +} + +const PRIVATE_HOST = + /^(localhost|.*\.local|.*\.internal|127\.|10\.|192\.168\.|169\.254\.|0\.0\.0\.0$|172\.(1[6-9]|2\d|3[01])\.)/i; + +// Webhooks run from the host network, so reject obvious internal targets. DNS resolving to a private +// address after this check is still possible; see docs for the remaining SSRF caveat. +function parseWebhookUrl(value: unknown): string | null | undefined { + if (value === undefined) return undefined; + if (typeof value !== "string" || value.length === 0) return null; + let url: URL; + try { + url = new URL(value); + } catch { + return null; + } + if (url.protocol !== "https:" || !url.hostname || url.username || url.password) return null; + if (url.hostname.includes(":") || PRIVATE_HOST.test(url.hostname)) return null; + return url.toString(); } interface AlgorithmRecord { @@ -57,12 +77,18 @@ function parseRunRequest(body: string | undefined): RunRequest | undefined { try { const parsed: unknown = JSON.parse(body ?? ""); if (typeof parsed !== "object" || parsed === null) return undefined; - const { algorithmId, size } = parsed as Record; + const { algorithmId, size, webhookUrl } = parsed as Record; if (typeof algorithmId !== "string" || algorithmId.length === 0) return undefined; if (size !== undefined && (typeof size !== "number" || !Number.isInteger(size) || size <= 0)) { return undefined; } - return size === undefined ? { algorithmId } : { algorithmId, size }; + const webhook = parseWebhookUrl(webhookUrl); + if (webhook === null) return undefined; + return { + algorithmId, + ...(size === undefined ? {} : { size }), + ...(webhook === undefined ? {} : { webhookUrl: webhook }), + }; } catch { return undefined; } @@ -161,6 +187,7 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { s3Key: record.S3Key, size: request.size, verifierHost, + webhookUrl: request.webhookUrl, }), ).toString("base64"), TagSpecifications: [ diff --git a/secure/sce/execution-service/src/lib/userdata.ts b/secure/sce/execution-service/src/lib/userdata.ts index 6352602d..a926e026 100644 --- a/secure/sce/execution-service/src/lib/userdata.ts +++ b/secure/sce/execution-service/src/lib/userdata.ts @@ -18,13 +18,49 @@ export interface UserDataValues { verifierHost: string; queueUrl: string; size?: number; + webhookUrl?: string; } +const credsServer = `# Serve fresh IMDSv2 role credentials to the enclave on port 5002 so it can call SQS. The enclave has no +# IMDS access; the host holds the role. The role also lets the host send to the queue, so result integrity +# still comes from the enclave signature, not from this credential split. +python3 - <<'PYEOF' & +import json, socket, urllib.request +def get(path, token=None): + req = urllib.request.Request("http://169.254.169.254"+path) + if token: + req.add_header("X-aws-ec2-metadata-token", token) + return urllib.request.urlopen(req, timeout=5).read().decode() +s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) +s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) +s.bind((socket.VMADDR_CID_ANY, 5002)) +s.listen(5) +while True: + conn, _ = s.accept() + try: + token = urllib.request.urlopen(urllib.request.Request("http://169.254.169.254/latest/api/token", + data=b"", method="PUT", headers={"X-aws-ec2-metadata-token-ttl-seconds": "21600"}), timeout=5).read().decode() + role = get("/latest/meta-data/iam/security-credentials/", token) + creds = json.loads(get("/latest/meta-data/iam/security-credentials/"+role, token)) + conn.sendall(json.dumps({ + "accessKeyId": creds["AccessKeyId"], + "secretAccessKey": creds["SecretAccessKey"], + "sessionToken": creds["Token"], + }).encode()) + finally: + conn.close() +PYEOF`; + export function userData(values: UserDataValues): string { + const webhook = values.webhookUrl ? new URL(values.webhookUrl) : undefined; + const webhookHost = webhook?.hostname; + const webhookPort = webhook?.port || "443"; + const replacements: Record = { AlgorithmId: values.algorithmId, CostHost: values.costHost, CPUCount: "1", + CredsServer: webhookHost ? "" : credsServer, KmsHost: values.kmsHost, LaunchEpoch: values.launchEpoch.toString(), LogHost: values.logHost, @@ -37,7 +73,16 @@ export function userData(values: UserDataValues): string { S3Bucket: values.s3Bucket, S3Key: values.s3Key, Size: (values.size ?? 0).toString(), + SqsAllowlist: webhookHost ? "" : ` - {address: "sqs.${values.region}.amazonaws.com", port: 443}`, + SqsProxy: webhookHost + ? "" + : `vsock-proxy 8005 "sqs.${values.region}.amazonaws.com" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml &`, VerifierHost: values.verifierHost, + WebhookAllowlist: webhookHost ? ` - {address: "${webhookHost}", port: ${webhookPort}}` : "", + WebhookProxy: webhookHost + ? `vsock-proxy 8006 "${webhookHost}" ${webhookPort} --config /etc/nitro_enclaves/vsock-proxy.yaml &` + : "", + WebhookURL: values.webhookUrl ?? "", }; return Object.entries(replacements).reduce( diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index 6afc4755..99afbe07 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -66,6 +66,7 @@ body = json.dumps({ "instanceId": sys.argv[1], "region": "{{.Region}}", "queueUrl": "{{.QueueUrl}}", + "webhookUrl": "{{.WebhookURL}}", }).encode() while True: conn, _ = s.accept() @@ -74,35 +75,7 @@ while True: PYEOF RUNINFO_LISTENER_PID=$! -# Serve fresh IMDSv2 role credentials to the enclave on port 5002 so it can call SQS. The enclave has no -# IMDS access; the host holds the role. The role also lets the host send to the queue, so result integrity -# still comes from the enclave signature, not from this credential split. -python3 - <<'PYEOF' & -import json, socket, urllib.request -def get(path, token=None): - req = urllib.request.Request("http://169.254.169.254"+path) - if token: - req.add_header("X-aws-ec2-metadata-token", token) - return urllib.request.urlopen(req, timeout=5).read().decode() -s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) -s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -s.bind((socket.VMADDR_CID_ANY, 5002)) -s.listen(5) -while True: - conn, _ = s.accept() - try: - token = urllib.request.urlopen(urllib.request.Request("http://169.254.169.254/latest/api/token", - data=b"", method="PUT", headers={"X-aws-ec2-metadata-token-ttl-seconds": "21600"}), timeout=5).read().decode() - role = get("/latest/meta-data/iam/security-credentials/", token) - creds = json.loads(get("/latest/meta-data/iam/security-credentials/"+role, token)) - conn.sendall(json.dumps({ - "accessKeyId": creds["AccessKeyId"], - "secretAccessKey": creds["SecretAccessKey"], - "sessionToken": creds["Token"], - }).encode()) - finally: - conn.close() -PYEOF +{{.CredsServer}} # Only way out of the enclave: one vsock-proxy per allowed host forwards vsock traffic over real TCP/TLS, resolving DNS here since the enclave has none. cat > /etc/nitro_enclaves/vsock-proxy.yaml <", "signature": "" } +``` + +`payload` decodes to the signed JSON `{runId, algorithmId, status, output, diag?}`. The signature is ECDSA P-384 over SHA-256 of `sce-result-v1\n` followed by the exact payload bytes. + +To verify: + +1. `GET /runs/{runId}` on the public domain returns `{runId, algorithmId, publicKey}`; `publicKey` is base64 SPKI DER. +2. Check the signed `runId` and `algorithmId` match the values you expect. +3. Verify the signature with `publicKey`. + +No SQS or result table entry exists for a webhook run, so `GET /run/{runId}` on execution-service remains `pending`. + ### Access token format (ML-DSA-87 compact JWS) Downstream services (pdm-service, kms-service, log-service) verify the JWT locally against the JWKS endpoint - there is no `/validate` round-trip. Claims: From 9453f52da541414ba67a0ef938d091500798a1bd Mon Sep 17 00:00:00 2001 From: prdai Date: Thu, 26 Nov 2026 18:31:00 +0530 Subject: [PATCH 06/13] feat(sce)!: replace SQS result delivery with signed webhooks Co-authored-by: Codex --- .env.example | 2 +- .github/workflows/ci.yml | 8 - CLAUDE.md | 2 +- Makefile | 32 +- README.md | 2 +- benchmark/README.md | 7 +- benchmark/src/export.py | 4 +- benchmark/src/lib/trees/__init__.py | 2 +- benchmark/src/lib/trees/base.py | 3 +- benchmark/src/lib/trees/secure_rads.py | 32 ++ docs/cost-service.md | 8 +- docs/deploy.md | 2 +- docs/e2e-secure-rads.txt | 25 +- docs/getting-started.md | 6 - docs/running.md | 11 +- packages/common/package.json | 4 - scripts/lib/units.sh | 10 +- secure/result-consumer/README.md | 36 --- secure/result-consumer/biome.json | 24 -- secure/result-consumer/bun.lock | 294 ------------------ secure/result-consumer/knip.json | 12 - secure/result-consumer/package.json | 28 -- secure/result-consumer/serverless.yml | 69 ---- .../result-consumer/src/handlers/consume.ts | 94 ------ secure/result-consumer/src/lib/attestation.ts | 47 --- secure/result-consumer/src/lib/verify.ts | 80 ----- secure/result-consumer/tsconfig.json | 12 - secure/sce-unit/README.md | 8 +- secure/sce-unit/creds.go | 41 --- secure/sce-unit/go.mod | 12 - secure/sce-unit/go.sum | 35 --- secure/sce-unit/main.go | 6 +- secure/sce-unit/result.go | 9 +- secure/sce-unit/runinfo.go | 10 +- secure/sce-unit/sqs.go | 83 ----- secure/sce/Makefile | 9 - secure/sce/execution-service/README.md | 12 +- secure/sce/execution-service/serverless.yml | 21 +- .../sce/execution-service/src/handlers/run.ts | 61 +--- .../sce/execution-service/src/lib/userdata.ts | 52 +--- secure/sce/execution-service/userdata.sh.tmpl | 8 +- secure/telemetry-service/README.md | 2 +- secure/telemetry-service/src/lib/events.ts | 3 +- secure/verifier-service/README.md | 6 +- secure/verifier-service/serverless.yml | 2 +- .../src/handlers/runSigningKey.ts | 2 +- secure/verifier-service/src/lib/attestFlow.ts | 2 +- 47 files changed, 111 insertions(+), 1129 deletions(-) delete mode 100644 secure/result-consumer/README.md delete mode 100644 secure/result-consumer/biome.json delete mode 100644 secure/result-consumer/bun.lock delete mode 100644 secure/result-consumer/knip.json delete mode 100644 secure/result-consumer/package.json delete mode 100644 secure/result-consumer/serverless.yml delete mode 100644 secure/result-consumer/src/handlers/consume.ts delete mode 100644 secure/result-consumer/src/lib/attestation.ts delete mode 100644 secure/result-consumer/src/lib/verify.ts delete mode 100644 secure/result-consumer/tsconfig.json delete mode 100644 secure/sce-unit/creds.go delete mode 100644 secure/sce-unit/sqs.go diff --git a/.env.example b/.env.example index 02a2dee9..f911aeb2 100644 --- a/.env.example +++ b/.env.example @@ -22,7 +22,7 @@ TRANSPARENCY_DOMAIN_RADS=transparency.r.secure-rads.org TRANSPARENCY_DOMAIN_SECURE_RADS=transparency.sr.secure-rads.org LOG_HOST_RADS=log.r.secure-rads.org LOG_HOST_SECURE_RADS=log.sr.secure-rads.org -# mTLS domain for internal producers (registry, execution-service, result-consumer). +# mTLS domain for internal producers (registry, execution-service). TELEMETRY_HOST_RADS=telemetry.r.secure-rads.org TELEMETRY_HOST_SECURE_RADS=telemetry.sr.secure-rads.org COST_HOST_RADS=cost.r.secure-rads.org diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09a6bd21..16b116fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,10 +76,6 @@ jobs: - 'secure/pdm-service/**' - 'packages/common/**' - '.github/workflows/ci.yml' - 'secure/result-consumer': - - 'secure/result-consumer/**' - - 'packages/common/**' - - '.github/workflows/ci.yml' 'secure/sce/execution-service': - 'secure/sce/execution-service/**' - 'packages/common/**' @@ -145,10 +141,6 @@ jobs: - 'secure/pdm-service/**' - 'packages/common/**' - '.github/workflows/ci.yml' - 'secure/result-consumer': - - 'secure/result-consumer/**' - - 'packages/common/**' - - '.github/workflows/ci.yml' 'secure/sce/execution-service': - 'secure/sce/execution-service/**' - 'packages/common/**' diff --git a/CLAUDE.md b/CLAUDE.md index c8a540b0..f6fde800 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ The human user is the technical lead. The agent is a supporting engineer that he ## Project Context -This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery through SQS and a result-consumer Lambda, polled via `GET /run/{runId}`). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. +This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery to a per-run DC webhook, signed by the enclave and verifiable via verifier-service). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. ## Operating Rules diff --git a/Makefile b/Makefile index 44d244c1..8764de35 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ logs: pids=""; \ for target in registry-logs; do make $$target & pids="$$pids $$!"; done; \ for group in $$(aws logs describe-log-groups --region "$(REGION)" --log-group-name-prefix /aws/lambda/ --query 'logGroups[].logGroupName' --output text); do \ - case "$$group" in /aws/lambda/secure-rads-execution-service-dev-*|/aws/lambda/secure-rads-verifier-service-dev-*|/aws/lambda/secure-rads-pdm-service-dev-*|/aws/lambda/secure-rads-kms-service-dev-*|/aws/lambda/secure-rads-log-service-dev-*|/aws/lambda/secure-rads-telemetry-service-dev-*|/aws/lambda/secure-rads-cost-service-dev-*|/aws/lambda/secure-rads-result-consumer-dev-*|/aws/lambda/rads-registry-service-dev-*|/aws/lambda/rads-pdm-service-dev-*|/aws/lambda/rads-log-service-dev-*|/aws/lambda/rads-telemetry-service-dev-*|/aws/lambda/rads-cost-service-dev-*|/aws/lambda/rads-result-consumer-dev-*|/aws/lambda/rads-execution-service-dev-*) aws logs tail "$$group" --region "$(REGION)" --follow & pids="$$pids $$!";; esac; \ + case "$$group" in /aws/lambda/secure-rads-execution-service-dev-*|/aws/lambda/secure-rads-verifier-service-dev-*|/aws/lambda/secure-rads-pdm-service-dev-*|/aws/lambda/secure-rads-kms-service-dev-*|/aws/lambda/secure-rads-log-service-dev-*|/aws/lambda/secure-rads-telemetry-service-dev-*|/aws/lambda/secure-rads-cost-service-dev-*|/aws/lambda/rads-registry-service-dev-*|/aws/lambda/rads-pdm-service-dev-*|/aws/lambda/rads-log-service-dev-*|/aws/lambda/rads-telemetry-service-dev-*|/aws/lambda/rads-cost-service-dev-*|/aws/lambda/rads-result-consumer-dev-*|/aws/lambda/rads-execution-service-dev-*) aws logs tail "$$group" --region "$(REGION)" --follow & pids="$$pids $$!";; esac; \ done; \ trap 'kill $$pids 2>/dev/null || true' EXIT INT TERM; \ for pid in $$pids; do wait "$$pid" || true; done @@ -219,36 +219,28 @@ secure-rads-build-all: $(MAKE) secure-rads-build APP=$$app ALGORITHM_ID=$$id || exit 1; \ done -# Execution phase (one run): make secure-rads-run ALGORITHM_ID=. -# Fires /run (202 + runId), then polls GET /run/{runId} until the enclave reports back. +# Execution phase (one run): make secure-rads-run ALGORITHM_ID= WEBHOOK_URL=https://... +# Fires /run and prints the runId. The signed result is POSTed to WEBHOOK_URL; there is no result polling. secure-rads-run: @test -n "$(ALGORITHM_ID)" || { echo "ALGORITHM_ID is required"; exit 1; } + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @api=$(EXECUTION_API_URL); \ - runId=$$(curl -sS -X POST "$$api/run" -H 'Content-Type: application/json' \ - -d '{"algorithmId":"$(ALGORITHM_ID)"}' | python3 -c 'import sys,json; print(json.load(sys.stdin)["runId"])'); \ - echo "runId=$$runId"; \ - for i in $$(seq 1 132); do \ - res=$$(curl -sS "$$api/run/$$runId?algorithmId=$(ALGORITHM_ID)"); \ - status=$$(echo "$$res" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("status",""))'); \ - if [ "$$status" != "pending" ]; then \ - echo "$$res"; \ - echo "$$res" | python3 -c 'import json,sys; r=json.load(sys.stdin); out=r.get("output", "").strip(); parsed=json.loads(out) if out else {}; ok=r.get("status")=="exit:0" and bool(out) and not (isinstance(parsed, dict) and parsed.get("error")); sys.exit(0 if ok else 1)'; \ - exit $$?; \ - fi; \ - sleep 5; \ - done; \ - echo "timed out waiting for runId=$$runId"; exit 1 + curl -sS -X POST "$$api/run" -H 'Content-Type: application/json' \ + -d '{"algorithmId":"$(ALGORITHM_ID)","webhookUrl":"$(WEBHOOK_URL)"}'; \ + echo -# Fire and poll every sample app in turn (sequential - each spins up its own enclave). +# Fire every sample app in turn. The same WEBHOOK_URL receives all results. secure-rads-run-all: + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @for pair in $(SAMPLE_APPS); do \ - app=$${pair%%:*}; id=$${pair##*:}; \ - $(MAKE) secure-rads-run ALGORITHM_ID=$$id || exit 1; \ + id=$${pair##*:}; \ + $(MAKE) secure-rads-run ALGORITHM_ID=$$id WEBHOOK_URL="$(WEBHOOK_URL)" || exit 1; \ done # Start the existing hosts, then build, seed, and run the whole fleet. Build comes first because it # provisions the per-algorithm KMS keys used by seeding. secure-rads-all: + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } $(MAKE) secure-rads-ready $(MAKE) secure-rads-build-all $(MAKE) secure-rads-seed diff --git a/README.md b/README.md index a637222d..f26fa596 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Every rads AWS resource is prefixed `rads-`; every secure-rads resource is prefi **Build phase (CSAV).** A Data Controller uploads an OCI image and assigns it an `algorithmId`. registry-service unpacks the image (daemonless: skopeo + umoci), layers the SCE Unit and nsjail on top, and builds a single Nitro Enclave Image File (EIF). It registers the EIF's PCR measurements against that `algorithmId` with the Verifier Service (over mTLS) and stores the EIF in S3, recording `algorithmId -> S3 path` in DynamoDB. -**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and sends it to SQS itself, a consumer Lambda verifies the signature and persists it, and the caller polls `GET /run/{runId}`. +**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and POSTs it to the DC webhook, and the DC verifies the signature against verifier-service. Throughout both phases every component posts timestamped events to the telemetry-service, so a run's full timeline - build to execution - can be exported for benchmarking. The log-service records only the subject-access trail. Components also report selected, attributable AWS operations to the cost-service, keyed by the same `(AlgorithmId, runId)`, so their estimated costs can be summed per AWS service ([`docs/cost-service.md`](docs/cost-service.md)). Event-by-event plaintext flows: [`docs/e2e-rads.txt`](docs/e2e-rads.txt), [`docs/e2e-secure-rads.txt`](docs/e2e-secure-rads.txt). diff --git a/benchmark/README.md b/benchmark/README.md index 77170f6c..9d12415e 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -46,9 +46,10 @@ Typical iteration: `make seed` once, then `make run REPS=1` / `make report` whil ## Prerequisites - Devbox + repo `.aws/credentials` (not the global AWS root profile) -- Both trees deployed (registry, PDM, execution, log, cost, result-consumer; secure-rads also needs CSAV, verifier, and kms-service) +- Both trees deployed (registry, PDM, execution, log, cost; rads also needs result-consumer; secure-rads also needs CSAV, verifier, and kms-service) - CSAV host running (`make up` / `make secure-rads-ready` from the repo root) - Docker (arm64) for the sample algorithm image on first upload +- `SECURE_WEBHOOK_URL` for secure-rads runs (defaults to `https://httpbin.org/post`) - `uv` (Python); `bun` for `../seeding` generate/seed Executors run on `c6g.large` on both trees. Secure-rads allocates a 1 vCPU / 2048 MiB enclave, and rads runs its container with `--cpus 1 --memory 2048m` so both trees give the algorithm the same compute. @@ -123,8 +124,8 @@ The event contract follows [RADS](../docs/e2e-rads.txt) and [Secure-RADS](../doc | Attestation | — | `unit-ready` → `attested` | | Data retrieval | `artifact-retrieved` → `records-stored-locally` | `attested` → `records-stored-locally` | | Algorithm processing | `records-stored-locally` → `compute-completed` | `records-stored-locally` → `dc-app-completed` | -| Result delivery | `compute-completed` → `result-persisted` | `output-sent` → `result-persisted` | -| Total | `run-requested` → `result-persisted` | `run-requested` → `result-persisted` | +| Result delivery | `compute-completed` → `result-persisted` | `dc-app-completed` → `output-sent` | +| Total | `run-requested` → `result-persisted` | `run-requested` → `output-sent` | `records-fetched` precedes file serialization/writing in both trees. Secure-rads emits `records-decrypted` after decryption and `records-stored-locally` after writing the plaintext file. Its data-retrieval phase includes fetching AWS credentials, fetching records, KMS key unwrapping, record decryption, and writing the file. The CSV includes the individual event timestamps as well as the aggregate phase durations. diff --git a/benchmark/src/export.py b/benchmark/src/export.py index be472dd7..c7470dc4 100644 --- a/benchmark/src/export.py +++ b/benchmark/src/export.py @@ -27,8 +27,8 @@ "attestation": ("unit-ready", "attested"), "data_retrieval": ("attested", "records-stored-locally"), "algorithm_processing": ("records-stored-locally", "dc-app-completed"), - "result_delivery": ("output-sent", "result-persisted"), - "total": ("run-requested", "result-persisted"), + "result_delivery": ("dc-app-completed", "output-sent"), + "total": ("run-requested", "output-sent"), }, "rads": { "host_provisioning": ("executor-launched", "executor-ready"), diff --git a/benchmark/src/lib/trees/__init__.py b/benchmark/src/lib/trees/__init__.py index f0364325..e5f0d05e 100644 --- a/benchmark/src/lib/trees/__init__.py +++ b/benchmark/src/lib/trees/__init__.py @@ -13,6 +13,6 @@ def harness_for(tree: Tree, endpoints: dict[str, str]) -> TreeHarness: if tree is Tree.RADS: return RadsHarness(endpoints["registry"], endpoints["execution"]) if tree is Tree.SECURE_RADS: - return SecureRadsHarness(endpoints["registry"], endpoints["execution"]) + return SecureRadsHarness(endpoints["registry"], endpoints["execution"], endpoints.get("telemetry")) msg = f"unknown tree {tree!r}" raise ValueError(msg) diff --git a/benchmark/src/lib/trees/base.py b/benchmark/src/lib/trees/base.py index 7029ef11..991b9e1f 100644 --- a/benchmark/src/lib/trees/base.py +++ b/benchmark/src/lib/trees/base.py @@ -20,9 +20,10 @@ class TreeHarness(ABC): name: ClassVar[Tree] - def __init__(self, registry_url: str, execution_url: str) -> None: + def __init__(self, registry_url: str, execution_url: str, telemetry_url: str | None = None) -> None: self._registry = registry_url self._execution = execution_url + self._telemetry = telemetry_url @staticmethod def build_sample_tar(tree: Tree) -> Path: diff --git a/benchmark/src/lib/trees/secure_rads.py b/benchmark/src/lib/trees/secure_rads.py index 152bb98c..2c403fba 100644 --- a/benchmark/src/lib/trees/secure_rads.py +++ b/benchmark/src/lib/trees/secure_rads.py @@ -1,6 +1,8 @@ from __future__ import annotations import asyncio +import json +import os from typing import TYPE_CHECKING, ClassVar from lib import http @@ -16,6 +18,36 @@ class SecureRadsHarness(TreeHarness): name: ClassVar[Tree] = Tree.SECURE_RADS + async def execute(self, client: httpx.AsyncClient, algorithm_id: str, size: int) -> tuple[str, str, str]: + if not self._telemetry: + msg = "secure-rads telemetry URL is required to follow a webhook run" + raise http.FlowError(msg) + webhook = os.environ.get("SECURE_WEBHOOK_URL", "https://httpbin.org/post") + status, body = await http.arequest( + client, + "POST", + f"{self._execution}/run", + json={"algorithmId": algorithm_id, "size": size, "webhookUrl": webhook}, + ) + http.require(status, http.HTTP_ACCEPTED, "/run", body) + + run_id = http.parse_json(body)["runId"] + deadline = asyncio.get_running_loop().time() + http.POLL_TIMEOUT_SECONDS + while asyncio.get_running_loop().time() < deadline: + status, event_body = await http.arequest( + client, "GET", f"{self._telemetry}/logs/{algorithm_id}?runId={run_id}" + ) + http.require(status, http.HTTP_OK, f"GET logs/{algorithm_id}", event_body) + events = {event["event"] for event in json.loads(event_body)} + if "run-failed" in events: + return run_id, "exit:1", "" + if "output-sent" in events or "executor-finished" in events: + return run_id, "exit:0", "" + await asyncio.sleep(http.POLL_INTERVAL_SECONDS) + + msg = f"timed out after {http.POLL_TIMEOUT_SECONDS:.0f}s waiting for runId={run_id}" + raise http.FlowError(msg) + async def upload(self, client: httpx.AsyncClient, algorithm_id: str) -> None: tar_path = await asyncio.to_thread(self.build_sample_tar, self.name) content = await asyncio.to_thread(tar_path.read_bytes) diff --git a/docs/cost-service.md b/docs/cost-service.md index 166b302e..5bdf6083 100644 --- a/docs/cost-service.md +++ b/docs/cost-service.md @@ -52,15 +52,15 @@ rads (`csav/registry-service`, Lambdas): - execution-service `POST /run`: `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity` (algorithm lookup and record-count check; actual `ConsumedCapacity.CapacityUnits`). It also stamps the launch epoch into the host user-data. -- execution-service `GET /run/{runId}?algorithmId={algorithmId}` (each poll): `apigateway:request`, `lambda:invocation`, +- execution-service `GET /run/{runId}?algorithmId={algorithmId}` (rads only; secure-rads delivers to a webhook): `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity`. `algorithmId` is required so pending-run polls can be attributed. -- executor host (user-data, both trees): `s3:get` (artifact; rads also the host tools), `sqs:send` (result), +- executor host (user-data): `s3:get` (artifact; rads also the host tools), `sqs:send` (rads result only), `ec2:instance` (seconds from launch to the terminate call). - pdm-service `/records`: `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity` (each records `Query` page). - kms-service `/decrypt` (secure-rads): `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity` (algorithm and data-key `GetItem`s). -- result-consumer (`batchSize` 1, so each run's receive + invoke lands on that run): `sqs:receive` (message +- rads result-consumer (`batchSize` 1, so each run's receive + invoke lands on that run): `sqs:receive` (message bytes), `sqs:delete` (one request when the handler succeeds; Lambda performs the deletion), `dynamodb:write-capacity`, `lambda:invocation`, `lambda:compute`. - verifier-service (secure-rads): `/challenge`, `/attest` and `/refresh` (the enclave's challenge, attestation and @@ -103,7 +103,7 @@ per-run against Cost Explorer. - log-service, telemetry-service, and cost-service self-cost (ingest API Gateway/Lambda/queue/DynamoDB). - Ongoing storage (S3 EIF/artifact objects, DynamoDB table storage), CloudWatch Logs ingestion/storage, CloudWatch alarms, the persistent CSAV host, and data transfer (internet egress, cross-AZ). -- SQS queue-cost of result delivery is metered as `sqs:send`, `sqs:receive`, and `sqs:delete`. Receive requests +- rads result delivery SQS cost is metered as `sqs:send`, `sqs:receive`, and `sqs:delete`. Receive requests that invoke the handler with an attributable result are counted, including redeliveries; idle polling, empty receives, and messages without parseable run identifiers cannot be attributed to a run. - Attributed DynamoDB events use each response's `ConsumedCapacity.CapacityUnits`; an invalid verifier refresh lookup diff --git a/docs/deploy.md b/docs/deploy.md index 8184bf49..ff3aea40 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -14,7 +14,7 @@ The lists below reflect the dependency order the script uses. | Tree | Units | | --- | --- | -| `secure` | storage, verifier-service, result-consumer, log-service, telemetry-service, cost-service, pdm-service, kms-service, csav, execution-service, registry-image, transparency-portal | +| `secure` | storage, verifier-service, log-service, telemetry-service, cost-service, pdm-service, kms-service, csav, execution-service, registry-image, transparency-portal | | `rads` | result-consumer, log-service, telemetry-service, cost-service, pdm-service, registry-service, execution-service, transparency-portal | A full tree deploy runs every unit. Named units deploy only what you name; dependencies are not diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 8c37da09..01f7a627 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -34,7 +34,7 @@ Input: 6 cost dynamodb:read-capacity // execution-service Query on the PDM table 7 RunInstances(Nitro parent, userdata ← ⟨a, runId, n, key, launchEpoch⟩) 8 emit executor-launched -9 cost apigateway:request + lambda // per control-plane request/poll (GET /run/{runId}?algorithmId=... too) +9 cost apigateway:request + lambda // per control-plane request 10 return runId @@ -50,7 +50,7 @@ Input: 4 cost s3:get // EIF pull 5 EIF ← GET-S3(key) 6 emit artifact-retrieved // direct, auth none -7 start vsock listeners // runInfo :5001, creds :5002 +7 start vsock listeners // runInfo :5001, webhook :8006 8 configure vsock-proxy 9 RUN-ENCLAVE(EIF) 10 emit enclave-launched // direct, auth none @@ -64,7 +64,7 @@ SCE-UNIT(a) Input: a ← algorithm id 1 cfg ← LOAD-RUN-CONFIG() -2 ⟨runId, n⟩ ← READ-RUNINFO(:5001) +2 ⟨runId, n, webhookUrl⟩ ← READ-RUNINFO(:5001) 3 emit enclave-started // no token yet, auth none 4 SEED-ENTROPY from NSM // no AWS cost 5 emit unit-ready // no token yet, auth none @@ -86,11 +86,9 @@ Input: 21 output ← read /data/result.json 22 emit dc-app-completed // on success, else run-failed 23 SIGN result // signature key registered at attestation -24 SEND signed envelope to delivery // webhook: TLS via vsock :8006 - // or SQS: host-role credentials over vsock :5002, TLS to SQS -25 cost sqs:send // SQS path only -26 emit output-sent -27 // on failure: emit run-failed +24 SEND signed envelope to webhook // CA-verified TLS via vsock :8006 +25 emit output-sent +26 // on failure: emit run-failed @@ -107,14 +105,3 @@ Input: // The key policy requires the attestation's PCR0/1/2 and KMS returns CiphertextForRecipient encrypted to // the enclave's ephemeral key: the service never sees plaintext, and only the measured enclave can unwrap. 8 return ciphertext to the enclave - -SECURE-RADS-RESULT-CONSUMER(result) -Input: - result ← processing result returned by the SCE-UNIT -1 SQS delivers result batch; invoke Lambda // receive is billed before the handler runs -2 key ← GET-VERIFIER-RUN-ATTESTATION(result.runId) // verifier GET /runs/{runId} -3 if not VERIFY-SIGNATURE(key, result) then reject -4 persist verified result to DynamoDB -5 cost dynamodb:write-capacity; emit result-persisted -6 cost sqs:receive + lambda:invocation + lambda:compute // reported by handler after processing -7 cost sqs:delete // reported on success; Lambda deletes after return diff --git a/docs/getting-started.md b/docs/getting-started.md index b88a73b1..b8e19142 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -173,12 +173,6 @@ make -C secure/csav/registry-service gen-client-cert --param="publicCertificateArn=$VERIFIER_ATTEST_CERT_ARN") ``` -Deploy the result consumer next because the execution-service stack needs its queue and table. It calls verifier-service's `/runs/{runId}` at runtime, so verifier-service must be deployed first: - -```sh -(cd secure/result-consumer && bun install && bunx serverless deploy --param="region=$REGION") -``` - Upload the truststore, then deploy verifier-service again with its immutable S3 object version: ```sh diff --git a/docs/running.md b/docs/running.md index be551bbe..f9915d4d 100644 --- a/docs/running.md +++ b/docs/running.md @@ -37,13 +37,14 @@ and `AWS_DEFAULT_REGION` as `ap-southeast-2`, and uses the ignored local AWS fil devbox shell make up # start the CSAV EC2 host and wait for registry-service make status # show the CSAV, SCE, and rads stacks -make secure-rads # build, seed, and run all five samples +make secure-rads WEBHOOK_URL=https://dc.example/results # build, seed, and run all five samples make down # stop the CSAV EC2 host when finished ``` `make secure-rads` is a persistent, repeatable fleet: it registers each sample under its fixed -`algorithmId`, seeds its data, and runs it. Building happens before seeding because registration -creates the KMS key used to encrypt each dataset. +`algorithmId`, seeds its data, and fires it at `WEBHOOK_URL`. Building happens before seeding because +registration creates the KMS key used to encrypt each dataset. Secure-rads has no result polling; the +signed result is delivered to the webhook. Useful root targets: @@ -51,7 +52,7 @@ Useful root targets: make secure-rads-ready # start and verify the CSAV host make secure-rads-build-all # build and register all samples make secure-rads-seed # generate and seed all datasets -make secure-rads-run-all # run all samples +make secure-rads-run-all WEBHOOK_URL=... # run all samples; results go to the webhook make benchmark # Exp1/Exp2 size sweep (override REPS= TREES= …) make benchmark-report # export sweep CSV + figures make logs # tail the CSAV host and all Lambda logs @@ -65,7 +66,7 @@ Single app (APP is a secure/samples/ dir, ALGORITHM_ID its fixed id): ```sh make secure-rads-build APP=health-risk-python ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc -make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc +make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc WEBHOOK_URL=https://dc.example/results ``` Export a run's timeline (build through execution) as CSV: diff --git a/packages/common/package.json b/packages/common/package.json index 2844507c..556e362a 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,10 +19,6 @@ "./jwt": { "types": "./src/jwt.ts", "import": "./src/jwt.ts" - }, - "./tls": { - "types": "./src/tls.ts", - "import": "./src/tls.ts" } }, "scripts": { diff --git a/scripts/lib/units.sh b/scripts/lib/units.sh index 396e2166..235c6161 100644 --- a/scripts/lib/units.sh +++ b/scripts/lib/units.sh @@ -4,7 +4,6 @@ units_secure=( secure/storage secure/verifier-service - secure/result-consumer secure/log-service secure/telemetry-service secure/cost-service @@ -30,14 +29,13 @@ units_rads=( declare -A DEPENDS=( [secure/storage]="" [secure/verifier-service]="" - [secure/result-consumer]="" [secure/log-service]="secure/verifier-service" [secure/telemetry-service]="" [secure/cost-service]="" [secure/pdm-service]="secure/verifier-service" [secure/kms-service]="secure/storage secure/pdm-service" [secure/csav]="secure/storage" - [secure/sce/execution-service]="secure/storage secure/result-consumer secure/pdm-service" + [secure/sce/execution-service]="secure/storage secure/pdm-service" [secure/registry-image]="secure/csav secure/kms-service" [secure/transparency-portal]="" [rads/result-consumer]="" @@ -54,11 +52,6 @@ unit_secure_storage() { run make -C secure/csav/registry-service deploy-storage } -unit_secure_result_consumer() { - need TELEMETRY_HOST_SECURE_RADS COST_HOST_SECURE_RADS - sls secure/result-consumer --param="region=$region" -} - unit_secure_log_service() { need LOG_HOST_SECURE_RADS VERIFIER_JWKS_URL VERIFIER_JWKS_PUBKEY_SHA256 local arn @@ -271,7 +264,6 @@ unit_rads_transparency_portal() { deploy_unit() { case "$1" in secure/storage) unit_secure_storage ;; - secure/result-consumer) unit_secure_result_consumer ;; secure/log-service) unit_secure_log_service ;; secure/telemetry-service) unit_secure_telemetry_service ;; secure/cost-service) unit_secure_cost_service ;; diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md deleted file mode 100644 index 3f7fee03..00000000 --- a/secure/result-consumer/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# result-consumer - -Serverless Framework v4, TypeScript. The consumer half of the async run-result flow: an SQS-triggered Lambda that reads enclave run-result messages and writes them to the `RunResults` DynamoDB table (keyed by `RunId`), where execution-service's `GET /run/{runId}` reads them back. - -## Resources - -- `RunResultsQueue` - standard SQS queue sce-unit sends signed run results to. 60s visibility timeout, 14-day retention, redrive to `RunResultsDLQ` after 3 receives. -- `RunResultsDLQ` - dead-letter queue for messages that keep failing. -- `RunResultsTable` - PAY_PER_REQUEST DynamoDB table, PK `RunId`. - -The enclave signs the result fields with the ephemeral key it registered during attestation and sends `{ runId, algorithmId, instanceId?, payload, signature }` itself, where `payload` is base64 of the exact signed JSON bytes. - -For each message the `consume` Lambda: - -1. fetches the run's attestation from verifier-service `GET /runs/{runId}`, pinned to the verifier leaf SPKI; -2. checks the returned `runId` matches the message, then verifies the signature and signed `algorithmId`; -3. `PutItem`s the verified fields (idempotent on `RunId`). - -A message with no valid `runId`, no attested key, or an invalid signature is skipped, not thrown, so it can't block the rest of the batch; it ages out to the DLQ. DynamoDB errors throw so the batch retries. - -Runs created with a `webhookUrl` are delivered to the DC webhook instead and do not produce an SQS message, so `GET /run/{runId}` stays `pending` for those runs. - -When the signature verifies it also writes `result-persisted` to telemetry-service over plain HTTPS. It does not emit host or terminal events; the enclave owns those. - -The stack Outputs (`RunResultsQueueUrl`, `RunResultsQueueArn`, `RunResultsTableName`, `RunResultsTableArn`) are consumed by execution-service. - -Bun is used as the local dev/bundle tool only (`bun install`) - the Lambda itself runs on the standard `nodejs24.x` runtime, no custom Bun runtime layer. - -## Deploy - -Deploy verifier-service first so `GET /runs/{runId}` exists, then set the usual environment: - -```sh -bun install -bunx serverless deploy -``` diff --git a/secure/result-consumer/biome.json b/secure/result-consumer/biome.json deleted file mode 100644 index daa455f2..00000000 --- a/secure/result-consumer/biome.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "$schema": "https://biomejs.dev/schemas/2.5.10/schema.json", - "files": { - "includes": ["src/**/*.ts"] - }, - "formatter": { - "enabled": true, - "indentStyle": "space", - "indentWidth": 2, - "lineWidth": 120 - }, - "linter": { - "enabled": true, - "rules": { - "recommended": true - } - }, - "javascript": { - "formatter": { - "quoteStyle": "double", - "semicolons": "always" - } - } -} diff --git a/secure/result-consumer/bun.lock b/secure/result-consumer/bun.lock deleted file mode 100644 index b45126fd..00000000 --- a/secure/result-consumer/bun.lock +++ /dev/null @@ -1,294 +0,0 @@ -{ - "lockfileVersion": 1, - "configVersion": 1, - "workspaces": { - "": { - "name": "result-consumer", - "dependencies": { - "@aws-sdk/client-dynamodb": "^3.700.0", - "@aws-sdk/client-ssm": "^3.700.0", - "@aws-sdk/lib-dynamodb": "^3.700.0", - "@srads/common": "file:../../packages/common", - }, - "devDependencies": { - "@biomejs/biome": "^2.5.10", - "@types/aws-lambda": "^8.10.152", - "@types/node": "^22.0.0", - "knip": "^6.32.2", - "serverless": "^4.4.0", - "typescript": "^5.7.0", - }, - }, - }, - "packages": { - "@aws-sdk/client-dynamodb": ["@aws-sdk/client-dynamodb@3.1118.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-node": "^3.972.81", "@aws-sdk/dynamodb-codec": "^3.973.44", "@aws-sdk/middleware-endpoint-discovery": "^3.972.30", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-svEO204aN18SV433vZ1+VRCdRrMhQto52pTDOJwkwO5FcydmZa+Ld+lWu0k6OC50Ft4qJb1WrG2lsEno/++lGg=="], - - "@aws-sdk/client-ssm": ["@aws-sdk/client-ssm@3.1169.0", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/credential-provider-node": "^3.972.97", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-EAqUE22l8bOeCPMNxnahMhKrWW2n7siZjVL1rNWWaD9prTTwDbMf2xeaAOqVx5lLOz+3sSuicM6OMY5yYTR1Eg=="], - - "@aws-sdk/core": ["@aws-sdk/core@3.977.9", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@aws-sdk/xml-builder": "^3.972.40", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.33.3", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-reqPFEQrZxDZpeGj4PFMepBeR5LGYHRqq/L0motTzgFkCRBA4rFdaVXDSLYyGHhxVz7sT2PDnPN9CluGSfgyJA=="], - - "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="], - - "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="], - - "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="], - - "@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="], - - "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="], - - "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="], - - "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="], - - "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="], - - "@aws-sdk/dynamodb-codec": ["@aws-sdk/dynamodb-codec@3.973.44", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-eo27HNeBqMAfy9JBQug6ErU6DeG8OmOH6ou8+KmX3/fWdTmWUsHsfisz2tEQOG+GJ57bBC7kC6AjKAjpcxU4QA=="], - - "@aws-sdk/endpoint-cache": ["@aws-sdk/endpoint-cache@3.972.11", "", { "dependencies": { "mnemonist": "0.38.3", "tslib": "^2.6.2" } }, "sha512-8q1ICxcDjHId3bBryuu/j+1L9y5/3uQnwzLDt5j2ElcjZSoWmFtymdJy7OjLrluSMe0Z4mq5bcH4fxBXvlEHfw=="], - - "@aws-sdk/lib-dynamodb": ["@aws-sdk/lib-dynamodb@3.1118.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/util-dynamodb": "^3.996.9", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" }, "peerDependencies": { "@aws-sdk/client-dynamodb": "^3.1118.0" } }, "sha512-xVluK5+wcrxJMWho3V5OKXBFxv1oriVOHprfMTds4kkUw0cPh1oOHIKEj8KP1m8F/dztFMVXfIEbvltxCMlCTQ=="], - - "@aws-sdk/middleware-endpoint-discovery": ["@aws-sdk/middleware-endpoint-discovery@3.972.30", "", { "dependencies": { "@aws-sdk/endpoint-cache": "^3.972.11", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-0hmD7/NG2NoVOVHvUb6rtY5POQYr+/9gdHvrYhIBA1zmCqKOBd5Gz3dL+iZ15FHOJbs/5kLplGoePc8PHTlzYA=="], - - "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.44", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-NhEgryjlBF9w38ZXqGymQV28IhkYa1mKhlbYnqIis57AYwWGVYfUPgg/qC2rLRqOUfblxx++irvju10kVTa8Vw=="], - - "@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.46", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="], - - "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="], - - "@aws-sdk/types": ["@aws-sdk/types@3.974.5", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-LkwLL2BLbC6wNNm4JaH9mbEqBMdOZCct6VAYqhdN4U1xrWM+fUJQEfbHwQgDypapOWTRtlk25akb5afM0P8CIQ=="], - - "@aws-sdk/util-dynamodb": ["@aws-sdk/util-dynamodb@3.996.9", "", { "dependencies": { "tslib": "^2.6.2" }, "peerDependencies": { "@aws-sdk/client-dynamodb": "^3.1111.0" } }, "sha512-16x2tRvl7OYpZ0W/DdFJieFriD13+RvuRBDbe5sj/tCEfK86HSGd7I2s5j0ivz8p6KWGkS+5wKRO9OliJkjUOQ=="], - - "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.40", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-wlFmCIGUlwF4zx/kncw+bmxTQh1HeSJq4mYV/V5cZUSJadDP3kXvGW8Rn21cimj/7y9ju+47oYWXi97vF7czaA=="], - - "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.3.0", "", {}, "sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ=="], - - "@biomejs/biome": ["@biomejs/biome@2.5.10", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.10", "@biomejs/cli-darwin-x64": "2.5.10", "@biomejs/cli-linux-arm64": "2.5.10", "@biomejs/cli-linux-arm64-musl": "2.5.10", "@biomejs/cli-linux-x64": "2.5.10", "@biomejs/cli-linux-x64-musl": "2.5.10", "@biomejs/cli-win32-arm64": "2.5.10", "@biomejs/cli-win32-x64": "2.5.10" }, "bin": { "biome": "bin/biome" } }, "sha512-WRKXARA3kTuiV5sxqTpobJ/I0MVd4vk3pOL6wnp5az4LntFIhWTj1RWZq3DI9PCEN3lXcqy7p5aqUHzvq8AXyQ=="], - - "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.5.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ItCrxKK6SXVT6flYs0qIuBd4AA3TTTl4d66Re6YI2FuGZnN85NmuYNzkiTJUyYw8qBLv69L5zTUB6uyWd++h3Q=="], - - "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.5.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-yLsPU9pAmtChXDu8vhKAzErqe+LeeYuwuUB2FZMkRitsmdodxsYRa9KHrFispsUHzzOu+9HB3nP/TQxyia+Sjw=="], - - "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-VG8uQW/86a1roLaIFvtIbEigxIdzdJ190oGyg1tV7VYeQtOS+x10sflk7WbuXgw91EtZX5DlIIIej1YqkNLlcg=="], - - "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-t1QAKZwQJRB4dvgJSgFiQ4BNfNPChg69BNonz854qLVxnjT3UvDzQg9mbkTJRu35ZqU0Rw10A73J8Urgbg2RPw=="], - - "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-4O6T0eq2heoHZN0a9UX+rWQoxXEBaKf+lRi2hbsGlHneUz9BWXM76nEWMK7Eeq8gzMxR1khQB6BFpAASpeXqGg=="], - - "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-pgDDqp9JybHm2I0KRgzN6i4+lt8xu4iqxUwLzglUMmOmyRTU1AYBGKzh9sNMOtIjah7xoWvKHlLVetvyifzoiQ=="], - - "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.5.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-pxAbxduPO4xq/Cvgaa2lOrs9BB0hEXmmDqfMNP4ZOffGOkUrD1/QGw9UAMpFQpX2P8MqTIIRuQKcmetum4Oa6A=="], - - "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.5.10", "", { "os": "win32", "cpu": "x64" }, "sha512-M+2dgBsl3lXRiTfgPVc2p3anS4Tocojke4rzFLScZ2Y/wmF+36dRb1iHCLiyGqOzQGyTplZH1HnEYviiAqi3nA=="], - - "@emnapi/core": ["@emnapi/core@1.11.2", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA=="], - - "@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="], - - "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], - - "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], - - "@oxc-parser/binding-android-arm-eabi": ["@oxc-parser/binding-android-arm-eabi@0.143.0", "", { "os": "android", "cpu": "arm" }, "sha512-n9uozULWflPqBtdmI8lAabLqGKNgLVNN0ZH8HfgCwpKGNtzRzauB76jTiW/3YLkcA7N1zskpi9GdVnZuu1SAvg=="], - - "@oxc-parser/binding-android-arm64": ["@oxc-parser/binding-android-arm64@0.143.0", "", { "os": "android", "cpu": "arm64" }, "sha512-9BbdjHETk6O3zH/DDid9IgBtF0GlpLabNKN231uraXpRDSfY+iiZxTP5bk1Z63GBownVdhdINFIeddmMz4MzpQ=="], - - "@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.143.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gh+6ecoHUy4/sUcolBl/1qPXKBbYNxFY0Pk0ujgQvINTMSftJY7o4yb8gOkDJPeZeB8+a+u7xTe6umoP8N5HFA=="], - - "@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.143.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-qd1hl2d+lXgHv/VQ/M9qm8TrMC5T4RqDBwtOnl+1D0QMjwcz+8AaB4JSg8STgeag0GP6a6L74XEGAsrTSJWNzQ=="], - - "@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.143.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-M5XXcNa7aOqLPKTR41msfghKu2yQ4xWvCm11/gwU0JzOzHNk5sgW//rVEjJ+LO48+VDAMzXTSzurUVxIDKwozw=="], - - "@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.143.0", "", { "os": "linux", "cpu": "arm" }, "sha512-T/GXusuOkPNQhCQCSBbcU/N8j0rAypuDBl1IyFK+lyYT594XsVz80clPC/OtbSSpBGyJxj8uYEfctxVuxVYoww=="], - - "@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.143.0", "", { "os": "linux", "cpu": "arm" }, "sha512-oKu4RcBlXSqo3OC62dp6YTnQaZIurNDpCX3BnAM3+bJxt7s8J2TJKMnC0UYer1qhlRaDCg6wkTaTw+2IlsZ12w=="], - - "@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.143.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-WJBbD186AZmMGaSIhlktC+rPl8L3peCTXAh88Ih9uEvK0en2mPojGyCGYiL6mHtV1RPV3JyfJW5t6n5hh0lXhA=="], - - "@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.143.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-t1AcYOwEzgceadT4v5e+vaCCb0AncCA3v5AyzfBAz/tMq11qzVccXKzNHtkWdjBsgvTKwRkaUF3QvT4kot8vcQ=="], - - "@oxc-parser/binding-linux-ppc64-gnu": ["@oxc-parser/binding-linux-ppc64-gnu@0.143.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-RsnO/NoD8376LMJq8JS8TwI0ieNaFRTuNe2GVJntQg6gwZNMENZsEbknHdVwjpOmxdGLGodcwaGSbAeRr5Bgjw=="], - - "@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.143.0", "", { "os": "linux", "cpu": "none" }, "sha512-48fSVfR9TZi5CASZFyv0VC6z6BCoeihFsX031mAD/oSH7d9PYsPgIqza7d9mjP7Z2KTEpTFyH6SIu0Ui6R1vdg=="], - - "@oxc-parser/binding-linux-riscv64-musl": ["@oxc-parser/binding-linux-riscv64-musl@0.143.0", "", { "os": "linux", "cpu": "none" }, "sha512-T8CpdD+SfE01DnIOD4HpVxu0ZJOfMJ/VhCvikKfaXAxkZ+9veyLM/D2hpi7Y2hFUyPmVQO3FNZHmYzV/WlVR4g=="], - - "@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.143.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-QLdeMsCcacenPEFsfxnBUDF1y6opyz5+fmOz9bfD5Y7fiGCMupUCuB3KTPQhNwshIG1P9fPqar9MHxuBDd4bwQ=="], - - "@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.143.0", "", { "os": "linux", "cpu": "x64" }, "sha512-659ujfqLy6k7cuH3sbzhd8b+ztSq+i6E2E9pG78Q0BmHjAExfGIdgc8cGgMdwAozDXeZFHkJ+LXYJdWsaGdgyw=="], - - "@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.143.0", "", { "os": "linux", "cpu": "x64" }, "sha512-/Mw/9j4TfZcnKphPrzOE6t4MMknXadcAAuVUlDRTF/ETWB5xOgQvOJV2Mh9We/bWxZdoxaGAdc+hy4GuYwQ2yQ=="], - - "@oxc-parser/binding-openharmony-arm64": ["@oxc-parser/binding-openharmony-arm64@0.143.0", "", { "os": "none", "cpu": "arm64" }, "sha512-8rIKWR2BFuifbIK/1XB9wTaSdtuJ25dlE7ZQYDnEwj/2xH2vHsxnvIjHT3ZjSVuLLwGGlSslIG/fbOJ8TV8rTw=="], - - "@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.143.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-5U9kQYMfRRI6Zq7KDxgbIP0RMnKrfn3gLepRMgJuRkPSUALTiRCk9d/uyhb4lGDjUdzwK7mBkKqhLgzBPCmLpQ=="], - - "@oxc-parser/binding-win32-ia32-msvc": ["@oxc-parser/binding-win32-ia32-msvc@0.143.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-25P7AaHk4R88Yv2XH4gToDVmh0cOu+bEURQU10CRrmvgabfRArSGAP5osmwUKeSUHj0VS50upbpbRWWW/m7mHA=="], - - "@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.143.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ORMh3JE1s6V7ySicdRK7vgaDQnn5o+UHg9ct989PlWHbel8O9ARrmWXM6kZjrBMtNucxNayQ8g69G0VfWzhANw=="], - - "@oxc-project/types": ["@oxc-project/types@0.143.0", "", {}, "sha512-u6JZdLBTLotrNC9Vd6vPssINdzcCzleKAH6EJKImQb7GtYvX5keN2dxkoK44stCc4tffE6QQRtZTXVSzsLUlWA=="], - - "@oxc-resolver/binding-android-arm-eabi": ["@oxc-resolver/binding-android-arm-eabi@11.24.2", "", { "os": "android", "cpu": "arm" }, "sha512-y09e0L0SRI2OA2tUIrjBgoV3eH5hvUKXNkJqXmNo5V2WxIjyC7I7aJfRLMEVpA8yi95f90gFDvO0VMgrDw+vwA=="], - - "@oxc-resolver/binding-android-arm64": ["@oxc-resolver/binding-android-arm64@11.24.2", "", { "os": "android", "cpu": "arm64" }, "sha512-cl4icWaZFnLdg8m6qtnh5rBMuGbxc/ptStFHLeCNwr+2cZjkjNwQu/jYRS0CHlnPecOJMpuS5M6/BH+0J/YkEg=="], - - "@oxc-resolver/binding-darwin-arm64": ["@oxc-resolver/binding-darwin-arm64@11.24.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-At29QEMF6HajbQvgY8K6OXnHD1x9rad74xBEfmCB6ZqCGsdq75aK7tOYcTbOanMy8qdIBrfL3SMr3p/lfSlb9w=="], - - "@oxc-resolver/binding-darwin-x64": ["@oxc-resolver/binding-darwin-x64@11.24.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-A5Kqr1EUj4oIL5CF4WRssq/o5P0Y11cwoFouMRmQ7YnC/A8V93nv1nb7aSU8HwcgmXropjLNkVTl4MN87cu28Q=="], - - "@oxc-resolver/binding-freebsd-x64": ["@oxc-resolver/binding-freebsd-x64@11.24.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-R5xkRBRRz7ceH/P5Jrc6G7FmdUdgpLYyESFAUDVTNQ9K0sGPxcp4ljiwEwEqsvNcQ4sYbMRrWcHHBCu7ksAJVw=="], - - "@oxc-resolver/binding-linux-arm-gnueabihf": ["@oxc-resolver/binding-linux-arm-gnueabihf@11.24.2", "", { "os": "linux", "cpu": "arm" }, "sha512-k/RuYL4L/R58IBn3wT5ma3Wh4k62bp1eYCFRWCmMsasUOqL+H6sW0VGFadEzKWXFFlz+2uIMoeMk9ySSZJHgbg=="], - - "@oxc-resolver/binding-linux-arm-musleabihf": ["@oxc-resolver/binding-linux-arm-musleabihf@11.24.2", "", { "os": "linux", "cpu": "arm" }, "sha512-bnHAak3ujYfH5pKk4NieFNbvYvernfoQDgwLddbZ3OtMYrem87/qjlA+u+aKG0oZcqSLGCful/6/CEA+aeAgaA=="], - - "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA=="], - - "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw=="], - - "@oxc-resolver/binding-linux-ppc64-gnu": ["@oxc-resolver/binding-linux-ppc64-gnu@11.24.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA=="], - - "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw=="], - - "@oxc-resolver/binding-linux-riscv64-musl": ["@oxc-resolver/binding-linux-riscv64-musl@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w=="], - - "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.24.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ=="], - - "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg=="], - - "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw=="], - - "@oxc-resolver/binding-openharmony-arm64": ["@oxc-resolver/binding-openharmony-arm64@11.24.2", "", { "os": "none", "cpu": "arm64" }, "sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg=="], - - "@oxc-resolver/binding-wasm32-wasi": ["@oxc-resolver/binding-wasm32-wasi@11.24.2", "", { "dependencies": { "@emnapi/core": "1.11.2", "@emnapi/runtime": "1.11.2", "@napi-rs/wasm-runtime": "^1.1.6" }, "cpu": "none" }, "sha512-vHcssMPwO08RTvj/c0iOBz90attxyG3wQJ0dTcyEQK43LRpcdLWZlV5feBhv6Isn6ahbQIzHbCgfa81+RiML0Q=="], - - "@oxc-resolver/binding-win32-arm64-msvc": ["@oxc-resolver/binding-win32-arm64-msvc@11.24.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-uokJqro2iBqkFvJdKQLP7d8/BUmFwESQFVmIJUQKj1Xn1a/LysJoe1vmeECLF5b3jsV8CAL5sEMJXX6SdK9Nhg=="], - - "@oxc-resolver/binding-win32-x64-msvc": ["@oxc-resolver/binding-win32-x64-msvc@11.24.2", "", { "os": "win32", "cpu": "x64" }, "sha512-UqGPmo56KDfLlfXFAFIrNflHT8tFxWGEivWg3Zeyp4Uy2NlKN1FGPr6/BxcLGG3+kZ6Wp14g5Uj+n71boqZfiw=="], - - "@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="], - - "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.5.2", "", { "dependencies": { "@smithy/core": "^3.33.2", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg=="], - - "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.7.2", "", { "dependencies": { "@smithy/core": "^3.33.2", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-nZyWTmSpJEXl6VtWVMBJve/7x12DZu6sIX1z1a+ZMaHlQQRs9Zpu6NbTe/gmxYXVRpkjxyDYpZ5gx2IM6f/Wkw=="], - - "@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="], - - "@smithy/signature-v4": ["@smithy/signature-v4@5.7.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-7ImGm+FkHRLcBaRttIAMZ6bzJZWb2cJGoYjq46F2UjycujWzrL9GEN9h4w7eQyXJYnltrUhxbbieBAIRrdqpow=="], - - "@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="], - - "@srads/common": ["@srads/common@file:../../packages/common", { "devDependencies": { "@biomejs/biome": "^2.5.10", "@types/node": "^22.0.0", "typescript": "^5.7.0" } }], - - "@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], - - "@types/aws-lambda": ["@types/aws-lambda@8.10.162", "", {}, "sha512-Fn658grtLOci1oxi1391vvDWJRKNGWRSqfxRkmN/Iy3c0tQH1USMKEXcPYHLvope+ZgTFocx9FRQJx1muBL6qw=="], - - "@types/node": ["@types/node@22.20.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q=="], - - "bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="], - - "fd-package-json": ["fd-package-json@2.0.0", "", { "dependencies": { "walk-up-path": "^4.0.0" } }, "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ=="], - - "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], - - "formatly": ["formatly@0.3.0", "", { "dependencies": { "fd-package-json": "^2.0.0" }, "bin": { "formatly": "bin/index.mjs" } }, "sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w=="], - - "get-tsconfig": ["get-tsconfig@4.14.1", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-Dz/6HxkrxgNehhxLVeyv8sad9UzF2xBVeaKBQNDfJ5XiSXmp2gTR0eO0RWiT2NCKS5aGP9jjkOMggTN90qU50A=="], - - "jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], - - "knip": ["knip@6.32.3", "", { "dependencies": { "fdir": "^6.5.0", "formatly": "^0.3.0", "get-tsconfig": "4.14.1", "jiti": "^2.7.0", "oxc-parser": "^0.143.0", "oxc-resolver": "11.24.2", "picomatch": "^4.0.5", "smol-toml": "^1.7.1", "strip-json-comments": "5.0.3", "tinyglobby": "^0.2.17", "unbash": "^4.0.9", "yaml": "^2.9.0", "zod": "^4.4.3" }, "bin": { "knip": "bin/knip.js", "knip-bun": "bin/knip-bun.js" } }, "sha512-wOJ1Av8PwKqFO0wU7F64vzIcUjxhrieA3Tc2lmeK9C9prpxq+TeG2ewNH5tCaBVZwXNPp6lJkrr+IhZ20iqkMA=="], - - "mnemonist": ["mnemonist@0.38.3", "", { "dependencies": { "obliterator": "^1.6.1" } }, "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw=="], - - "obliterator": ["obliterator@1.6.1", "", {}, "sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig=="], - - "oxc-parser": ["oxc-parser@0.143.0", "", { "dependencies": { "@oxc-project/types": "^0.143.0" }, "optionalDependencies": { "@oxc-parser/binding-android-arm-eabi": "0.143.0", "@oxc-parser/binding-android-arm64": "0.143.0", "@oxc-parser/binding-darwin-arm64": "0.143.0", "@oxc-parser/binding-darwin-x64": "0.143.0", "@oxc-parser/binding-freebsd-x64": "0.143.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.143.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.143.0", "@oxc-parser/binding-linux-arm64-gnu": "0.143.0", "@oxc-parser/binding-linux-arm64-musl": "0.143.0", "@oxc-parser/binding-linux-ppc64-gnu": "0.143.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.143.0", "@oxc-parser/binding-linux-riscv64-musl": "0.143.0", "@oxc-parser/binding-linux-s390x-gnu": "0.143.0", "@oxc-parser/binding-linux-x64-gnu": "0.143.0", "@oxc-parser/binding-linux-x64-musl": "0.143.0", "@oxc-parser/binding-openharmony-arm64": "0.143.0", "@oxc-parser/binding-win32-arm64-msvc": "0.143.0", "@oxc-parser/binding-win32-ia32-msvc": "0.143.0", "@oxc-parser/binding-win32-x64-msvc": "0.143.0" } }, "sha512-ov0NzaDCOInknS7mP1cwKdJERt3utPW8ldjtdUXQ8Ty0GEFD08wk422vCUN0d7pST6kqtV7dxoI9w1Zi0l/9TA=="], - - "oxc-resolver": ["oxc-resolver@11.24.2", "", { "optionalDependencies": { "@oxc-resolver/binding-android-arm-eabi": "11.24.2", "@oxc-resolver/binding-android-arm64": "11.24.2", "@oxc-resolver/binding-darwin-arm64": "11.24.2", "@oxc-resolver/binding-darwin-x64": "11.24.2", "@oxc-resolver/binding-freebsd-x64": "11.24.2", "@oxc-resolver/binding-linux-arm-gnueabihf": "11.24.2", "@oxc-resolver/binding-linux-arm-musleabihf": "11.24.2", "@oxc-resolver/binding-linux-arm64-gnu": "11.24.2", "@oxc-resolver/binding-linux-arm64-musl": "11.24.2", "@oxc-resolver/binding-linux-ppc64-gnu": "11.24.2", "@oxc-resolver/binding-linux-riscv64-gnu": "11.24.2", "@oxc-resolver/binding-linux-riscv64-musl": "11.24.2", "@oxc-resolver/binding-linux-s390x-gnu": "11.24.2", "@oxc-resolver/binding-linux-x64-gnu": "11.24.2", "@oxc-resolver/binding-linux-x64-musl": "11.24.2", "@oxc-resolver/binding-openharmony-arm64": "11.24.2", "@oxc-resolver/binding-wasm32-wasi": "11.24.2", "@oxc-resolver/binding-win32-arm64-msvc": "11.24.2", "@oxc-resolver/binding-win32-x64-msvc": "11.24.2" } }, "sha512-FY91FiDBj7ls5MsFS9jN3tjz2o0/zsdSsymlakySaBwVJZorHhkWyICLZMKxlu1R9vYo+sd3z1jwb4J8x7bNDw=="], - - "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], - - "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], - - "serverless": ["serverless@4.41.1", "", { "dependencies": { "undici": "6.28.0" }, "bin": { "sls": "run.js", "serverless": "run.js" } }, "sha512-vjnXUv8RDgzpaVZnrNRIBui9C2injCn6xWt5toUHNvLPPmvy5ECZuS38AENbBTw+2a8WTfmmWz7ob24vi7TJrA=="], - - "smol-toml": ["smol-toml@1.8.0", "", {}, "sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ=="], - - "strip-json-comments": ["strip-json-comments@5.0.3", "", {}, "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw=="], - - "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], - - "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], - - "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], - - "unbash": ["unbash@4.0.10", "", {}, "sha512-b7zoBQvpWp0vuN5q2vK2RRBR2SvuruQAs50DApdDveBSn3eSYd84IaHodFqQIMlvY9K2VnyBUEXgwOBuGU9GBg=="], - - "undici": ["undici@6.28.0", "", {}, "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA=="], - - "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], - - "walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], - - "yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="], - - "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="], - - "@aws-sdk/client-ssm/@aws-sdk/core": ["@aws-sdk/core@3.981.0", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@aws-sdk/xml-builder": "^3.972.43", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.40.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-Mnu7gaDrC5UCdyH8uLxLfB2eWbjE/HbjKX1U1J2VQxG3TTATUDObW2wU3I8iH3e9YH5NN2CY6w1mlAIe2XJ3jg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.97", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.84", "@aws-sdk/credential-provider-http": "^3.972.86", "@aws-sdk/credential-provider-ini": "^3.973.30", "@aws-sdk/credential-provider-process": "^3.972.84", "@aws-sdk/credential-provider-sso": "^3.973.28", "@aws-sdk/credential-provider-web-identity": "^3.972.90", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-E4a0IXXJVsIdo/K9roX4JAEfI0JJr7KTPymkbKgETRDqEcLygE4ZlLTe24+7Qkh8Dl5YpnPd+Tt0DOPJDFXIwA=="], - - "@aws-sdk/client-ssm/@aws-sdk/types": ["@aws-sdk/types@3.975.1", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-7rGxUkCB2QPoQOeJmonmAICTN2zrH+fpmi1p4Iwu72lnxNaMhOgqcbpyddifnM1DBb19TWQ1u6z/XjkaFNEDWw=="], - - "@aws-sdk/client-ssm/@smithy/core": ["@smithy/core@3.40.0", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-DssGno52pzZ5m6RlDtyKuBIpZNPg9pqgs0CnNDKz9IatxCsmvNmJNn5Zn6rf77MthZo9wf89OvZFhTY/RwxhxQ=="], - - "@aws-sdk/client-ssm/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.1", "", { "dependencies": { "@smithy/core": "^3.39.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-h8BdMUrUBhMhMaeK7QqAdINRZezCGuYOCpcOZZ1ewxbHST9rdTd09xwNpvLTYfzDRehxQiReK4SKbdYZxBA+ew=="], - - "@aws-sdk/client-ssm/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.2", "", { "dependencies": { "@smithy/core": "^3.39.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-i1uORV1v3qBqP43ayRKzIdm1q5x14tf8N4Dd06/QUX1Szm6VxHMrTsu20X5E63UFsaNZCRjI4SXG0jDmqYa+3w=="], - - "@aws-sdk/client-ssm/@smithy/types": ["@smithy/types@4.20.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-lCA6QG22dPk9ecHbv91jDQZsmtPUjdS1aE2Il6NNPqe7DrYc0dZQi6DhcESk2KYXH2sp5xbAcGdYMZDFnuzA2A=="], - - "@aws-sdk/client-ssm/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.43", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-rG8QVx4DOrJWptsogu1Aq+CDsnPKaBrAlJpKLxrJrIDXAq1ElnW0yQjjBnlWSXll0cDakCG6UDvaqwz0A9d9Og=="], - - "@aws-sdk/client-ssm/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.84", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-akZJetiMVeLRHsKzYh3LamDCo74ZUCeo0XoyRKMEMZT5qP7ReM6LhpioBCyuqKP5Vav5gEOeCmaQV0VVQr1Meg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-U4mHaDRPWAn63yhl7FXIzbppNmW1F+4dSLeuiUpej2v3Xb6rGwvayEJ8SdlrdMV+/mZtd+GStTEP2HqurEzXtw=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.30", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/credential-provider-env": "^3.972.84", "@aws-sdk/credential-provider-http": "^3.972.86", "@aws-sdk/credential-provider-login": "^3.972.92", "@aws-sdk/credential-provider-process": "^3.972.84", "@aws-sdk/credential-provider-sso": "^3.973.28", "@aws-sdk/credential-provider-web-identity": "^3.972.90", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-r6r6499GWoGN943NA5YEhBEQ6TEOGTf7tTOBhHd/zw0UbNvSzd1/zPCNcDkPmRarA+e24X7KgxutqxjoWcskBg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.84", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-199C6OpNejd0nq9GFAkEFIKids1FL0R6LJtL9c1OTiDOXki7S1OduuPxW4+hE0LwndcYJ7YHOuYTlqScfpCocA=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.28", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/token-providers": "3.1166.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-bGg7wH8wVDJQIcJggO9lg1ZYbG7l+PbLwHuM3Bi/e1TlCZhU712JS1W3tdRpyptdJD1UGyhBNGO/YrhrQCHKbg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.90", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-duLeE3xlf0viHeH+1RM4z5duR3b32BCZTWVMu+MbxFPjQBxy7hmIGEqt5hekuFPRuXoyhMovjNl+PNNsb5oiGQ=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.92", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-96bcp9Pe/Xd60OEwncZ+kAQTQSu+fJnpUGz1qE6ghF5jnETmrk8XMU86mIP3lolvnCgR61XbZ+Ht6hdBjiQOmQ=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1166.0", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-ngJ8mxXqtQ9mnp7QV6TWKJCxkpjVfPWxKQSc2FYhCyCfOVFIGdFv7P+/RqVffFrJAorwBPpktnv32gNlcEgF4g=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], - - "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], - } -} diff --git a/secure/result-consumer/knip.json b/secure/result-consumer/knip.json deleted file mode 100644 index 0fbf4f39..00000000 --- a/secure/result-consumer/knip.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://unpkg.com/knip@6/schema.json", - "entry": [ - "src/handlers/*.ts" - ], - "project": [ - "src/**/*.ts" - ], - "ignoreDependencies": [ - "@aws-sdk/client-ssm" - ] -} diff --git a/secure/result-consumer/package.json b/secure/result-consumer/package.json deleted file mode 100644 index c6f11583..00000000 --- a/secure/result-consumer/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "result-consumer", - "version": "0.1.0", - "private": true, - "type": "module", - "scripts": { - "deploy": "serverless deploy", - "remove": "serverless remove", - "typecheck": "tsc --noEmit", - "lint": "biome check src", - "lint:fix": "biome check --write src", - "knip": "knip" - }, - "devDependencies": { - "@biomejs/biome": "^2.5.10", - "@types/aws-lambda": "^8.10.152", - "@types/node": "^22.0.0", - "knip": "^6.32.2", - "serverless": "^4.4.0", - "typescript": "^5.7.0" - }, - "dependencies": { - "@aws-sdk/client-dynamodb": "^3.700.0", - "@aws-sdk/lib-dynamodb": "^3.700.0", - "@srads/common": "file:../../packages/common", - "@aws-sdk/client-ssm": "^3.700.0" - } -} diff --git a/secure/result-consumer/serverless.yml b/secure/result-consumer/serverless.yml deleted file mode 100644 index 15c4e43c..00000000 --- a/secure/result-consumer/serverless.yml +++ /dev/null @@ -1,69 +0,0 @@ -service: secure-rads-result-consumer - -# Bundled as CJS, not ESM, same as pdm-service - esbuild's ESM output can't interop with plain -# top-level require() in some deps, and nothing here actually needs ESM at runtime. -build: - esbuild: - format: cjs - outExtension: - ".js": ".cjs" - -provider: - name: aws - runtime: nodejs24.x - region: ${env:AWS_REGION} - iam: - role: - statements: - - Effect: Allow - Action: dynamodb:PutItem - Resource: !GetAtt RunResultsTable.Arn - environment: - RUN_RESULTS_TABLE: !Ref RunResultsTable - VERIFIER_ATTEST_HOST: ${env:VERIFIER_ATTEST_HOST} - VERIFIER_ATTEST_PUBKEY_SHA256: ${env:VERIFIER_PUBKEY_SHA256} - TELEMETRY_HOST: ${env:TELEMETRY_HOST_SECURE_RADS} - COST_HOST: ${env:COST_HOST_SECURE_RADS} - -functions: - consume: - handler: src/handlers/consume.handler - events: - - sqs: - arn: !GetAtt RunResultsQueue.Arn - batchSize: 1 - -resources: - Resources: - RunResultsQueue: - Type: AWS::SQS::Queue - Properties: - VisibilityTimeout: 60 - MessageRetentionPeriod: 1209600 - RedrivePolicy: - deadLetterTargetArn: !GetAtt RunResultsDLQ.Arn - maxReceiveCount: 3 - - RunResultsDLQ: - Type: AWS::SQS::Queue - - RunResultsTable: - Type: AWS::DynamoDB::Table - Properties: - BillingMode: PAY_PER_REQUEST - AttributeDefinitions: - - AttributeName: RunId - AttributeType: S - KeySchema: - - AttributeName: RunId - KeyType: HASH - - Outputs: - RunResultsQueueUrl: - Value: !Ref RunResultsQueue - RunResultsQueueArn: - Value: !GetAtt RunResultsQueue.Arn - RunResultsTableName: - Value: !Ref RunResultsTable - RunResultsTableArn: - Value: !GetAtt RunResultsTable.Arn diff --git a/secure/result-consumer/src/handlers/consume.ts b/secure/result-consumer/src/handlers/consume.ts deleted file mode 100644 index f92750eb..00000000 --- a/secure/result-consumer/src/handlers/consume.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; -import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb"; -import { CostPhase, costEvent, recordLambda } from "@srads/common/cost"; -import { requiredEnv } from "@srads/common/env"; -import { emitEvent } from "@srads/common/log"; -import type { SQSHandler, SQSRecord } from "aws-lambda"; -import { fetchRunAttestation } from "../lib/attestation.js"; -import { type SignedResultMessage, verifySignedResult } from "../lib/verify.js"; - -const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); -const table = requiredEnv("RUN_RESULTS_TABLE"); -const verifierAttestHost = requiredEnv("VERIFIER_ATTEST_HOST"); -const verifierAttestPin = requiredEnv("VERIFIER_ATTEST_PUBKEY_SHA256"); - -function messageId(record: SQSRecord): { algorithmId: string; runId: string } | undefined { - try { - const message = JSON.parse(record.body) as SignedResultMessage; - if (typeof message.algorithmId === "string" && typeof message.runId === "string") { - return { algorithmId: message.algorithmId, runId: message.runId }; - } - } catch { - return undefined; - } - return undefined; -} - -// Consumes enclave run-result messages off RunResultsQueue and persists them to the RunResults table, -// where execution-service's GET /run/{runId} reads them back. The batch's records are handled concurrently. -async function persist(record: SQSRecord): Promise { - let message: SignedResultMessage; - try { - message = JSON.parse(record.body) as SignedResultMessage; - } catch { - console.error("skipping message with invalid JSON", record.messageId); - return; - } - // A malformed message shouldn't poison the batch and block good ones - skip it, let it age to the DLQ. - if (typeof message.runId !== "string") { - console.error("skipping message with missing/invalid runId", record.messageId); - return; - } - - const attested = await fetchRunAttestation(verifierAttestHost, verifierAttestPin, message.runId); - if (!attested || attested.runId !== message.runId) { - console.error("skipping result with no matching run attestation", message.runId); - return; - } - - const result = verifySignedResult(message, attested.algorithmId, attested.publicKey); - if (!result) { - console.error("skipping result with invalid signature", message.runId); - return; - } - - const item = { - RunId: result.runId, - InstanceId: typeof message.instanceId === "string" ? message.instanceId : undefined, - AlgorithmId: result.algorithmId, - Status: result.status, - Output: result.output, - Diag: result.diag, - ReceivedAt: new Date().toISOString(), - }; - - // PutItem is idempotent on RunId, so a batch retry on a DynamoDB error is safe. - const write = await ddb.send(new PutCommand({ TableName: table, Item: item, ReturnConsumedCapacity: "TOTAL" })); - - await costEvent( - result.algorithmId, - result.runId, - CostPhase.Execution, - "dynamodb", - "write-capacity", - write.ConsumedCapacity?.CapacityUnits ?? 0, - ); - await emitEvent(result.algorithmId, result.runId, "result-persisted", { status: result.status }); -} - -export const handler: SQSHandler = async (event) => { - const startedAt = process.hrtime.bigint(); - const first = event.Records.map(messageId).find((ids) => ids !== undefined); - try { - await Promise.all(event.Records.map(persist)); - } finally { - if (first) { - // batchSize is 1 so this message can be charged its SQS receive and Lambda costs. - const bytes = event.Records.reduce((total, record) => total + Buffer.byteLength(record.body), 0); - await costEvent(first.algorithmId, first.runId, CostPhase.Execution, "sqs", "receive", Math.max(1, bytes)); - await recordLambda(first.algorithmId, first.runId, CostPhase.Execution, startedAt); - } - } - - if (first) await costEvent(first.algorithmId, first.runId, CostPhase.Execution, "sqs", "delete", 1); -}; diff --git a/secure/result-consumer/src/lib/attestation.ts b/secure/result-consumer/src/lib/attestation.ts deleted file mode 100644 index aba57218..00000000 --- a/secure/result-consumer/src/lib/attestation.ts +++ /dev/null @@ -1,47 +0,0 @@ -import https from "node:https"; -import { pinnedServerIdentity } from "@srads/common/tls"; - -export interface RunAttestation { - runId: string; - algorithmId: string; - publicKey: string; -} - -// Fetches the key verifier-service bound to this run during attestation. The response is pinned to the -// verifier leaf SPKI, the same way downstream services pin the JWKS endpoint. -export function fetchRunAttestation( - host: string, - pinSha256: string, - runId: string, -): Promise { - const checkServerIdentity = pinnedServerIdentity(pinSha256, "verifier attestation server"); - const url = new URL(`https://${host}/runs/${encodeURIComponent(runId)}`); - - return new Promise((resolve, reject) => { - https - .get(url, { rejectUnauthorized: true, checkServerIdentity }, async (res) => { - try { - const chunks: Buffer[] = []; - for await (const chunk of res) chunks.push(chunk as Buffer); - if (res.statusCode === 404) { - resolve(undefined); - return; - } - if (res.statusCode !== 200) throw new Error(`run attestation fetch returned ${res.statusCode}`); - - const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record; - if ( - typeof parsed.runId !== "string" || - typeof parsed.algorithmId !== "string" || - typeof parsed.publicKey !== "string" - ) { - throw new Error("unexpected run attestation response shape"); - } - resolve({ runId: parsed.runId, algorithmId: parsed.algorithmId, publicKey: parsed.publicKey }); - } catch (err) { - reject(err); - } - }) - .on("error", reject); - }); -} diff --git a/secure/result-consumer/src/lib/verify.ts b/secure/result-consumer/src/lib/verify.ts deleted file mode 100644 index 0bea0206..00000000 --- a/secure/result-consumer/src/lib/verify.ts +++ /dev/null @@ -1,80 +0,0 @@ -import { createPublicKey, verify as verifySignature } from "node:crypto"; - -const SIGNATURE_CONTEXT = "sce-result-v1\n"; - -export interface SignedResultMessage { - runId?: unknown; - algorithmId?: unknown; - instanceId?: unknown; - payload?: unknown; - signature?: unknown; -} - -export interface VerifiedResult { - runId: string; - algorithmId: string; - status: string; - output: string; - diag: unknown; -} - -interface ResultPayload { - runId: string; - algorithmId: string; - status: string; - output: string; - diag?: unknown; -} - -function isResultPayload(value: unknown): value is ResultPayload { - if (typeof value !== "object" || value === null) return false; - const payload = value as Record; - return ( - typeof payload.runId === "string" && - typeof payload.algorithmId === "string" && - typeof payload.status === "string" && - typeof payload.output === "string" - ); -} - -// The enclave signs the exact payload bytes it sent, so verification never depends on JSON re-serialization. -export function verifySignedResult( - message: SignedResultMessage, - attestedAlgorithmId: string, - publicKeyBase64: string, -): VerifiedResult | undefined { - if ( - typeof message.runId !== "string" || - typeof message.payload !== "string" || - typeof message.signature !== "string" - ) { - return undefined; - } - - let payload: unknown; - try { - payload = JSON.parse(Buffer.from(message.payload, "base64").toString("utf8")); - } catch { - return undefined; - } - if (!isResultPayload(payload)) return undefined; - if (payload.runId !== message.runId || payload.algorithmId !== attestedAlgorithmId) return undefined; - - try { - const payloadBytes = Buffer.from(message.payload, "base64"); - const key = createPublicKey({ key: Buffer.from(publicKeyBase64, "base64"), format: "der", type: "spki" }); - const signature = Buffer.from(message.signature, "base64"); - const signedBytes = Buffer.concat([Buffer.from(SIGNATURE_CONTEXT), payloadBytes]); - if (!verifySignature("sha256", signedBytes, { key, dsaEncoding: "der" }, signature)) return undefined; - } catch { - return undefined; - } - - return { - runId: payload.runId, - algorithmId: payload.algorithmId, - status: payload.status, - output: payload.output, - diag: payload.diag ?? null, - }; -} diff --git a/secure/result-consumer/tsconfig.json b/secure/result-consumer/tsconfig.json deleted file mode 100644 index 16a7162b..00000000 --- a/secure/result-consumer/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2022", - "module": "ES2022", - "moduleResolution": "bundler", - "strict": true, - "esModuleInterop": true, - "skipLibCheck": true, - "noEmit": true - }, - "include": ["src/**/*.ts"] -} diff --git a/secure/sce-unit/README.md b/secure/sce-unit/README.md index da342507..308955be 100644 --- a/secure/sce-unit/README.md +++ b/secure/sce-unit/README.md @@ -8,11 +8,9 @@ PDM records, writes `records.json` under the DC rootfs `/data` (JSON shape `RECORDS_PATH` / `RESULT_PATH` set, reads the DC app's `result.json`, then signs the result fields with the ephemeral key it registered during attestation. -Delivery depends on the run: if the run requested a webhook, sce-unit POSTs the -signed envelope to it over CA-verified TLS through a per-run vsock-proxy. Otherwise -it sends the envelope to the run-results SQS queue using credentials the parent -serves over vsock (port 5002). In both paths the signature, not the transport, is -what keeps a compromised host from forging a result. +sce-unit POSTs the signed envelope to the run's DC webhook over CA-verified TLS +through a per-run vsock-proxy. The signature, not the transport, is what keeps a +compromised host from forging a result. PDM returns a standalone `dataSubjectIds` list aligned with the records. sce-unit keeps those ids in memory, writes `records.json` without them, and after a diff --git a/secure/sce-unit/creds.go b/secure/sce-unit/creds.go deleted file mode 100644 index 567d63cf..00000000 --- a/secure/sce-unit/creds.go +++ /dev/null @@ -1,41 +0,0 @@ -package main - -import ( - "encoding/json" - "fmt" - "io" - "time" - - "github.com/mdlayher/vsock" -) - -// The enclave has no IMDS and no user-data, so its AWS credentials come from the parent host, which serves -// fresh IMDSv2 role credentials over vsock (port 5002, see userdata.sh.tmpl). The host holds the same role, -// so this gives the enclave no capability the host lacks - it only lets sce-unit send the result itself. -const hostCredsPort = 5002 - -type awsCreds struct { - AccessKeyID string `json:"accessKeyId"` - SecretAccessKey string `json:"secretAccessKey"` - SessionToken string `json:"sessionToken"` -} - -func fetchAWSCreds() (awsCreds, error) { - conn, err := vsock.Dial(hostCID, hostCredsPort, nil) - if err != nil { - return awsCreds{}, fmt.Errorf("dial host creds vsock: %w", err) - } - defer conn.Close() - if err := conn.SetDeadline(time.Now().Add(10 * time.Second)); err != nil { - return awsCreds{}, err - } - data, err := io.ReadAll(io.LimitReader(conn, 1<<16)) - if err != nil { - return awsCreds{}, fmt.Errorf("read host creds: %w", err) - } - var creds awsCreds - if err := json.Unmarshal(data, &creds); err != nil { - return awsCreds{}, fmt.Errorf("parse host creds: %w", err) - } - return creds, nil -} diff --git a/secure/sce-unit/go.mod b/secure/sce-unit/go.mod index 6e826646..81120465 100644 --- a/secure/sce-unit/go.mod +++ b/secure/sce-unit/go.mod @@ -4,10 +4,6 @@ go 1.25.0 require ( github.com/Secure-RADS/st-dp/packages/go-common v0.0.0 - github.com/aws/aws-sdk-go-v2 v1.16.11 - github.com/aws/aws-sdk-go-v2/config v1.17.0 - github.com/aws/aws-sdk-go-v2/credentials v1.12.13 - github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0 github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0 github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9 github.com/mdlayher/vsock v1.3.0 @@ -17,14 +13,6 @@ require ( replace github.com/Secure-RADS/st-dp/packages/go-common => ../../packages/go-common require ( - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 // indirect - github.com/aws/smithy-go v1.12.1 // indirect github.com/fxamacker/cbor/v2 v2.4.0 // indirect github.com/mdlayher/socket v0.6.0 // indirect github.com/x448/float16 v0.8.4 // indirect diff --git a/secure/sce-unit/go.sum b/secure/sce-unit/go.sum index 080ab789..602b5df0 100644 --- a/secure/sce-unit/go.sum +++ b/secure/sce-unit/go.sum @@ -1,32 +1,3 @@ -github.com/aws/aws-sdk-go-v2 v1.16.7/go.mod h1:6CpKuLXg2w7If3ABZCl/qZ6rEgwtjZTn4eAf4RcEyuw= -github.com/aws/aws-sdk-go-v2 v1.16.11 h1:xM1ZPSvty3xVmdxiGr7ay/wlqv+MWhH0rMlyLdbC0YQ= -github.com/aws/aws-sdk-go-v2 v1.16.11/go.mod h1:WTACcleLz6VZTp7fak4EO5b9Q4foxbn+8PIz3PmyKlo= -github.com/aws/aws-sdk-go-v2/config v1.17.0 h1:e0tIuubcjp0gJQdllgEMwolWWXGK/sKAFd1tS5S6m6I= -github.com/aws/aws-sdk-go-v2/config v1.17.0/go.mod h1:4SKzBMiB8lV0fw2w7eDBo/LjQyHFITN4vUUuqpurFmI= -github.com/aws/aws-sdk-go-v2/credentials v1.12.13 h1:cuPzIsjKAWBUAAk8ZUR2l02Sxafl9hiaMsc7tlnjwAY= -github.com/aws/aws-sdk-go-v2/credentials v1.12.13/go.mod h1:9fDEemXizwXrxPU1MTzv69LP/9D8HVl5qHAQO9A9ikY= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12 h1:wgJBHO58Pc1V1QAnzdVM3JK3WbE/6eUF0JxCZ+/izz0= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.12.12/go.mod h1:aZ4vZnyUuxedC7eD4JyEHpGnCz+O2sHQEx3VvAwklSE= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.14/go.mod h1:kdjrMwHwrC3+FsKhNcCMJ7tUVj/8uSD5CZXeQ4wV6fM= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18 h1:OmiwoVyLKEqqD5GvB683dbSqxiOfvx4U2lDZhG2Esc4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.1.18/go.mod h1:348MLhzV1GSlZSMusdwQpXKbhD7X2gbI/TxwAPKkYZQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.8/go.mod h1:ZIV8GYoC6WLBW5KGs+o4rsc65/ozd+eQ0L31XF5VDwk= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12 h1:5mvQDtNWtI6H56+E4LUnLWEmATMB7oEh+Z9RurtIuC0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.4.12/go.mod h1:ckaCVTEdGAxO6KwTGzgskxR1xM+iJW4lxMyDFVda2Fc= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19 h1:g5qq9sgtEzt2szMaDqQO6fqKe026T6dHTFJp5NsPzkQ= -github.com/aws/aws-sdk-go-v2/internal/ini v1.3.19/go.mod h1:cVHo8KTuHjShb9V8/VjH3S/8+xPu16qx8fdGwmotJhE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12 h1:7iPTTX4SAI2U2VOogD7/gmHlsgnYSgoNHt7MSQXtG2M= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.9.12/go.mod h1:1TODGhheLWjpQWSuhYuAUWYTCKwEjx2iblIFKDHjeTc= -github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0 h1:DIfxowLm7VUMqipBd/3y7EGiQTHeAiHelFHEhkRIS+E= -github.com/aws/aws-sdk-go-v2/service/sqs v1.19.0/go.mod h1:p2Kn1XCPZLA5Z+dE859RGRCuP3TUC3pTgU7j1bcj5bY= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.16 h1:YK8L7TNlGwMWHYqLs+i6dlITpxqzq08FqQUy26nm+T8= -github.com/aws/aws-sdk-go-v2/service/sso v1.11.16/go.mod h1:mS5xqLZc/6kc06IpXn5vRxdLaED+jEuaSRv5BxtnsiY= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13 h1:dl8T0PJlN92rvEGOEUiD0+YPYdPEaCZK0TqHukvSfII= -github.com/aws/aws-sdk-go-v2/service/sts v1.16.13/go.mod h1:Ru3QVMLygVs/07UQ3YDur1AQZZp2tUNje8wfloFttC0= -github.com/aws/smithy-go v1.12.0/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/aws/smithy-go v1.12.1 h1:yQRC55aXN/y1W10HgwHle01DRuV9Dpf31iGkotjt3Ag= -github.com/aws/smithy-go v1.12.1/go.mod h1:Tg+OJXh4MB2R/uN61Ko2f6hTZwB/ZYGOtib8J3gBHzA= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0 h1:PkHLQAsU3gMDb5Q+3KJeSPOKXFgNNcn0y+/jBYg1cQg= @@ -34,20 +5,16 @@ github.com/edgebitio/nitro-enclaves-sdk-go v1.0.0/go.mod h1:hDAX5hYfgVR/TzewAODj github.com/fxamacker/cbor/v2 v2.2.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= github.com/fxamacker/cbor/v2 v2.4.0 h1:ri0ArlOR+5XunOP8CRUowT0pSJOwhW098ZCUyskZD88= github.com/fxamacker/cbor/v2 v2.4.0/go.mod h1:TA1xS00nchWmaBnEIxPSE5oHLuJBAVvqrtAnWBwBCVo= -github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9 h1:pU32bJGmZwF4WXb9Yaz0T8vHDtIPVxqDOdmYdwTQPqw= github.com/hf/nsm v0.0.0-20220930140112-cd181bd646b9/go.mod h1:MJsac5D0fKcNWfriUERtln6segcGfD6Nu0V5uGBbPf8= -github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= -github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/mdlayher/socket v0.6.0 h1:ScZPaAGyO1icQnbFrhPM8mnXyMu9qukC1K4ZoM2IQKU= github.com/mdlayher/socket v0.6.0/go.mod h1:q7vozUAnxSqnjHc12Fik5yUKIzfZ8ITCfMkhOtE9z18= github.com/mdlayher/vsock v1.3.0 h1:bqQfZ1OznI03y6YiXp2sze05RVdzLn/zsfjnjd4+ivI= github.com/mdlayher/vsock v1.3.0/go.mod h1:WsuksavOvwCnV5UqGHUkvAvCy+Dqy81y4goKQTzxxNY= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= @@ -82,7 +49,5 @@ golang.org/x/tools v0.0.0-20210105210202-9ed45478a130/go.mod h1:emZCQorbCU4vsT4f golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/secure/sce-unit/main.go b/secure/sce-unit/main.go index e1d49c0f..daa1f6b1 100644 --- a/secure/sce-unit/main.go +++ b/secure/sce-unit/main.go @@ -116,7 +116,7 @@ func main() { Status: status, Output: string(output), }); err != nil { - log.Printf("sce-unit: send signed result to SQS failed: %v", err) + log.Printf("sce-unit: send signed result to webhook failed: %v", err) timelineLog.EmitEvent(cfg.AlgorithmId, &runID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) os.Exit(1) } @@ -141,7 +141,7 @@ func failRun(timelineLog *sharedlog.Client, algorithmID string, info runInfo, er if info.RunID != "" { timelineLog.EmitEvent(algorithmID, &info.RunID, sharedlog.EventRunFailed, map[string]any{"error": err.Error()}) } - if info.RunID == "" || info.QueueURL == "" { + if info.RunID == "" || info.WebhookURL == "" { os.Exit(1) } failure, _ := json.Marshal(struct { @@ -154,7 +154,7 @@ func failRun(timelineLog *sharedlog.Client, algorithmID string, info runInfo, er Output: string(append(failure, '\n')), } if sendErr := sendResult(info, payload); sendErr != nil { - log.Printf("sce-unit: send signed failure to SQS failed: %v", sendErr) + log.Printf("sce-unit: send signed failure to webhook failed: %v", sendErr) } os.Exit(1) } diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index f886e1d9..b5df586d 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -45,8 +45,8 @@ func getResultSigner() *ecdsa.PrivateKey { return resultSigner.key } -// sendResult signs the enclave-owned result fields and streams the envelope to the host. The host may add -// instanceId, but it cannot change the signed payload or signature without the consumer rejecting it. +// sendResult signs the enclave-owned result fields and POSTs the envelope to the run's DC webhook. The DC +// verifies the signature against the public key verifier-service recorded at attestation. func sendResult(info runInfo, p resultPayload) error { key := getResultSigner() if key == nil { @@ -73,8 +73,5 @@ func sendResult(info runInfo, p resultPayload) error { if err != nil { return fmt.Errorf("marshal signed result: %w", err) } - if info.WebhookURL != "" { - return sendWebhookResult(info, envelope) - } - return sendSQSResult(info, envelope) + return sendWebhookResult(info, envelope) } diff --git a/secure/sce-unit/runinfo.go b/secure/sce-unit/runinfo.go index 3725f0ea..6cc407c4 100644 --- a/secure/sce-unit/runinfo.go +++ b/secure/sce-unit/runinfo.go @@ -15,14 +15,12 @@ import ( const hostRunIDPort = 5001 // runInfo is the per-run data the host serves on hostRunIDPort: the run id, record limit (0 = whole -// dataset), instance id, region, and run-results queue URL. The enclave takes no user-data, so this is its -// only source for all of them. +// dataset), instance id, and DC webhook URL. The enclave takes no user-data, so this is its only source +// for all of them. type runInfo struct { RunID string `json:"runId"` Size int `json:"size"` InstanceID string `json:"instanceId"` - Region string `json:"region"` - QueueURL string `json:"queueUrl"` WebhookURL string `json:"webhookUrl"` } @@ -71,8 +69,8 @@ func readRunInfo() (runInfo, error) { if info.RunID == "" || info.Size < 0 { return runInfo{}, fmt.Errorf("invalid run-info: runId must be nonempty and size must be nonnegative") } - if info.InstanceID == "" || info.Region == "" || info.QueueURL == "" { - return runInfo{}, fmt.Errorf("invalid run-info: instanceId, region, and queueUrl must be nonempty") + if info.InstanceID == "" || info.WebhookURL == "" { + return runInfo{}, fmt.Errorf("invalid run-info: instanceId and webhookUrl must be nonempty") } return info, nil } diff --git a/secure/sce-unit/sqs.go b/secure/sce-unit/sqs.go deleted file mode 100644 index b7c8ec24..00000000 --- a/secure/sce-unit/sqs.go +++ /dev/null @@ -1,83 +0,0 @@ -package main - -import ( - "context" - "crypto/tls" - "fmt" - "net" - "net/http" - "time" - - "github.com/aws/aws-sdk-go-v2/aws" - "github.com/aws/aws-sdk-go-v2/config" - "github.com/aws/aws-sdk-go-v2/credentials" - "github.com/aws/aws-sdk-go-v2/service/sqs" -) - -// The host forwards this port over vsock to sqs..amazonaws.com:443 (see userdata.sh.tmpl). TLS still -// terminates at the real SQS endpoint, so the host relays bytes but cannot read or change the result. -const sqsProxyPort = 8005 - -const sqsRequestTimeout = 30 * time.Second - -// sendSQSResult writes the already-signed envelope straight to the run-results queue using credentials -// borrowed from the host. The host relays the TLS bytes but cannot read or change the signed payload. -func sendSQSResult(info runInfo, envelope []byte) error { - creds, err := fetchAWSCreds() - if err != nil { - return fmt.Errorf("fetch host credentials: %w", err) - } - - awsCfg, err := config.LoadDefaultConfig(context.Background(), - config.WithRegion(info.Region), - config.WithCredentialsProvider(credentials.NewStaticCredentialsProvider( - creds.AccessKeyID, creds.SecretAccessKey, creds.SessionToken)), - config.WithHTTPClient(vsockSQSHTTPClient(info.Region)), - ) - if err != nil { - return fmt.Errorf("load AWS config: %w", err) - } - - ctx, cancel := context.WithTimeout(context.Background(), sqsRequestTimeout) - defer cancel() - _, err = sqs.NewFromConfig(awsCfg).SendMessage(ctx, &sqs.SendMessageInput{ - QueueUrl: aws.String(info.QueueURL), - MessageBody: aws.String(string(envelope)), - }) - if err != nil { - return fmt.Errorf("sqs send-message: %w", err) - } - return nil -} - -// vsockSQSHTTPClient routes SQS HTTP/TLS through the host's vsock-proxy instead of real TCP. TLS verifies the -// real SQS endpoint certificate through the relay, so a compromised host cannot impersonate SQS. -func vsockSQSHTTPClient(region string) *http.Client { - endpoint := fmt.Sprintf("sqs.%s.amazonaws.com", region) - return &http.Client{ - Timeout: sqsRequestTimeout, - Transport: &http.Transport{ - DisableKeepAlives: true, - DialTLSContext: func(ctx context.Context, _ string, _ string) (net.Conn, error) { - conn, err := dialVsock(ctx, hostCID, sqsProxyPort) - if err != nil { - return nil, err - } - if err := conn.SetDeadline(time.Now().Add(tlsHandshakeTimeout)); err != nil { - conn.Close() - return nil, err - } - tlsConn := tls.Client(conn, &tls.Config{ServerName: endpoint}) - if err := tlsConn.Handshake(); err != nil { - conn.Close() - return nil, err - } - if err := conn.SetDeadline(time.Time{}); err != nil { - tlsConn.Close() - return nil, err - } - return tlsConn, nil - }, - }, - } -} diff --git a/secure/sce/Makefile b/secure/sce/Makefile index 3c747af3..86690058 100644 --- a/secure/sce/Makefile +++ b/secure/sce/Makefile @@ -12,12 +12,6 @@ ALGORITHM_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure --query "Stacks[0].Outputs[?OutputKey=='AlgorithmTableName'].OutputValue" --output text) PDM_MTLS_HOST = $(shell aws cloudformation describe-stacks --stack-name secure-rads-pdm-service-dev --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='PdmMtlsHost'].OutputValue" --output text) -RUN_RESULTS_QUEUE_ARN = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ - --query "Stacks[0].Outputs[?OutputKey=='RunResultsQueueArn'].OutputValue" --output text) -RUN_RESULTS_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ - --query "Stacks[0].Outputs[?OutputKey=='RunResultsTableName'].OutputValue" --output text) -RUN_RESULTS_QUEUE_URL = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ - --query "Stacks[0].Outputs[?OutputKey=='RunResultsQueueUrl'].OutputValue" --output text) API_URL = $(shell aws cloudformation describe-stacks --stack-name $(STACK_NAME) --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='ExecutionApiUrl'].OutputValue" --output text) @@ -30,9 +24,6 @@ deploy: env-check --param="artifactBucket=$(ARTIFACT_BUCKET)" \ --param="algorithmTable=$(ALGORITHM_TABLE)" \ --param="pdmMtlsHost=$(PDM_MTLS_HOST)" \ - --param="runResultsQueueArn=$(RUN_RESULTS_QUEUE_ARN)" \ - --param="runResultsQueueUrl=$(RUN_RESULTS_QUEUE_URL)" \ - --param="runResultsTable=$(RUN_RESULTS_TABLE)" \ --param="enclaveInstanceType=c6g.large" destroy: diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index 5615ba3b..4c247c0a 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -4,24 +4,20 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given `POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. The check calls PDM's `/count` endpoint over mTLS with a client certificate fetched from SSM; this Lambda has no DynamoDB access to PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. -The request accepts an optional `webhookUrl`: +The request requires a webhook URL: ```json { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -The URL must be `https` and must not target localhost or an obvious private/internal address. When present, the enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. The DC verifies the envelope with verifier-service `GET /runs/{runId}`; no SQS message or host credentials are involved, and `GET /run/{runId}` stays `pending` for that run. +The URL must be `https` and must not target localhost or an obvious private/internal address. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. The DC verifies the envelope with verifier-service `GET /runs/{runId}`. There is no result SQS queue or result table. -Without `webhookUrl`, the enclave sends the signed envelope to the run-results SQS queue, borrowing the host instance role over vsock port 5002. The host never builds or publishes results; result-consumer verifies the signature against verifier-service's attested key before writing it to the RunResults table. - -`GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result once the consumer has written it. `algorithmId` is required so every poll can be attributed to its run. - -The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. result-consumer only emits `result-persisted`. SCE-unit and result-consumer emit the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). +The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. SCE-unit emits the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). See [../README.md](../README.md) for the full SCE context. ## Deployment -`make -C sce deploy` deploys the Lambda stack. It requires result-consumer, registry-service storage, and kms-service to exist first. +`make -C sce deploy` deploys the Lambda stack. It requires registry-service storage, verifier-service, and kms-service to exist first. The enclave host pulls the EIF but does not publish the result; it has no algorithm-key KMS permission. Data-key decryption runs in kms-service, so the per-algorithm key policy names the kms-service role rather than this per-deployment host role. `KMS_HOST` is passed as `KMS_SERVICE_HOST` and baked into the host user data, which proxies the enclave's `/decrypt` call. diff --git a/secure/sce/execution-service/serverless.yml b/secure/sce/execution-service/serverless.yml index e6224491..7c7782e4 100644 --- a/secure/sce/execution-service/serverless.yml +++ b/secure/sce/execution-service/serverless.yml @@ -19,9 +19,7 @@ provider: statements: - Effect: Allow Action: dynamodb:GetItem - Resource: - - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:algorithmTable}" - - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:runResultsTable}" + Resource: !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:algorithmTable}" - Effect: Allow Action: ssm:GetParameter Resource: @@ -53,8 +51,6 @@ provider: Resource: !GetAtt EnclaveHostInstanceRole.Arn environment: ALGORITHM_TABLE: ${param:algorithmTable} - RUN_RESULTS_TABLE: ${param:runResultsTable} - RUN_RESULTS_QUEUE_URL: ${param:runResultsQueueUrl} # Pinned to match rads EXECUTOR_AMI_ID so both trees boot the same AL2023 arm64 build. ENCLAVE_AMI_ID: ${env:SCE_ENCLAVE_AMI_ID} ENCLAVE_INSTANCE_TYPE: ${param:enclaveInstanceType, 'c6g.large'} @@ -80,13 +76,6 @@ functions: - httpApi: method: POST path: /run - result: - handler: src/handlers/run.result - timeout: 10 - events: - - httpApi: - method: GET - path: /run/{runId} resources: Resources: @@ -127,14 +116,6 @@ resources: Condition: StringEquals: "ec2:ResourceTag/ManagedBy": secure-rads-execution-service - - PolicyName: SendRunResult - PolicyDocument: - Version: "2012-10-17" - Statement: - - Effect: Allow - Action: sqs:SendMessage - Resource: ${param:runResultsQueueArn} - EnclaveHostInstanceProfile: Type: AWS::IAM::InstanceProfile Properties: diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 413a9ffe..a530da4c 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -12,8 +12,6 @@ import { userData } from "../lib/userdata.js"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const ec2 = new EC2Client({}); const algorithmTable = requiredEnv("ALGORITHM_TABLE"); -const runResultsTable = requiredEnv("RUN_RESULTS_TABLE"); -const runResultsQueueUrl = requiredEnv("RUN_RESULTS_QUEUE_URL"); const enclaveAmiId = requiredEnv("ENCLAVE_AMI_ID"); const enclaveInstanceType = requiredEnv("ENCLAVE_INSTANCE_TYPE") as RunInstancesCommandInput["InstanceType"]; const enclaveAz = requiredEnv("ENCLAVE_AZ"); @@ -31,7 +29,7 @@ const region = requiredEnv("AWS_REGION"); interface RunRequest { algorithmId: string; size?: number; - webhookUrl?: string; + webhookUrl: string; } const PRIVATE_HOST = @@ -59,16 +57,6 @@ interface AlgorithmRecord { RecordCount?: number; } -interface RunResult { - AlgorithmId?: string; - Diag?: unknown; - InstanceId?: string; - Output?: string; - ReceivedAt?: string; - RunId?: string; - Status?: string; -} - function jsonResponse(statusCode: number, body: unknown) { return { statusCode, headers: { "content-type": "application/json" }, body: JSON.stringify(body) }; } @@ -83,12 +71,8 @@ function parseRunRequest(body: string | undefined): RunRequest | undefined { return undefined; } const webhook = parseWebhookUrl(webhookUrl); - if (webhook === null) return undefined; - return { - algorithmId, - ...(size === undefined ? {} : { size }), - ...(webhook === undefined ? {} : { webhookUrl: webhook }), - }; + if (typeof webhook !== "string") return undefined; + return { algorithmId, webhookUrl: webhook, ...(size === undefined ? {} : { size }) }; } catch { return undefined; } @@ -167,7 +151,6 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { telemetryHost, pdmHost, region, - queueUrl: runResultsQueueUrl, runId, s3Bucket: record.S3Bucket, s3Key: record.S3Key, @@ -200,41 +183,3 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { return jsonResponse(500, { error: "launch failed" }); } }; - -export const result: APIGatewayProxyHandlerV2 = async (event) => { - const startedAt = process.hrtime.bigint(); - const runId = event.pathParameters?.runId; - if (!runId) return jsonResponse(400, { error: "runId is required" }); - const algorithmId = event.queryStringParameters?.algorithmId; - if (!algorithmId) return jsonResponse(400, { error: "algorithmId is required" }); - - try { - const response = await ddb.send( - new GetCommand({ TableName: runResultsTable, Key: { RunId: runId }, ReturnConsumedCapacity: "TOTAL" }), - ); - const item = response.Item as RunResult | undefined; - const costAlgorithmId = item?.AlgorithmId ?? algorithmId; - await costEvent( - costAlgorithmId, - runId, - CostPhase.Execution, - "dynamodb", - "read-capacity", - response.ConsumedCapacity?.CapacityUnits ?? 0, - ); - await recordRequest(costAlgorithmId, runId, CostPhase.Execution, startedAt); - if (!item) return jsonResponse(200, { runId, status: "pending" }); - return jsonResponse(200, { - runId: item.RunId, - instanceId: item.InstanceId, - algorithmId: item.AlgorithmId, - status: item.Status, - output: item.Output, - diag: item.Diag, - receivedAt: item.ReceivedAt, - }); - } catch (error) { - console.error("result lookup failed", error); - return jsonResponse(500, { error: "result lookup failed" }); - } -}; diff --git a/secure/sce/execution-service/src/lib/userdata.ts b/secure/sce/execution-service/src/lib/userdata.ts index a926e026..fbdb6a13 100644 --- a/secure/sce/execution-service/src/lib/userdata.ts +++ b/secure/sce/execution-service/src/lib/userdata.ts @@ -16,73 +16,33 @@ export interface UserDataValues { s3Bucket: string; s3Key: string; verifierHost: string; - queueUrl: string; size?: number; - webhookUrl?: string; + webhookUrl: string; } -const credsServer = `# Serve fresh IMDSv2 role credentials to the enclave on port 5002 so it can call SQS. The enclave has no -# IMDS access; the host holds the role. The role also lets the host send to the queue, so result integrity -# still comes from the enclave signature, not from this credential split. -python3 - <<'PYEOF' & -import json, socket, urllib.request -def get(path, token=None): - req = urllib.request.Request("http://169.254.169.254"+path) - if token: - req.add_header("X-aws-ec2-metadata-token", token) - return urllib.request.urlopen(req, timeout=5).read().decode() -s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) -s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) -s.bind((socket.VMADDR_CID_ANY, 5002)) -s.listen(5) -while True: - conn, _ = s.accept() - try: - token = urllib.request.urlopen(urllib.request.Request("http://169.254.169.254/latest/api/token", - data=b"", method="PUT", headers={"X-aws-ec2-metadata-token-ttl-seconds": "21600"}), timeout=5).read().decode() - role = get("/latest/meta-data/iam/security-credentials/", token) - creds = json.loads(get("/latest/meta-data/iam/security-credentials/"+role, token)) - conn.sendall(json.dumps({ - "accessKeyId": creds["AccessKeyId"], - "secretAccessKey": creds["SecretAccessKey"], - "sessionToken": creds["Token"], - }).encode()) - finally: - conn.close() -PYEOF`; - export function userData(values: UserDataValues): string { - const webhook = values.webhookUrl ? new URL(values.webhookUrl) : undefined; - const webhookHost = webhook?.hostname; - const webhookPort = webhook?.port || "443"; + const webhook = new URL(values.webhookUrl); + const webhookPort = webhook.port || "443"; const replacements: Record = { AlgorithmId: values.algorithmId, CostHost: values.costHost, CPUCount: "1", - CredsServer: webhookHost ? "" : credsServer, KmsHost: values.kmsHost, LaunchEpoch: values.launchEpoch.toString(), LogHost: values.logHost, TelemetryHost: values.telemetryHost, MemoryMiB: "2048", PdmHost: values.pdmHost, - QueueUrl: values.queueUrl, Region: values.region, RunId: values.runId, S3Bucket: values.s3Bucket, S3Key: values.s3Key, Size: (values.size ?? 0).toString(), - SqsAllowlist: webhookHost ? "" : ` - {address: "sqs.${values.region}.amazonaws.com", port: 443}`, - SqsProxy: webhookHost - ? "" - : `vsock-proxy 8005 "sqs.${values.region}.amazonaws.com" 443 --config /etc/nitro_enclaves/vsock-proxy.yaml &`, VerifierHost: values.verifierHost, - WebhookAllowlist: webhookHost ? ` - {address: "${webhookHost}", port: ${webhookPort}}` : "", - WebhookProxy: webhookHost - ? `vsock-proxy 8006 "${webhookHost}" ${webhookPort} --config /etc/nitro_enclaves/vsock-proxy.yaml &` - : "", - WebhookURL: values.webhookUrl ?? "", + WebhookAllowlist: ` - {address: "${webhook.hostname}", port: ${webhookPort}}`, + WebhookProxy: `vsock-proxy 8006 "${webhook.hostname}" ${webhookPort} --config /etc/nitro_enclaves/vsock-proxy.yaml &`, + WebhookURL: values.webhookUrl, }; return Object.entries(replacements).reduce( diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index 99afbe07..4f9f3690 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -16,8 +16,8 @@ emit_cost() { -d "{\"algorithmId\":\"{{.AlgorithmId}}\",\"runId\":\"{{.RunId}}\",\"eventId\":\"$(cat /proc/sys/kernel/random/uuid)\",\"phase\":\"execution\",\"service\":\"$1\",\"operation\":\"$2\",\"quantity\":$3,\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)\"}" >/dev/null || true } -# Always self-terminate on exit. sce-unit sends the signed result to SQS itself using credentials served on -# port 5002, so the host no longer builds or publishes results. +# Always self-terminate on exit. sce-unit sends the signed result to the DC webhook itself, so the host +# never builds or publishes results. finish() { set +e TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") @@ -65,7 +65,6 @@ body = json.dumps({ "size": {{.Size}}, "instanceId": sys.argv[1], "region": "{{.Region}}", - "queueUrl": "{{.QueueUrl}}", "webhookUrl": "{{.WebhookURL}}", }).encode() while True: @@ -75,7 +74,6 @@ while True: PYEOF RUNINFO_LISTENER_PID=$! -{{.CredsServer}} # Only way out of the enclave: one vsock-proxy per allowed host forwards vsock traffic over real TCP/TLS, resolving DNS here since the enclave has none. cat > /etc/nitro_enclaves/vsock-proxy.yaml < PCR0/1/2 at build time. - `POST /challenge` (public domain) - sce-unit asks for a single-use nonce before attesting. The row is stored hashed in `AttestationChallengeTable` with a 60 s TTL and is bound to the `algorithmId` and `runId` in the request. -- `POST /attest` (public domain) - sce-unit submits a real Nitro attestation document (base64 COSE_Sign1 bytes) + `algorithmId` + `runId` + the `challenge` it was issued. The document's `nonce` must equal the challenge, and the challenge is consumed atomically before the PCR check, so a captured document cannot be replayed. After the PCR check, the run is claimed in `RunAttestationTable` with a conditional put, so only the first attestation for a `runId` succeeds; later ones get 409. The attestation document's `public_key` is stored on the `RunAttestationTable` row with `AlgorithmId`; result-consumer uses it to verify signed run results. Verified against the pinned AWS Nitro root cert chain and the registered PCRs; on success, issues a signed access JWT + opaque refresh token (persisted in `AttestationSessionTable`, including `RunId`). +- `POST /attest` (public domain) - sce-unit submits a real Nitro attestation document (base64 COSE_Sign1 bytes) + `algorithmId` + `runId` + the `challenge` it was issued. The document's `nonce` must equal the challenge, and the challenge is consumed atomically before the PCR check, so a captured document cannot be replayed. After the PCR check, the run is claimed in `RunAttestationTable` with a conditional put, so only the first attestation for a `runId` succeeds; later ones get 409. The attestation document's `public_key` is stored on the `RunAttestationTable` row with `AlgorithmId`; the DC uses it to verify signed run results. Verified against the pinned AWS Nitro root cert chain and the registered PCRs; on success, issues a signed access JWT + opaque refresh token (persisted in `AttestationSessionTable`, including `RunId`). - `POST /refresh` (public domain) - exchanges a still-valid refresh token plus its `runId` for a new access JWT, without requiring a fresh attestation document. The `runId` must match the one stored on the session. -- `GET /runs/{runId}` (public domain) - returns `{runId, algorithmId, publicKey}` for a run that has attested. result-consumer uses it to verify the enclave's result signature. Public keys are public, so no auth. +- `GET /runs/{runId}` (public domain) - returns `{runId, algorithmId, publicKey}` for a run that has attested. The DC uses it to verify the enclave's result signature. Public keys are public, so no auth. - `GET /.well-known/jwks.json` (public domain) - the ML-DSA-87 public key downstream services use to verify access JWTs locally. Public by definition, no auth. ### Verifying a webhook result @@ -27,7 +27,7 @@ To verify: 2. Check the signed `runId` and `algorithmId` match the values you expect. 3. Verify the signature with `publicKey`. -No SQS or result table entry exists for a webhook run, so `GET /run/{runId}` on execution-service remains `pending`. +The webhook is the only result delivery path for secure-rads; there is no result table or `GET /run/{runId}` result route. ### Access token format (ML-DSA-87 compact JWS) diff --git a/secure/verifier-service/serverless.yml b/secure/verifier-service/serverless.yml index 99a79e1e..7189c98c 100644 --- a/secure/verifier-service/serverless.yml +++ b/secure/verifier-service/serverless.yml @@ -76,7 +76,7 @@ functions: jwks: handler: src/handlers/jwks.handler - # result-consumer reads the public key recorded for one run. + # The DC reads the public key recorded for one run. runSigningKey: handler: src/handlers/runSigningKey.handler diff --git a/secure/verifier-service/src/handlers/runSigningKey.ts b/secure/verifier-service/src/handlers/runSigningKey.ts index ed59f27b..265bf554 100644 --- a/secure/verifier-service/src/handlers/runSigningKey.ts +++ b/secure/verifier-service/src/handlers/runSigningKey.ts @@ -12,7 +12,7 @@ interface AttestedRun { PublicKey?: unknown; } -// result-consumer fetches this by run id to verify the enclave's result signature against the key that was +// The DC fetches this by run id to verify the enclave's result signature against the key that was // bound to the run during attestation. Public keys are public, so this needs no auth. export const handler: APIGatewayProxyHandlerV2 = async (event) => { const startedAt = process.hrtime.bigint(); diff --git a/secure/verifier-service/src/lib/attestFlow.ts b/secure/verifier-service/src/lib/attestFlow.ts index 5923f22a..ef8ff095 100644 --- a/secure/verifier-service/src/lib/attestFlow.ts +++ b/secure/verifier-service/src/lib/attestFlow.ts @@ -44,7 +44,7 @@ export async function attestRequest(body: AttestBody, deps: AttestDeps): Promise return { statusCode: 401, body: `attestation verification failed: ${(err as Error).message}` }; } - // The public key is what result-consumer later verifies signed run results against. + // The public key is what the DC later verifies signed webhook results against. if (!doc.publicKey || doc.publicKey.length === 0) { return { statusCode: 401, body: "attestation document is missing a public key" }; } From b6784f3846890f6fe10bea2ffac3d52a22ef1514 Mon Sep 17 00:00:00 2001 From: prdai Date: Thu, 26 Nov 2026 20:58:14 +0530 Subject: [PATCH 07/13] feat(sce): use result-consumer as the default webhook receiver Co-authored-by: Codex --- .github/workflows/ci.yml | 8 + CLAUDE.md | 2 +- Makefile | 33 +- README.md | 2 +- benchmark/README.md | 7 +- benchmark/src/export.py | 4 +- benchmark/src/lib/trees/__init__.py | 2 +- benchmark/src/lib/trees/base.py | 3 +- benchmark/src/lib/trees/secure_rads.py | 32 -- docs/cost-service.md | 4 +- docs/deploy.md | 2 +- docs/e2e-secure-rads.txt | 8 + docs/getting-started.md | 6 + docs/running.md | 12 +- packages/common/package.json | 4 + scripts/lib/units.sh | 10 +- secure/result-consumer/README.md | 25 ++ secure/result-consumer/biome.json | 24 ++ secure/result-consumer/bun.lock | 294 ++++++++++++++++++ secure/result-consumer/knip.json | 12 + secure/result-consumer/package.json | 28 ++ secure/result-consumer/serverless.yml | 53 ++++ .../result-consumer/src/handlers/receive.ts | 67 ++++ secure/result-consumer/src/lib/attestation.ts | 47 +++ secure/result-consumer/src/lib/verify.ts | 80 +++++ secure/result-consumer/tsconfig.json | 12 + secure/sce/Makefile | 6 + secure/sce/execution-service/README.md | 12 +- secure/sce/execution-service/serverless.yml | 13 +- .../sce/execution-service/src/handlers/run.ts | 62 +++- secure/telemetry-service/README.md | 2 +- secure/telemetry-service/src/lib/events.ts | 3 +- secure/verifier-service/README.md | 2 +- 33 files changed, 806 insertions(+), 75 deletions(-) create mode 100644 secure/result-consumer/README.md create mode 100644 secure/result-consumer/biome.json create mode 100644 secure/result-consumer/bun.lock create mode 100644 secure/result-consumer/knip.json create mode 100644 secure/result-consumer/package.json create mode 100644 secure/result-consumer/serverless.yml create mode 100644 secure/result-consumer/src/handlers/receive.ts create mode 100644 secure/result-consumer/src/lib/attestation.ts create mode 100644 secure/result-consumer/src/lib/verify.ts create mode 100644 secure/result-consumer/tsconfig.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 16b116fd..09a6bd21 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -76,6 +76,10 @@ jobs: - 'secure/pdm-service/**' - 'packages/common/**' - '.github/workflows/ci.yml' + 'secure/result-consumer': + - 'secure/result-consumer/**' + - 'packages/common/**' + - '.github/workflows/ci.yml' 'secure/sce/execution-service': - 'secure/sce/execution-service/**' - 'packages/common/**' @@ -141,6 +145,10 @@ jobs: - 'secure/pdm-service/**' - 'packages/common/**' - '.github/workflows/ci.yml' + 'secure/result-consumer': + - 'secure/result-consumer/**' + - 'packages/common/**' + - '.github/workflows/ci.yml' 'secure/sce/execution-service': - 'secure/sce/execution-service/**' - 'packages/common/**' diff --git a/CLAUDE.md b/CLAUDE.md index f6fde800..164fa05d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ The human user is the technical lead. The agent is a supporting engineer that he ## Project Context -This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery to a per-run DC webhook, signed by the enclave and verifiable via verifier-service). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. +This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery by signed webhook to result-consumer by default or a per-run DC webhook, verifiable via verifier-service). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. ## Operating Rules diff --git a/Makefile b/Makefile index 8764de35..812d1491 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,7 @@ logs: pids=""; \ for target in registry-logs; do make $$target & pids="$$pids $$!"; done; \ for group in $$(aws logs describe-log-groups --region "$(REGION)" --log-group-name-prefix /aws/lambda/ --query 'logGroups[].logGroupName' --output text); do \ - case "$$group" in /aws/lambda/secure-rads-execution-service-dev-*|/aws/lambda/secure-rads-verifier-service-dev-*|/aws/lambda/secure-rads-pdm-service-dev-*|/aws/lambda/secure-rads-kms-service-dev-*|/aws/lambda/secure-rads-log-service-dev-*|/aws/lambda/secure-rads-telemetry-service-dev-*|/aws/lambda/secure-rads-cost-service-dev-*|/aws/lambda/rads-registry-service-dev-*|/aws/lambda/rads-pdm-service-dev-*|/aws/lambda/rads-log-service-dev-*|/aws/lambda/rads-telemetry-service-dev-*|/aws/lambda/rads-cost-service-dev-*|/aws/lambda/rads-result-consumer-dev-*|/aws/lambda/rads-execution-service-dev-*) aws logs tail "$$group" --region "$(REGION)" --follow & pids="$$pids $$!";; esac; \ + case "$$group" in /aws/lambda/secure-rads-execution-service-dev-*|/aws/lambda/secure-rads-verifier-service-dev-*|/aws/lambda/secure-rads-pdm-service-dev-*|/aws/lambda/secure-rads-kms-service-dev-*|/aws/lambda/secure-rads-log-service-dev-*|/aws/lambda/secure-rads-telemetry-service-dev-*|/aws/lambda/secure-rads-cost-service-dev-*|/aws/lambda/secure-rads-result-consumer-dev-*|/aws/lambda/rads-registry-service-dev-*|/aws/lambda/rads-pdm-service-dev-*|/aws/lambda/rads-log-service-dev-*|/aws/lambda/rads-telemetry-service-dev-*|/aws/lambda/rads-cost-service-dev-*|/aws/lambda/rads-result-consumer-dev-*|/aws/lambda/rads-execution-service-dev-*) aws logs tail "$$group" --region "$(REGION)" --follow & pids="$$pids $$!";; esac; \ done; \ trap 'kill $$pids 2>/dev/null || true' EXIT INT TERM; \ for pid in $$pids; do wait "$$pid" || true; done @@ -219,28 +219,39 @@ secure-rads-build-all: $(MAKE) secure-rads-build APP=$$app ALGORITHM_ID=$$id || exit 1; \ done -# Execution phase (one run): make secure-rads-run ALGORITHM_ID= WEBHOOK_URL=https://... -# Fires /run and prints the runId. The signed result is POSTed to WEBHOOK_URL; there is no result polling. +# Execution phase (one run): make secure-rads-run ALGORITHM_ID=. +# Fires /run (202 + runId), then polls GET /run/{runId} until the enclave reports back. secure-rads-run: @test -n "$(ALGORITHM_ID)" || { echo "ALGORITHM_ID is required"; exit 1; } - @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @api=$(EXECUTION_API_URL); \ - curl -sS -X POST "$$api/run" -H 'Content-Type: application/json' \ - -d '{"algorithmId":"$(ALGORITHM_ID)","webhookUrl":"$(WEBHOOK_URL)"}'; \ - echo + payload='{"algorithmId":"$(ALGORITHM_ID)"}'; \ + if [ -n "$(WEBHOOK_URL)" ]; then payload='{"algorithmId":"$(ALGORITHM_ID)","webhookUrl":"$(WEBHOOK_URL)"}'; fi; \ + runId=$$(curl -sS -X POST "$$api/run" -H 'Content-Type: application/json' \ + -d "$$payload" | python3 -c 'import sys,json; print(json.load(sys.stdin)["runId"])'); \ + echo "runId=$$runId"; \ + if [ -n "$(WEBHOOK_URL)" ]; then echo "webhook run; result goes to $(WEBHOOK_URL)"; exit 0; fi; \ + for i in $$(seq 1 132); do \ + res=$$(curl -sS "$$api/run/$$runId?algorithmId=$(ALGORITHM_ID)"); \ + status=$$(echo "$$res" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("status",""))'); \ + if [ "$$status" != "pending" ]; then \ + echo "$$res"; \ + echo "$$res" | python3 -c 'import json,sys; r=json.load(sys.stdin); out=r.get("output", "").strip(); parsed=json.loads(out) if out else {}; ok=r.get("status")=="exit:0" and bool(out) and not (isinstance(parsed, dict) and parsed.get("error")); sys.exit(0 if ok else 1)'; \ + exit $$?; \ + fi; \ + sleep 5; \ + done; \ + echo "timed out waiting for runId=$$runId"; exit 1 -# Fire every sample app in turn. The same WEBHOOK_URL receives all results. +# Fire and poll every sample app in turn (sequential - each spins up its own enclave). secure-rads-run-all: - @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @for pair in $(SAMPLE_APPS); do \ - id=$${pair##*:}; \ + app=$${pair%%:*}; id=$${pair##*:}; \ $(MAKE) secure-rads-run ALGORITHM_ID=$$id WEBHOOK_URL="$(WEBHOOK_URL)" || exit 1; \ done # Start the existing hosts, then build, seed, and run the whole fleet. Build comes first because it # provisions the per-algorithm KMS keys used by seeding. secure-rads-all: - @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } $(MAKE) secure-rads-ready $(MAKE) secure-rads-build-all $(MAKE) secure-rads-seed diff --git a/README.md b/README.md index f26fa596..0ce9f27f 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Every rads AWS resource is prefixed `rads-`; every secure-rads resource is prefi **Build phase (CSAV).** A Data Controller uploads an OCI image and assigns it an `algorithmId`. registry-service unpacks the image (daemonless: skopeo + umoci), layers the SCE Unit and nsjail on top, and builds a single Nitro Enclave Image File (EIF). It registers the EIF's PCR measurements against that `algorithmId` with the Verifier Service (over mTLS) and stores the EIF in S3, recording `algorithmId -> S3 path` in DynamoDB. -**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and POSTs it to the DC webhook, and the DC verifies the signature against verifier-service. +**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and POSTs it to result-consumer by default or to a DC-supplied webhook; result-consumer verifies the signature and `GET /run/{runId}` reads the stored result. Throughout both phases every component posts timestamped events to the telemetry-service, so a run's full timeline - build to execution - can be exported for benchmarking. The log-service records only the subject-access trail. Components also report selected, attributable AWS operations to the cost-service, keyed by the same `(AlgorithmId, runId)`, so their estimated costs can be summed per AWS service ([`docs/cost-service.md`](docs/cost-service.md)). Event-by-event plaintext flows: [`docs/e2e-rads.txt`](docs/e2e-rads.txt), [`docs/e2e-secure-rads.txt`](docs/e2e-secure-rads.txt). diff --git a/benchmark/README.md b/benchmark/README.md index 9d12415e..77170f6c 100644 --- a/benchmark/README.md +++ b/benchmark/README.md @@ -46,10 +46,9 @@ Typical iteration: `make seed` once, then `make run REPS=1` / `make report` whil ## Prerequisites - Devbox + repo `.aws/credentials` (not the global AWS root profile) -- Both trees deployed (registry, PDM, execution, log, cost; rads also needs result-consumer; secure-rads also needs CSAV, verifier, and kms-service) +- Both trees deployed (registry, PDM, execution, log, cost, result-consumer; secure-rads also needs CSAV, verifier, and kms-service) - CSAV host running (`make up` / `make secure-rads-ready` from the repo root) - Docker (arm64) for the sample algorithm image on first upload -- `SECURE_WEBHOOK_URL` for secure-rads runs (defaults to `https://httpbin.org/post`) - `uv` (Python); `bun` for `../seeding` generate/seed Executors run on `c6g.large` on both trees. Secure-rads allocates a 1 vCPU / 2048 MiB enclave, and rads runs its container with `--cpus 1 --memory 2048m` so both trees give the algorithm the same compute. @@ -124,8 +123,8 @@ The event contract follows [RADS](../docs/e2e-rads.txt) and [Secure-RADS](../doc | Attestation | — | `unit-ready` → `attested` | | Data retrieval | `artifact-retrieved` → `records-stored-locally` | `attested` → `records-stored-locally` | | Algorithm processing | `records-stored-locally` → `compute-completed` | `records-stored-locally` → `dc-app-completed` | -| Result delivery | `compute-completed` → `result-persisted` | `dc-app-completed` → `output-sent` | -| Total | `run-requested` → `result-persisted` | `run-requested` → `output-sent` | +| Result delivery | `compute-completed` → `result-persisted` | `output-sent` → `result-persisted` | +| Total | `run-requested` → `result-persisted` | `run-requested` → `result-persisted` | `records-fetched` precedes file serialization/writing in both trees. Secure-rads emits `records-decrypted` after decryption and `records-stored-locally` after writing the plaintext file. Its data-retrieval phase includes fetching AWS credentials, fetching records, KMS key unwrapping, record decryption, and writing the file. The CSV includes the individual event timestamps as well as the aggregate phase durations. diff --git a/benchmark/src/export.py b/benchmark/src/export.py index c7470dc4..be472dd7 100644 --- a/benchmark/src/export.py +++ b/benchmark/src/export.py @@ -27,8 +27,8 @@ "attestation": ("unit-ready", "attested"), "data_retrieval": ("attested", "records-stored-locally"), "algorithm_processing": ("records-stored-locally", "dc-app-completed"), - "result_delivery": ("dc-app-completed", "output-sent"), - "total": ("run-requested", "output-sent"), + "result_delivery": ("output-sent", "result-persisted"), + "total": ("run-requested", "result-persisted"), }, "rads": { "host_provisioning": ("executor-launched", "executor-ready"), diff --git a/benchmark/src/lib/trees/__init__.py b/benchmark/src/lib/trees/__init__.py index e5f0d05e..f0364325 100644 --- a/benchmark/src/lib/trees/__init__.py +++ b/benchmark/src/lib/trees/__init__.py @@ -13,6 +13,6 @@ def harness_for(tree: Tree, endpoints: dict[str, str]) -> TreeHarness: if tree is Tree.RADS: return RadsHarness(endpoints["registry"], endpoints["execution"]) if tree is Tree.SECURE_RADS: - return SecureRadsHarness(endpoints["registry"], endpoints["execution"], endpoints.get("telemetry")) + return SecureRadsHarness(endpoints["registry"], endpoints["execution"]) msg = f"unknown tree {tree!r}" raise ValueError(msg) diff --git a/benchmark/src/lib/trees/base.py b/benchmark/src/lib/trees/base.py index 991b9e1f..7029ef11 100644 --- a/benchmark/src/lib/trees/base.py +++ b/benchmark/src/lib/trees/base.py @@ -20,10 +20,9 @@ class TreeHarness(ABC): name: ClassVar[Tree] - def __init__(self, registry_url: str, execution_url: str, telemetry_url: str | None = None) -> None: + def __init__(self, registry_url: str, execution_url: str) -> None: self._registry = registry_url self._execution = execution_url - self._telemetry = telemetry_url @staticmethod def build_sample_tar(tree: Tree) -> Path: diff --git a/benchmark/src/lib/trees/secure_rads.py b/benchmark/src/lib/trees/secure_rads.py index 2c403fba..152bb98c 100644 --- a/benchmark/src/lib/trees/secure_rads.py +++ b/benchmark/src/lib/trees/secure_rads.py @@ -1,8 +1,6 @@ from __future__ import annotations import asyncio -import json -import os from typing import TYPE_CHECKING, ClassVar from lib import http @@ -18,36 +16,6 @@ class SecureRadsHarness(TreeHarness): name: ClassVar[Tree] = Tree.SECURE_RADS - async def execute(self, client: httpx.AsyncClient, algorithm_id: str, size: int) -> tuple[str, str, str]: - if not self._telemetry: - msg = "secure-rads telemetry URL is required to follow a webhook run" - raise http.FlowError(msg) - webhook = os.environ.get("SECURE_WEBHOOK_URL", "https://httpbin.org/post") - status, body = await http.arequest( - client, - "POST", - f"{self._execution}/run", - json={"algorithmId": algorithm_id, "size": size, "webhookUrl": webhook}, - ) - http.require(status, http.HTTP_ACCEPTED, "/run", body) - - run_id = http.parse_json(body)["runId"] - deadline = asyncio.get_running_loop().time() + http.POLL_TIMEOUT_SECONDS - while asyncio.get_running_loop().time() < deadline: - status, event_body = await http.arequest( - client, "GET", f"{self._telemetry}/logs/{algorithm_id}?runId={run_id}" - ) - http.require(status, http.HTTP_OK, f"GET logs/{algorithm_id}", event_body) - events = {event["event"] for event in json.loads(event_body)} - if "run-failed" in events: - return run_id, "exit:1", "" - if "output-sent" in events or "executor-finished" in events: - return run_id, "exit:0", "" - await asyncio.sleep(http.POLL_INTERVAL_SECONDS) - - msg = f"timed out after {http.POLL_TIMEOUT_SECONDS:.0f}s waiting for runId={run_id}" - raise http.FlowError(msg) - async def upload(self, client: httpx.AsyncClient, algorithm_id: str) -> None: tar_path = await asyncio.to_thread(self.build_sample_tar, self.name) content = await asyncio.to_thread(tar_path.read_bytes) diff --git a/docs/cost-service.md b/docs/cost-service.md index 5bdf6083..a00a99cb 100644 --- a/docs/cost-service.md +++ b/docs/cost-service.md @@ -52,7 +52,7 @@ rads (`csav/registry-service`, Lambdas): - execution-service `POST /run`: `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity` (algorithm lookup and record-count check; actual `ConsumedCapacity.CapacityUnits`). It also stamps the launch epoch into the host user-data. -- execution-service `GET /run/{runId}?algorithmId={algorithmId}` (rads only; secure-rads delivers to a webhook): `apigateway:request`, `lambda:invocation`, +- execution-service `GET /run/{runId}?algorithmId={algorithmId}` (both trees; secure-rads webhook runs stored by result-consumer): `apigateway:request`, `lambda:invocation`, `lambda:compute`, `dynamodb:read-capacity`. `algorithmId` is required so pending-run polls can be attributed. - executor host (user-data): `s3:get` (artifact; rads also the host tools), `sqs:send` (rads result only), `ec2:instance` (seconds from launch to the terminate call). @@ -63,6 +63,8 @@ rads (`csav/registry-service`, Lambdas): - rads result-consumer (`batchSize` 1, so each run's receive + invoke lands on that run): `sqs:receive` (message bytes), `sqs:delete` (one request when the handler succeeds; Lambda performs the deletion), `dynamodb:write-capacity`, `lambda:invocation`, `lambda:compute`. +- secure-rads result-consumer (`POST /results`): `apigateway:request`, `lambda:invocation`, `lambda:compute`, + `dynamodb:write-capacity` for each verified webhook result. - verifier-service (secure-rads): `/challenge`, `/attest` and `/refresh` (the enclave's challenge, attestation and token refresh, keyed by the run) and `/algorithms` (build-time PCR registration, keyed by `algorithmId`): `dynamodb:read-capacity` and `dynamodb:write-capacity` where attributable, plus `apigateway:request`, `lambda:invocation`, `lambda:compute`. diff --git a/docs/deploy.md b/docs/deploy.md index ff3aea40..8184bf49 100644 --- a/docs/deploy.md +++ b/docs/deploy.md @@ -14,7 +14,7 @@ The lists below reflect the dependency order the script uses. | Tree | Units | | --- | --- | -| `secure` | storage, verifier-service, log-service, telemetry-service, cost-service, pdm-service, kms-service, csav, execution-service, registry-image, transparency-portal | +| `secure` | storage, verifier-service, result-consumer, log-service, telemetry-service, cost-service, pdm-service, kms-service, csav, execution-service, registry-image, transparency-portal | | `rads` | result-consumer, log-service, telemetry-service, cost-service, pdm-service, registry-service, execution-service, transparency-portal | A full tree deploy runs every unit. Named units deploy only what you name; dependencies are not diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 01f7a627..450cfcf6 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -105,3 +105,11 @@ Input: // The key policy requires the attestation's PCR0/1/2 and KMS returns CiphertextForRecipient encrypted to // the enclave's ephemeral key: the service never sees plaintext, and only the measured enclave can unwrap. 8 return ciphertext to the enclave + +SECURE-RADS-RESULT-CONSUMER(result) +Input: + result ← signed envelope POSTed by the SCE-UNIT (default webhook) +1 key ← GET-VERIFIER-RUN-ATTESTATION(result.runId) // verifier GET /runs/{runId} +2 if not VERIFY-SIGNATURE(key, result) then reject +3 persist verified result to DynamoDB +4 cost dynamodb:write-capacity; emit result-persisted diff --git a/docs/getting-started.md b/docs/getting-started.md index b8e19142..75b8a08d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -173,6 +173,12 @@ make -C secure/csav/registry-service gen-client-cert --param="publicCertificateArn=$VERIFIER_ATTEST_CERT_ARN") ``` +Deploy the result consumer next so the execution-service stack can use its receiver URL and results table: + +```sh +(cd secure/result-consumer && bun install && bunx serverless deploy --param="region=$REGION") +``` + Upload the truststore, then deploy verifier-service again with its immutable S3 object version: ```sh diff --git a/docs/running.md b/docs/running.md index f9915d4d..6e7d337c 100644 --- a/docs/running.md +++ b/docs/running.md @@ -37,14 +37,14 @@ and `AWS_DEFAULT_REGION` as `ap-southeast-2`, and uses the ignored local AWS fil devbox shell make up # start the CSAV EC2 host and wait for registry-service make status # show the CSAV, SCE, and rads stacks -make secure-rads WEBHOOK_URL=https://dc.example/results # build, seed, and run all five samples +make secure-rads # build, seed, and run all five samples make down # stop the CSAV EC2 host when finished ``` `make secure-rads` is a persistent, repeatable fleet: it registers each sample under its fixed -`algorithmId`, seeds its data, and fires it at `WEBHOOK_URL`. Building happens before seeding because -registration creates the KMS key used to encrypt each dataset. Secure-rads has no result polling; the -signed result is delivered to the webhook. +`algorithmId`, seeds its data, and runs it. Building happens before seeding because registration +creates the KMS key used to encrypt each dataset. Results go to the internal result-consumer by +default; pass `WEBHOOK_URL=https://...` to send them to a DC webhook instead. Useful root targets: @@ -52,7 +52,7 @@ Useful root targets: make secure-rads-ready # start and verify the CSAV host make secure-rads-build-all # build and register all samples make secure-rads-seed # generate and seed all datasets -make secure-rads-run-all WEBHOOK_URL=... # run all samples; results go to the webhook +make secure-rads-run-all # run all samples make benchmark # Exp1/Exp2 size sweep (override REPS= TREES= …) make benchmark-report # export sweep CSV + figures make logs # tail the CSAV host and all Lambda logs @@ -66,7 +66,7 @@ Single app (APP is a secure/samples/ dir, ALGORITHM_ID its fixed id): ```sh make secure-rads-build APP=health-risk-python ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc -make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc WEBHOOK_URL=https://dc.example/results +make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc ``` Export a run's timeline (build through execution) as CSV: diff --git a/packages/common/package.json b/packages/common/package.json index 556e362a..2844507c 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -19,6 +19,10 @@ "./jwt": { "types": "./src/jwt.ts", "import": "./src/jwt.ts" + }, + "./tls": { + "types": "./src/tls.ts", + "import": "./src/tls.ts" } }, "scripts": { diff --git a/scripts/lib/units.sh b/scripts/lib/units.sh index 235c6161..f4205013 100644 --- a/scripts/lib/units.sh +++ b/scripts/lib/units.sh @@ -4,6 +4,7 @@ units_secure=( secure/storage secure/verifier-service + secure/result-consumer secure/log-service secure/telemetry-service secure/cost-service @@ -29,13 +30,14 @@ units_rads=( declare -A DEPENDS=( [secure/storage]="" [secure/verifier-service]="" + [secure/result-consumer]="secure/verifier-service" [secure/log-service]="secure/verifier-service" [secure/telemetry-service]="" [secure/cost-service]="" [secure/pdm-service]="secure/verifier-service" [secure/kms-service]="secure/storage secure/pdm-service" [secure/csav]="secure/storage" - [secure/sce/execution-service]="secure/storage secure/pdm-service" + [secure/sce/execution-service]="secure/storage secure/result-consumer secure/pdm-service" [secure/registry-image]="secure/csav secure/kms-service" [secure/transparency-portal]="" [rads/result-consumer]="" @@ -52,6 +54,11 @@ unit_secure_storage() { run make -C secure/csav/registry-service deploy-storage } +unit_secure_result_consumer() { + need TELEMETRY_HOST_SECURE_RADS COST_HOST_SECURE_RADS VERIFIER_ATTEST_HOST VERIFIER_PUBKEY_SHA256 + sls secure/result-consumer --param="region=$region" +} + unit_secure_log_service() { need LOG_HOST_SECURE_RADS VERIFIER_JWKS_URL VERIFIER_JWKS_PUBKEY_SHA256 local arn @@ -268,6 +275,7 @@ deploy_unit() { secure/telemetry-service) unit_secure_telemetry_service ;; secure/cost-service) unit_secure_cost_service ;; secure/verifier-service) unit_secure_verifier_service ;; + secure/result-consumer) unit_secure_result_consumer ;; secure/pdm-service) unit_secure_pdm_service ;; secure/kms-service) unit_secure_kms_service ;; secure/csav) unit_secure_csav ;; diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md new file mode 100644 index 00000000..55e12187 --- /dev/null +++ b/secure/result-consumer/README.md @@ -0,0 +1,25 @@ +# result-consumer + +Serverless Framework v4, TypeScript. HTTPS receiver for the enclave's signed run result. + +## Flow + +`POST /results` accepts the signed envelope `{ runId, algorithmId, instanceId?, payload, signature }`: + +1. Fetch the run's attested public key from verifier-service `GET /runs/{runId}`, pinned to the verifier leaf SPKI. +2. Check the returned `runId` matches, then verify the signature and signed `algorithmId`. +3. `PutItem` the verified fields into `RunResultsTable`, which execution-service reads back at `GET /run/{runId}`. + +Returns `200` on success, `400` for malformed input, `404` when the run has not attested, and `401` for an invalid signature. DynamoDB errors return `500` so the enclave's webhook retry can try again. + +## Resources + +- `RunResultsTable` - PAY_PER_REQUEST DynamoDB table, PK `RunId`. +- `ResultWebhookUrl` - output consumed by execution-service as the default webhook target. + +Deploy verifier-service first so `GET /runs/{runId}` exists: + +```sh +bun install +bunx serverless deploy --param="region=$REGION" +``` diff --git a/secure/result-consumer/biome.json b/secure/result-consumer/biome.json new file mode 100644 index 00000000..daa455f2 --- /dev/null +++ b/secure/result-consumer/biome.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://biomejs.dev/schemas/2.5.10/schema.json", + "files": { + "includes": ["src/**/*.ts"] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 120 + }, + "linter": { + "enabled": true, + "rules": { + "recommended": true + } + }, + "javascript": { + "formatter": { + "quoteStyle": "double", + "semicolons": "always" + } + } +} diff --git a/secure/result-consumer/bun.lock b/secure/result-consumer/bun.lock new file mode 100644 index 00000000..b45126fd --- /dev/null +++ b/secure/result-consumer/bun.lock @@ -0,0 +1,294 @@ +{ + "lockfileVersion": 1, + "configVersion": 1, + "workspaces": { + "": { + "name": "result-consumer", + "dependencies": { + "@aws-sdk/client-dynamodb": "^3.700.0", + "@aws-sdk/client-ssm": "^3.700.0", + "@aws-sdk/lib-dynamodb": "^3.700.0", + "@srads/common": "file:../../packages/common", + }, + "devDependencies": { + "@biomejs/biome": "^2.5.10", + "@types/aws-lambda": "^8.10.152", + "@types/node": "^22.0.0", + "knip": "^6.32.2", + "serverless": "^4.4.0", + "typescript": "^5.7.0", + }, + }, + }, + "packages": { + "@aws-sdk/client-dynamodb": ["@aws-sdk/client-dynamodb@3.1118.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-node": "^3.972.81", "@aws-sdk/dynamodb-codec": "^3.973.44", "@aws-sdk/middleware-endpoint-discovery": "^3.972.30", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-svEO204aN18SV433vZ1+VRCdRrMhQto52pTDOJwkwO5FcydmZa+Ld+lWu0k6OC50Ft4qJb1WrG2lsEno/++lGg=="], + + "@aws-sdk/client-ssm": ["@aws-sdk/client-ssm@3.1169.0", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/credential-provider-node": "^3.972.97", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-EAqUE22l8bOeCPMNxnahMhKrWW2n7siZjVL1rNWWaD9prTTwDbMf2xeaAOqVx5lLOz+3sSuicM6OMY5yYTR1Eg=="], + + "@aws-sdk/core": ["@aws-sdk/core@3.977.9", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@aws-sdk/xml-builder": "^3.972.40", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.33.3", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-reqPFEQrZxDZpeGj4PFMepBeR5LGYHRqq/L0motTzgFkCRBA4rFdaVXDSLYyGHhxVz7sT2PDnPN9CluGSfgyJA=="], + + "@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-H404B7dJl2mCrBqahDEYsanB0xhdDp6tXnXcTUnXmmpy2Q3J0Ho0bUajZ2jr/RdwzCyS59Gi8xXIFwPLGBl6Uw=="], + + "@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.72", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-X98zYOrVOeuosCX+6ktf29FC2N2GHPLia7qv6mzPzTc+RPAuHWCDS++Z6JK7eGYqb/v6uaW7bAXaOvDBfol+0w=="], + + "@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.15", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-login": "^3.972.77", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rykg6s5ceBuynMOGWgoowO4N+27JfnqXAnVaSunZl0hOO1XodSrxGNz6sCEbnmS0lAfQZDKyb3fbr46gSuv6Sg=="], + + "@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.77", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Jb59xfEISoN5mmbnA+HYqdtrSX3CgCtJoof+V5D8/TgUI56W63GEEd5Y58WijU3Ou6+WEgaLD1feVzaRXV5IDQ=="], + + "@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.81", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.70", "@aws-sdk/credential-provider-http": "^3.972.72", "@aws-sdk/credential-provider-ini": "^3.973.15", "@aws-sdk/credential-provider-process": "^3.972.70", "@aws-sdk/credential-provider-sso": "^3.973.14", "@aws-sdk/credential-provider-web-identity": "^3.972.76", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/credential-provider-imds": "^4.4.16", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-Rml+WitoFvXmv6JZ18U/xGdGDGGvB/mOin0ya0lTnTrdC0Z1lrVxTYh7iNklZBcvcRMrs4DoEf6xy1KWyrLQQw=="], + + "@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.70", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2ry03fGRJr4sV3jI+ocjj5JqALnFD6ymM5KiNCDZMvq8bX2GSbE0vji4aM43TVCl2nXqqLRZaUxdq/KeWRAY4Q=="], + + "@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.14", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/token-providers": "3.1116.0", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-jkhg/8ocAAoc0RFyLMhCw+/zZh7gystQgd4F4hznNa8P4Cc501PQmxd+jGLiMHodPJ+7Zv/3znM62gZojyasmA=="], + + "@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.76", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-d3AGyVu759PGr35mEB2s22xxlNEA5rpdxtSPJthfPFJvoQ8dt357iVPECqWfUxXp1toJAvKmbtcIYVGigaGsCA=="], + + "@aws-sdk/dynamodb-codec": ["@aws-sdk/dynamodb-codec@3.973.44", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-eo27HNeBqMAfy9JBQug6ErU6DeG8OmOH6ou8+KmX3/fWdTmWUsHsfisz2tEQOG+GJ57bBC7kC6AjKAjpcxU4QA=="], + + "@aws-sdk/endpoint-cache": ["@aws-sdk/endpoint-cache@3.972.11", "", { "dependencies": { "mnemonist": "0.38.3", "tslib": "^2.6.2" } }, "sha512-8q1ICxcDjHId3bBryuu/j+1L9y5/3uQnwzLDt5j2ElcjZSoWmFtymdJy7OjLrluSMe0Z4mq5bcH4fxBXvlEHfw=="], + + "@aws-sdk/lib-dynamodb": ["@aws-sdk/lib-dynamodb@3.1118.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/util-dynamodb": "^3.996.9", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" }, "peerDependencies": { "@aws-sdk/client-dynamodb": "^3.1118.0" } }, "sha512-xVluK5+wcrxJMWho3V5OKXBFxv1oriVOHprfMTds4kkUw0cPh1oOHIKEj8KP1m8F/dztFMVXfIEbvltxCMlCTQ=="], + + "@aws-sdk/middleware-endpoint-discovery": ["@aws-sdk/middleware-endpoint-discovery@3.972.30", "", { "dependencies": { "@aws-sdk/endpoint-cache": "^3.972.11", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-0hmD7/NG2NoVOVHvUb6rtY5POQYr+/9gdHvrYhIBA1zmCqKOBd5Gz3dL+iZ15FHOJbs/5kLplGoePc8PHTlzYA=="], + + "@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.997.44", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/signature-v4-multi-region": "^3.996.46", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-NhEgryjlBF9w38ZXqGymQV28IhkYa1mKhlbYnqIis57AYwWGVYfUPgg/qC2rLRqOUfblxx++irvju10kVTa8Vw=="], + + "@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.46", "", { "dependencies": { "@aws-sdk/types": "^3.974.5", "@smithy/signature-v4": "^5.6.12", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-L+2xZTye/2T96f3lwCws0Zw6GG2JHZW9e8FpVgGBeeExSKyeoZ6CWRpBml/7DNiK/O26jrgPM9F+Ay8VkgzUWQ=="], + + "@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1116.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/nested-clients": "^3.997.44", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-ygIivKqh8aHzNkucOCXHyIBgBpLPfrSI0mCqXF+vLBsPTUKqj0VSqAY0GFPe7lQl4HntjOcQ+KSyS7oUV2C54Q=="], + + "@aws-sdk/types": ["@aws-sdk/types@3.974.5", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-LkwLL2BLbC6wNNm4JaH9mbEqBMdOZCct6VAYqhdN4U1xrWM+fUJQEfbHwQgDypapOWTRtlk25akb5afM0P8CIQ=="], + + "@aws-sdk/util-dynamodb": ["@aws-sdk/util-dynamodb@3.996.9", "", { "dependencies": { "tslib": "^2.6.2" }, "peerDependencies": { "@aws-sdk/client-dynamodb": "^3.1111.0" } }, "sha512-16x2tRvl7OYpZ0W/DdFJieFriD13+RvuRBDbe5sj/tCEfK86HSGd7I2s5j0ivz8p6KWGkS+5wKRO9OliJkjUOQ=="], + + "@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.40", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-wlFmCIGUlwF4zx/kncw+bmxTQh1HeSJq4mYV/V5cZUSJadDP3kXvGW8Rn21cimj/7y9ju+47oYWXi97vF7czaA=="], + + "@aws/lambda-invoke-store": ["@aws/lambda-invoke-store@0.3.0", "", {}, "sha512-sl4Bm6yiMNYrZKkqqDFWN0UfnWhlS8ivKxrYl+6t0gCLrqr8y3B2IqZZbFRkfaVVp7C/baApyh71P+LeE1A2sQ=="], + + "@biomejs/biome": ["@biomejs/biome@2.5.10", "", { "optionalDependencies": { "@biomejs/cli-darwin-arm64": "2.5.10", "@biomejs/cli-darwin-x64": "2.5.10", "@biomejs/cli-linux-arm64": "2.5.10", "@biomejs/cli-linux-arm64-musl": "2.5.10", "@biomejs/cli-linux-x64": "2.5.10", "@biomejs/cli-linux-x64-musl": "2.5.10", "@biomejs/cli-win32-arm64": "2.5.10", "@biomejs/cli-win32-x64": "2.5.10" }, "bin": { "biome": "bin/biome" } }, "sha512-WRKXARA3kTuiV5sxqTpobJ/I0MVd4vk3pOL6wnp5az4LntFIhWTj1RWZq3DI9PCEN3lXcqy7p5aqUHzvq8AXyQ=="], + + "@biomejs/cli-darwin-arm64": ["@biomejs/cli-darwin-arm64@2.5.10", "", { "os": "darwin", "cpu": "arm64" }, "sha512-ItCrxKK6SXVT6flYs0qIuBd4AA3TTTl4d66Re6YI2FuGZnN85NmuYNzkiTJUyYw8qBLv69L5zTUB6uyWd++h3Q=="], + + "@biomejs/cli-darwin-x64": ["@biomejs/cli-darwin-x64@2.5.10", "", { "os": "darwin", "cpu": "x64" }, "sha512-yLsPU9pAmtChXDu8vhKAzErqe+LeeYuwuUB2FZMkRitsmdodxsYRa9KHrFispsUHzzOu+9HB3nP/TQxyia+Sjw=="], + + "@biomejs/cli-linux-arm64": ["@biomejs/cli-linux-arm64@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-VG8uQW/86a1roLaIFvtIbEigxIdzdJ190oGyg1tV7VYeQtOS+x10sflk7WbuXgw91EtZX5DlIIIej1YqkNLlcg=="], + + "@biomejs/cli-linux-arm64-musl": ["@biomejs/cli-linux-arm64-musl@2.5.10", "", { "os": "linux", "cpu": "arm64" }, "sha512-t1QAKZwQJRB4dvgJSgFiQ4BNfNPChg69BNonz854qLVxnjT3UvDzQg9mbkTJRu35ZqU0Rw10A73J8Urgbg2RPw=="], + + "@biomejs/cli-linux-x64": ["@biomejs/cli-linux-x64@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-4O6T0eq2heoHZN0a9UX+rWQoxXEBaKf+lRi2hbsGlHneUz9BWXM76nEWMK7Eeq8gzMxR1khQB6BFpAASpeXqGg=="], + + "@biomejs/cli-linux-x64-musl": ["@biomejs/cli-linux-x64-musl@2.5.10", "", { "os": "linux", "cpu": "x64" }, "sha512-pgDDqp9JybHm2I0KRgzN6i4+lt8xu4iqxUwLzglUMmOmyRTU1AYBGKzh9sNMOtIjah7xoWvKHlLVetvyifzoiQ=="], + + "@biomejs/cli-win32-arm64": ["@biomejs/cli-win32-arm64@2.5.10", "", { "os": "win32", "cpu": "arm64" }, "sha512-pxAbxduPO4xq/Cvgaa2lOrs9BB0hEXmmDqfMNP4ZOffGOkUrD1/QGw9UAMpFQpX2P8MqTIIRuQKcmetum4Oa6A=="], + + "@biomejs/cli-win32-x64": ["@biomejs/cli-win32-x64@2.5.10", "", { "os": "win32", "cpu": "x64" }, "sha512-M+2dgBsl3lXRiTfgPVc2p3anS4Tocojke4rzFLScZ2Y/wmF+36dRb1iHCLiyGqOzQGyTplZH1HnEYviiAqi3nA=="], + + "@emnapi/core": ["@emnapi/core@1.11.2", "", { "dependencies": { "@emnapi/wasi-threads": "1.2.2", "tslib": "^2.4.0" } }, "sha512-TC8MkTuZUtcTSiFeuC0ksCh9QIJ5+F21MvZ4Wn4ORfYaFJ/0dsiudv5tVkejgwZlwQ39jL9WWDe2lz8x0WglOA=="], + + "@emnapi/runtime": ["@emnapi/runtime@1.11.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-kyOl3X0DuTiT1h2ft8r2fYO8JYtU9a9Xis/zBSiGArNaagCOWx90N1k2wxp18czFDH+OgcWGb5ZP/XMt3dcyPA=="], + + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.2.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA=="], + + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@1.2.3", "", { "dependencies": { "@tybys/wasm-util": "^0.10.3" }, "peerDependencies": { "@emnapi/core": "^1.7.1 || ^2.0.0-alpha.4", "@emnapi/runtime": "^1.7.1 || ^2.0.0-alpha.4" } }, "sha512-UMduMbqO5s5zF2NkNacMT/yK5Y5QiKvWr2+50bzIIxFDwVJ2h49b+oyjaCGPhJxd2/gC2x39EHv/gHVuu36x2Q=="], + + "@oxc-parser/binding-android-arm-eabi": ["@oxc-parser/binding-android-arm-eabi@0.143.0", "", { "os": "android", "cpu": "arm" }, "sha512-n9uozULWflPqBtdmI8lAabLqGKNgLVNN0ZH8HfgCwpKGNtzRzauB76jTiW/3YLkcA7N1zskpi9GdVnZuu1SAvg=="], + + "@oxc-parser/binding-android-arm64": ["@oxc-parser/binding-android-arm64@0.143.0", "", { "os": "android", "cpu": "arm64" }, "sha512-9BbdjHETk6O3zH/DDid9IgBtF0GlpLabNKN231uraXpRDSfY+iiZxTP5bk1Z63GBownVdhdINFIeddmMz4MzpQ=="], + + "@oxc-parser/binding-darwin-arm64": ["@oxc-parser/binding-darwin-arm64@0.143.0", "", { "os": "darwin", "cpu": "arm64" }, "sha512-gh+6ecoHUy4/sUcolBl/1qPXKBbYNxFY0Pk0ujgQvINTMSftJY7o4yb8gOkDJPeZeB8+a+u7xTe6umoP8N5HFA=="], + + "@oxc-parser/binding-darwin-x64": ["@oxc-parser/binding-darwin-x64@0.143.0", "", { "os": "darwin", "cpu": "x64" }, "sha512-qd1hl2d+lXgHv/VQ/M9qm8TrMC5T4RqDBwtOnl+1D0QMjwcz+8AaB4JSg8STgeag0GP6a6L74XEGAsrTSJWNzQ=="], + + "@oxc-parser/binding-freebsd-x64": ["@oxc-parser/binding-freebsd-x64@0.143.0", "", { "os": "freebsd", "cpu": "x64" }, "sha512-M5XXcNa7aOqLPKTR41msfghKu2yQ4xWvCm11/gwU0JzOzHNk5sgW//rVEjJ+LO48+VDAMzXTSzurUVxIDKwozw=="], + + "@oxc-parser/binding-linux-arm-gnueabihf": ["@oxc-parser/binding-linux-arm-gnueabihf@0.143.0", "", { "os": "linux", "cpu": "arm" }, "sha512-T/GXusuOkPNQhCQCSBbcU/N8j0rAypuDBl1IyFK+lyYT594XsVz80clPC/OtbSSpBGyJxj8uYEfctxVuxVYoww=="], + + "@oxc-parser/binding-linux-arm-musleabihf": ["@oxc-parser/binding-linux-arm-musleabihf@0.143.0", "", { "os": "linux", "cpu": "arm" }, "sha512-oKu4RcBlXSqo3OC62dp6YTnQaZIurNDpCX3BnAM3+bJxt7s8J2TJKMnC0UYer1qhlRaDCg6wkTaTw+2IlsZ12w=="], + + "@oxc-parser/binding-linux-arm64-gnu": ["@oxc-parser/binding-linux-arm64-gnu@0.143.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-WJBbD186AZmMGaSIhlktC+rPl8L3peCTXAh88Ih9uEvK0en2mPojGyCGYiL6mHtV1RPV3JyfJW5t6n5hh0lXhA=="], + + "@oxc-parser/binding-linux-arm64-musl": ["@oxc-parser/binding-linux-arm64-musl@0.143.0", "", { "os": "linux", "cpu": "arm64" }, "sha512-t1AcYOwEzgceadT4v5e+vaCCb0AncCA3v5AyzfBAz/tMq11qzVccXKzNHtkWdjBsgvTKwRkaUF3QvT4kot8vcQ=="], + + "@oxc-parser/binding-linux-ppc64-gnu": ["@oxc-parser/binding-linux-ppc64-gnu@0.143.0", "", { "os": "linux", "cpu": "ppc64" }, "sha512-RsnO/NoD8376LMJq8JS8TwI0ieNaFRTuNe2GVJntQg6gwZNMENZsEbknHdVwjpOmxdGLGodcwaGSbAeRr5Bgjw=="], + + "@oxc-parser/binding-linux-riscv64-gnu": ["@oxc-parser/binding-linux-riscv64-gnu@0.143.0", "", { "os": "linux", "cpu": "none" }, "sha512-48fSVfR9TZi5CASZFyv0VC6z6BCoeihFsX031mAD/oSH7d9PYsPgIqza7d9mjP7Z2KTEpTFyH6SIu0Ui6R1vdg=="], + + "@oxc-parser/binding-linux-riscv64-musl": ["@oxc-parser/binding-linux-riscv64-musl@0.143.0", "", { "os": "linux", "cpu": "none" }, "sha512-T8CpdD+SfE01DnIOD4HpVxu0ZJOfMJ/VhCvikKfaXAxkZ+9veyLM/D2hpi7Y2hFUyPmVQO3FNZHmYzV/WlVR4g=="], + + "@oxc-parser/binding-linux-s390x-gnu": ["@oxc-parser/binding-linux-s390x-gnu@0.143.0", "", { "os": "linux", "cpu": "s390x" }, "sha512-QLdeMsCcacenPEFsfxnBUDF1y6opyz5+fmOz9bfD5Y7fiGCMupUCuB3KTPQhNwshIG1P9fPqar9MHxuBDd4bwQ=="], + + "@oxc-parser/binding-linux-x64-gnu": ["@oxc-parser/binding-linux-x64-gnu@0.143.0", "", { "os": "linux", "cpu": "x64" }, "sha512-659ujfqLy6k7cuH3sbzhd8b+ztSq+i6E2E9pG78Q0BmHjAExfGIdgc8cGgMdwAozDXeZFHkJ+LXYJdWsaGdgyw=="], + + "@oxc-parser/binding-linux-x64-musl": ["@oxc-parser/binding-linux-x64-musl@0.143.0", "", { "os": "linux", "cpu": "x64" }, "sha512-/Mw/9j4TfZcnKphPrzOE6t4MMknXadcAAuVUlDRTF/ETWB5xOgQvOJV2Mh9We/bWxZdoxaGAdc+hy4GuYwQ2yQ=="], + + "@oxc-parser/binding-openharmony-arm64": ["@oxc-parser/binding-openharmony-arm64@0.143.0", "", { "os": "none", "cpu": "arm64" }, "sha512-8rIKWR2BFuifbIK/1XB9wTaSdtuJ25dlE7ZQYDnEwj/2xH2vHsxnvIjHT3ZjSVuLLwGGlSslIG/fbOJ8TV8rTw=="], + + "@oxc-parser/binding-win32-arm64-msvc": ["@oxc-parser/binding-win32-arm64-msvc@0.143.0", "", { "os": "win32", "cpu": "arm64" }, "sha512-5U9kQYMfRRI6Zq7KDxgbIP0RMnKrfn3gLepRMgJuRkPSUALTiRCk9d/uyhb4lGDjUdzwK7mBkKqhLgzBPCmLpQ=="], + + "@oxc-parser/binding-win32-ia32-msvc": ["@oxc-parser/binding-win32-ia32-msvc@0.143.0", "", { "os": "win32", "cpu": "ia32" }, "sha512-25P7AaHk4R88Yv2XH4gToDVmh0cOu+bEURQU10CRrmvgabfRArSGAP5osmwUKeSUHj0VS50upbpbRWWW/m7mHA=="], + + "@oxc-parser/binding-win32-x64-msvc": ["@oxc-parser/binding-win32-x64-msvc@0.143.0", "", { "os": "win32", "cpu": "x64" }, "sha512-ORMh3JE1s6V7ySicdRK7vgaDQnn5o+UHg9ct989PlWHbel8O9ARrmWXM6kZjrBMtNucxNayQ8g69G0VfWzhANw=="], + + "@oxc-project/types": ["@oxc-project/types@0.143.0", "", {}, "sha512-u6JZdLBTLotrNC9Vd6vPssINdzcCzleKAH6EJKImQb7GtYvX5keN2dxkoK44stCc4tffE6QQRtZTXVSzsLUlWA=="], + + "@oxc-resolver/binding-android-arm-eabi": ["@oxc-resolver/binding-android-arm-eabi@11.24.2", "", { "os": "android", "cpu": "arm" }, "sha512-y09e0L0SRI2OA2tUIrjBgoV3eH5hvUKXNkJqXmNo5V2WxIjyC7I7aJfRLMEVpA8yi95f90gFDvO0VMgrDw+vwA=="], + + "@oxc-resolver/binding-android-arm64": ["@oxc-resolver/binding-android-arm64@11.24.2", "", { "os": "android", "cpu": "arm64" }, "sha512-cl4icWaZFnLdg8m6qtnh5rBMuGbxc/ptStFHLeCNwr+2cZjkjNwQu/jYRS0CHlnPecOJMpuS5M6/BH+0J/YkEg=="], + + "@oxc-resolver/binding-darwin-arm64": ["@oxc-resolver/binding-darwin-arm64@11.24.2", "", { "os": "darwin", "cpu": "arm64" }, "sha512-At29QEMF6HajbQvgY8K6OXnHD1x9rad74xBEfmCB6ZqCGsdq75aK7tOYcTbOanMy8qdIBrfL3SMr3p/lfSlb9w=="], + + "@oxc-resolver/binding-darwin-x64": ["@oxc-resolver/binding-darwin-x64@11.24.2", "", { "os": "darwin", "cpu": "x64" }, "sha512-A5Kqr1EUj4oIL5CF4WRssq/o5P0Y11cwoFouMRmQ7YnC/A8V93nv1nb7aSU8HwcgmXropjLNkVTl4MN87cu28Q=="], + + "@oxc-resolver/binding-freebsd-x64": ["@oxc-resolver/binding-freebsd-x64@11.24.2", "", { "os": "freebsd", "cpu": "x64" }, "sha512-R5xkRBRRz7ceH/P5Jrc6G7FmdUdgpLYyESFAUDVTNQ9K0sGPxcp4ljiwEwEqsvNcQ4sYbMRrWcHHBCu7ksAJVw=="], + + "@oxc-resolver/binding-linux-arm-gnueabihf": ["@oxc-resolver/binding-linux-arm-gnueabihf@11.24.2", "", { "os": "linux", "cpu": "arm" }, "sha512-k/RuYL4L/R58IBn3wT5ma3Wh4k62bp1eYCFRWCmMsasUOqL+H6sW0VGFadEzKWXFFlz+2uIMoeMk9ySSZJHgbg=="], + + "@oxc-resolver/binding-linux-arm-musleabihf": ["@oxc-resolver/binding-linux-arm-musleabihf@11.24.2", "", { "os": "linux", "cpu": "arm" }, "sha512-bnHAak3ujYfH5pKk4NieFNbvYvernfoQDgwLddbZ3OtMYrem87/qjlA+u+aKG0oZcqSLGCful/6/CEA+aeAgaA=="], + + "@oxc-resolver/binding-linux-arm64-gnu": ["@oxc-resolver/binding-linux-arm64-gnu@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-vDT3KHgzYp47gmtNOqL2VNhCyl5Zv643eyxm//A68J8DeUGXrvD1pZFiaT4jSfe+RInfnn1R2yVHye4enx6RnA=="], + + "@oxc-resolver/binding-linux-arm64-musl": ["@oxc-resolver/binding-linux-arm64-musl@11.24.2", "", { "os": "linux", "cpu": "arm64" }, "sha512-+kMlQvbzfyEYtu5FcjE4p+ttBLpKW4d/AsAsuE69BxV6V4twZJeIQZFfD8gh/wqglY0MkPSezWXQH0jBV13MUw=="], + + "@oxc-resolver/binding-linux-ppc64-gnu": ["@oxc-resolver/binding-linux-ppc64-gnu@11.24.2", "", { "os": "linux", "cpu": "ppc64" }, "sha512-shjfMhmZ3gq9fv/w7bi3PnZlgOPG+2QAOFf0BJF0EgBSIGZ6PMLN2zbGEblTUYB/NKVDRyYhE2ff3dJ1QqNPkA=="], + + "@oxc-resolver/binding-linux-riscv64-gnu": ["@oxc-resolver/binding-linux-riscv64-gnu@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-zGelwFR5oRo+b69k8Lrzun86DyUHzfKN6cnjbR9l7Z7NIRznOE/2ZvPa1IUKqAL2PzAXOdwkfVqNvO1H2RlpAw=="], + + "@oxc-resolver/binding-linux-riscv64-musl": ["@oxc-resolver/binding-linux-riscv64-musl@11.24.2", "", { "os": "linux", "cpu": "none" }, "sha512-qxZ1SWCXJY0eyhAlP6Lmo9F2Nrtx7EkYj9oCgL8apDPCwXwCEDA2U697bbT81JIc2IrVjxO4KX6WU2N+oN9Z4w=="], + + "@oxc-resolver/binding-linux-s390x-gnu": ["@oxc-resolver/binding-linux-s390x-gnu@11.24.2", "", { "os": "linux", "cpu": "s390x" }, "sha512-sGCecF3cx2DFlH4t/z7ApnOnXqN48p5p5mlHDEnHTAukQa2P+qMVE4CwyWE9W+q/m3QJ7kKfGrIjax31f44oFQ=="], + + "@oxc-resolver/binding-linux-x64-gnu": ["@oxc-resolver/binding-linux-x64-gnu@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-k/VlMMcSzMlahb3/fENM4rTlsJ0s3fFROA0KXPBmKggqmTSaE383sl8F3KCOXPLmVsYfW6hCitMhXCEtNeZxxg=="], + + "@oxc-resolver/binding-linux-x64-musl": ["@oxc-resolver/binding-linux-x64-musl@11.24.2", "", { "os": "linux", "cpu": "x64" }, "sha512-8hbnZyNi97b/8wapYaIF9+t9GmZKBW2vunaOc3h9HGJptH7b7XpvZqOTBSm/MpTjr7H497BlgOaSfLUdhmy2bw=="], + + "@oxc-resolver/binding-openharmony-arm64": ["@oxc-resolver/binding-openharmony-arm64@11.24.2", "", { "os": "none", "cpu": "arm64" }, "sha512-MvyGik3a6pVgZ0t/kWlbmFxFLmXQJwgLsY2eYFHLpy0wGwRbfzeIGgDwQ3kXqE30z+kSXennRkCrT7TUvkptNg=="], + + "@oxc-resolver/binding-wasm32-wasi": ["@oxc-resolver/binding-wasm32-wasi@11.24.2", "", { "dependencies": { "@emnapi/core": "1.11.2", "@emnapi/runtime": "1.11.2", "@napi-rs/wasm-runtime": "^1.1.6" }, "cpu": "none" }, "sha512-vHcssMPwO08RTvj/c0iOBz90attxyG3wQJ0dTcyEQK43LRpcdLWZlV5feBhv6Isn6ahbQIzHbCgfa81+RiML0Q=="], + + "@oxc-resolver/binding-win32-arm64-msvc": ["@oxc-resolver/binding-win32-arm64-msvc@11.24.2", "", { "os": "win32", "cpu": "arm64" }, "sha512-uokJqro2iBqkFvJdKQLP7d8/BUmFwESQFVmIJUQKj1Xn1a/LysJoe1vmeECLF5b3jsV8CAL5sEMJXX6SdK9Nhg=="], + + "@oxc-resolver/binding-win32-x64-msvc": ["@oxc-resolver/binding-win32-x64-msvc@11.24.2", "", { "os": "win32", "cpu": "x64" }, "sha512-UqGPmo56KDfLlfXFAFIrNflHT8tFxWGEivWg3Zeyp4Uy2NlKN1FGPr6/BxcLGG3+kZ6Wp14g5Uj+n71boqZfiw=="], + + "@smithy/core": ["@smithy/core@3.33.3", "", { "dependencies": { "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-CsOeKq/9kA3y6VJHt+/+VTCtBaxJ4OTFpgrjIUhPpDIKxBci1k2bJaQASF2h/ELWrulGp+t97DZ0mevfAD8idg=="], + + "@smithy/credential-provider-imds": ["@smithy/credential-provider-imds@4.5.2", "", { "dependencies": { "@smithy/core": "^3.33.2", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-A9uSdn72ozbRUSit0eib0TW7nXuNPlaeM0zcGkJ+nE6tFcSDbnmtwoxbTCFBukVQcszDAyvsd7+rTduPTXpygg=="], + + "@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.7.2", "", { "dependencies": { "@smithy/core": "^3.33.2", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-nZyWTmSpJEXl6VtWVMBJve/7x12DZu6sIX1z1a+ZMaHlQQRs9Zpu6NbTe/gmxYXVRpkjxyDYpZ5gx2IM6f/Wkw=="], + + "@smithy/node-http-handler": ["@smithy/node-http-handler@4.11.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-2jY1tSpERfPfWqyBV2pH+iGFaghVsIJszJNsT7hxtQYhVJpWDyc0LqOWI+nXOxOAHaEfZ4PXXtp1wW1TGpHhkA=="], + + "@smithy/signature-v4": ["@smithy/signature-v4@5.7.3", "", { "dependencies": { "@smithy/core": "^3.33.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-7ImGm+FkHRLcBaRttIAMZ6bzJZWb2cJGoYjq46F2UjycujWzrL9GEN9h4w7eQyXJYnltrUhxbbieBAIRrdqpow=="], + + "@smithy/types": ["@smithy/types@4.17.2", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-FOKpVZob9MPTn2znRzGrnsMHv7BOsKVw3XiP/cOyYLDVZ9qKp4nifIiSCuUU/fIj5Vu0UOAxCFr+qRAtG0NUkA=="], + + "@srads/common": ["@srads/common@file:../../packages/common", { "devDependencies": { "@biomejs/biome": "^2.5.10", "@types/node": "^22.0.0", "typescript": "^5.7.0" } }], + + "@tybys/wasm-util": ["@tybys/wasm-util@0.10.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg=="], + + "@types/aws-lambda": ["@types/aws-lambda@8.10.162", "", {}, "sha512-Fn658grtLOci1oxi1391vvDWJRKNGWRSqfxRkmN/Iy3c0tQH1USMKEXcPYHLvope+ZgTFocx9FRQJx1muBL6qw=="], + + "@types/node": ["@types/node@22.20.1", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-EANqOCF9QFyra+4pfxUcX9STKJpCLjMbObVzljIJomAWSnuSIEAvyzEU53GaajbXJEgdh0iEcPL+DGvpUd4k1Q=="], + + "bowser": ["bowser@2.14.1", "", {}, "sha512-tzPjzCxygAKWFOJP011oxFHs57HzIhOEracIgAePE4pqB3LikALKnSzUyU4MGs9/iCEUuHlAJTjTc5M+u7YEGg=="], + + "fd-package-json": ["fd-package-json@2.0.0", "", { "dependencies": { "walk-up-path": "^4.0.0" } }, "sha512-jKmm9YtsNXN789RS/0mSzOC1NUq9mkVd65vbSSVsKdjGvYXBuE4oWe2QOEoFeRmJg+lPuZxpmrfFclNhoRMneQ=="], + + "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], + + "formatly": ["formatly@0.3.0", "", { "dependencies": { "fd-package-json": "^2.0.0" }, "bin": { "formatly": "bin/index.mjs" } }, "sha512-9XNj/o4wrRFyhSMJOvsuyMwy8aUfBaZ1VrqHVfohyXf0Sw0e+yfKG+xZaY3arGCOMdwFsqObtzVOc1gU9KiT9w=="], + + "get-tsconfig": ["get-tsconfig@4.14.1", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-Dz/6HxkrxgNehhxLVeyv8sad9UzF2xBVeaKBQNDfJ5XiSXmp2gTR0eO0RWiT2NCKS5aGP9jjkOMggTN90qU50A=="], + + "jiti": ["jiti@2.7.0", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ=="], + + "knip": ["knip@6.32.3", "", { "dependencies": { "fdir": "^6.5.0", "formatly": "^0.3.0", "get-tsconfig": "4.14.1", "jiti": "^2.7.0", "oxc-parser": "^0.143.0", "oxc-resolver": "11.24.2", "picomatch": "^4.0.5", "smol-toml": "^1.7.1", "strip-json-comments": "5.0.3", "tinyglobby": "^0.2.17", "unbash": "^4.0.9", "yaml": "^2.9.0", "zod": "^4.4.3" }, "bin": { "knip": "bin/knip.js", "knip-bun": "bin/knip-bun.js" } }, "sha512-wOJ1Av8PwKqFO0wU7F64vzIcUjxhrieA3Tc2lmeK9C9prpxq+TeG2ewNH5tCaBVZwXNPp6lJkrr+IhZ20iqkMA=="], + + "mnemonist": ["mnemonist@0.38.3", "", { "dependencies": { "obliterator": "^1.6.1" } }, "sha512-2K9QYubXx/NAjv4VLq1d1Ly8pWNC5L3BrixtdkyTegXWJIqY+zLNDhhX/A+ZwWt70tB1S8H4BE8FLYEFyNoOBw=="], + + "obliterator": ["obliterator@1.6.1", "", {}, "sha512-9WXswnqINnnhOG/5SLimUlzuU1hFJUc8zkwyD59Sd+dPOMf05PmnYG/d6Q7HZ+KmgkZJa1PxRso6QdM3sTNHig=="], + + "oxc-parser": ["oxc-parser@0.143.0", "", { "dependencies": { "@oxc-project/types": "^0.143.0" }, "optionalDependencies": { "@oxc-parser/binding-android-arm-eabi": "0.143.0", "@oxc-parser/binding-android-arm64": "0.143.0", "@oxc-parser/binding-darwin-arm64": "0.143.0", "@oxc-parser/binding-darwin-x64": "0.143.0", "@oxc-parser/binding-freebsd-x64": "0.143.0", "@oxc-parser/binding-linux-arm-gnueabihf": "0.143.0", "@oxc-parser/binding-linux-arm-musleabihf": "0.143.0", "@oxc-parser/binding-linux-arm64-gnu": "0.143.0", "@oxc-parser/binding-linux-arm64-musl": "0.143.0", "@oxc-parser/binding-linux-ppc64-gnu": "0.143.0", "@oxc-parser/binding-linux-riscv64-gnu": "0.143.0", "@oxc-parser/binding-linux-riscv64-musl": "0.143.0", "@oxc-parser/binding-linux-s390x-gnu": "0.143.0", "@oxc-parser/binding-linux-x64-gnu": "0.143.0", "@oxc-parser/binding-linux-x64-musl": "0.143.0", "@oxc-parser/binding-openharmony-arm64": "0.143.0", "@oxc-parser/binding-win32-arm64-msvc": "0.143.0", "@oxc-parser/binding-win32-ia32-msvc": "0.143.0", "@oxc-parser/binding-win32-x64-msvc": "0.143.0" } }, "sha512-ov0NzaDCOInknS7mP1cwKdJERt3utPW8ldjtdUXQ8Ty0GEFD08wk422vCUN0d7pST6kqtV7dxoI9w1Zi0l/9TA=="], + + "oxc-resolver": ["oxc-resolver@11.24.2", "", { "optionalDependencies": { "@oxc-resolver/binding-android-arm-eabi": "11.24.2", "@oxc-resolver/binding-android-arm64": "11.24.2", "@oxc-resolver/binding-darwin-arm64": "11.24.2", "@oxc-resolver/binding-darwin-x64": "11.24.2", "@oxc-resolver/binding-freebsd-x64": "11.24.2", "@oxc-resolver/binding-linux-arm-gnueabihf": "11.24.2", "@oxc-resolver/binding-linux-arm-musleabihf": "11.24.2", "@oxc-resolver/binding-linux-arm64-gnu": "11.24.2", "@oxc-resolver/binding-linux-arm64-musl": "11.24.2", "@oxc-resolver/binding-linux-ppc64-gnu": "11.24.2", "@oxc-resolver/binding-linux-riscv64-gnu": "11.24.2", "@oxc-resolver/binding-linux-riscv64-musl": "11.24.2", "@oxc-resolver/binding-linux-s390x-gnu": "11.24.2", "@oxc-resolver/binding-linux-x64-gnu": "11.24.2", "@oxc-resolver/binding-linux-x64-musl": "11.24.2", "@oxc-resolver/binding-openharmony-arm64": "11.24.2", "@oxc-resolver/binding-wasm32-wasi": "11.24.2", "@oxc-resolver/binding-win32-arm64-msvc": "11.24.2", "@oxc-resolver/binding-win32-x64-msvc": "11.24.2" } }, "sha512-FY91FiDBj7ls5MsFS9jN3tjz2o0/zsdSsymlakySaBwVJZorHhkWyICLZMKxlu1R9vYo+sd3z1jwb4J8x7bNDw=="], + + "picomatch": ["picomatch@4.0.7", "", {}, "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA=="], + + "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], + + "serverless": ["serverless@4.41.1", "", { "dependencies": { "undici": "6.28.0" }, "bin": { "sls": "run.js", "serverless": "run.js" } }, "sha512-vjnXUv8RDgzpaVZnrNRIBui9C2injCn6xWt5toUHNvLPPmvy5ECZuS38AENbBTw+2a8WTfmmWz7ob24vi7TJrA=="], + + "smol-toml": ["smol-toml@1.8.0", "", {}, "sha512-kCZr2V3ch9i00x8zXRhjUNVcjG9ijES5dDudkXvUVCT5QlJNQWElSJdZqyPemffHoLNUYwOcou0Fy+ojN0uHSQ=="], + + "strip-json-comments": ["strip-json-comments@5.0.3", "", {}, "sha512-1tB5mhVo7U+ETBKNf92xT4hrQa3pm0MZ0PQvuDnWgAAGHDsfp4lPSpiS6psrSiet87wyGPh9ft6wmhOMQ0hDiw=="], + + "tinyglobby": ["tinyglobby@0.2.17", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.4" } }, "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g=="], + + "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + + "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "unbash": ["unbash@4.0.10", "", {}, "sha512-b7zoBQvpWp0vuN5q2vK2RRBR2SvuruQAs50DApdDveBSn3eSYd84IaHodFqQIMlvY9K2VnyBUEXgwOBuGU9GBg=="], + + "undici": ["undici@6.28.0", "", {}, "sha512-LIY910g9TI13YS95lrMFrs8Rm/u/irgHeTWoKCoteeJ04CUJ92eEfj0rVn+7VKMPBpUPiUoBKfhNyLI23EE/KA=="], + + "undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="], + + "walk-up-path": ["walk-up-path@4.0.0", "", {}, "sha512-3hu+tD8YzSLGuFYtPRb48vdhKMi0KQV5sn+uWr8+7dMEq/2G/dtLrdDinkLjqq5TIbIBjYJ4Ax/n3YiaW7QM8A=="], + + "yaml": ["yaml@2.9.0", "", { "bin": { "yaml": "bin.mjs" } }, "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA=="], + + "zod": ["zod@4.4.3", "", {}, "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ=="], + + "@aws-sdk/client-ssm/@aws-sdk/core": ["@aws-sdk/core@3.981.0", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@aws-sdk/xml-builder": "^3.972.43", "@aws/lambda-invoke-store": "^0.3.0", "@smithy/core": "^3.40.0", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "bowser": "^2.11.0", "tslib": "^2.6.2" } }, "sha512-Mnu7gaDrC5UCdyH8uLxLfB2eWbjE/HbjKX1U1J2VQxG3TTATUDObW2wU3I8iH3e9YH5NN2CY6w1mlAIe2XJ3jg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node": ["@aws-sdk/credential-provider-node@3.972.97", "", { "dependencies": { "@aws-sdk/credential-provider-env": "^3.972.84", "@aws-sdk/credential-provider-http": "^3.972.86", "@aws-sdk/credential-provider-ini": "^3.973.30", "@aws-sdk/credential-provider-process": "^3.972.84", "@aws-sdk/credential-provider-sso": "^3.973.28", "@aws-sdk/credential-provider-web-identity": "^3.972.90", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-E4a0IXXJVsIdo/K9roX4JAEfI0JJr7KTPymkbKgETRDqEcLygE4ZlLTe24+7Qkh8Dl5YpnPd+Tt0DOPJDFXIwA=="], + + "@aws-sdk/client-ssm/@aws-sdk/types": ["@aws-sdk/types@3.975.1", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-7rGxUkCB2QPoQOeJmonmAICTN2zrH+fpmi1p4Iwu72lnxNaMhOgqcbpyddifnM1DBb19TWQ1u6z/XjkaFNEDWw=="], + + "@aws-sdk/client-ssm/@smithy/core": ["@smithy/core@3.40.0", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-DssGno52pzZ5m6RlDtyKuBIpZNPg9pqgs0CnNDKz9IatxCsmvNmJNn5Zn6rf77MthZo9wf89OvZFhTY/RwxhxQ=="], + + "@aws-sdk/client-ssm/@smithy/fetch-http-handler": ["@smithy/fetch-http-handler@5.8.1", "", { "dependencies": { "@smithy/core": "^3.39.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-h8BdMUrUBhMhMaeK7QqAdINRZezCGuYOCpcOZZ1ewxbHST9rdTd09xwNpvLTYfzDRehxQiReK4SKbdYZxBA+ew=="], + + "@aws-sdk/client-ssm/@smithy/node-http-handler": ["@smithy/node-http-handler@4.14.2", "", { "dependencies": { "@smithy/core": "^3.39.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-i1uORV1v3qBqP43ayRKzIdm1q5x14tf8N4Dd06/QUX1Szm6VxHMrTsu20X5E63UFsaNZCRjI4SXG0jDmqYa+3w=="], + + "@aws-sdk/client-ssm/@smithy/types": ["@smithy/types@4.20.0", "", { "dependencies": { "tslib": "^2.6.2" } }, "sha512-lCA6QG22dPk9ecHbv91jDQZsmtPUjdS1aE2Il6NNPqe7DrYc0dZQi6DhcESk2KYXH2sp5xbAcGdYMZDFnuzA2A=="], + + "@aws-sdk/client-ssm/@aws-sdk/core/@aws-sdk/xml-builder": ["@aws-sdk/xml-builder@3.972.43", "", { "dependencies": { "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-rG8QVx4DOrJWptsogu1Aq+CDsnPKaBrAlJpKLxrJrIDXAq1ElnW0yQjjBnlWSXll0cDakCG6UDvaqwz0A9d9Og=="], + + "@aws-sdk/client-ssm/@aws-sdk/core/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-env": ["@aws-sdk/credential-provider-env@3.972.84", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-akZJetiMVeLRHsKzYh3LamDCo74ZUCeo0XoyRKMEMZT5qP7ReM6LhpioBCyuqKP5Vav5gEOeCmaQV0VVQr1Meg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-http": ["@aws-sdk/credential-provider-http@3.972.86", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-U4mHaDRPWAn63yhl7FXIzbppNmW1F+4dSLeuiUpej2v3Xb6rGwvayEJ8SdlrdMV+/mZtd+GStTEP2HqurEzXtw=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini": ["@aws-sdk/credential-provider-ini@3.973.30", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/credential-provider-env": "^3.972.84", "@aws-sdk/credential-provider-http": "^3.972.86", "@aws-sdk/credential-provider-login": "^3.972.92", "@aws-sdk/credential-provider-process": "^3.972.84", "@aws-sdk/credential-provider-sso": "^3.973.28", "@aws-sdk/credential-provider-web-identity": "^3.972.90", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/credential-provider-imds": "^4.5.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-r6r6499GWoGN943NA5YEhBEQ6TEOGTf7tTOBhHd/zw0UbNvSzd1/zPCNcDkPmRarA+e24X7KgxutqxjoWcskBg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-process": ["@aws-sdk/credential-provider-process@3.972.84", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-199C6OpNejd0nq9GFAkEFIKids1FL0R6LJtL9c1OTiDOXki7S1OduuPxW4+hE0LwndcYJ7YHOuYTlqScfpCocA=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso": ["@aws-sdk/credential-provider-sso@3.973.28", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/token-providers": "3.1166.0", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-bGg7wH8wVDJQIcJggO9lg1ZYbG7l+PbLwHuM3Bi/e1TlCZhU712JS1W3tdRpyptdJD1UGyhBNGO/YrhrQCHKbg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity": ["@aws-sdk/credential-provider-web-identity@3.972.90", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-duLeE3xlf0viHeH+1RM4z5duR3b32BCZTWVMu+MbxFPjQBxy7hmIGEqt5hekuFPRuXoyhMovjNl+PNNsb5oiGQ=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/credential-provider-login": ["@aws-sdk/credential-provider-login@3.972.92", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-96bcp9Pe/Xd60OEwncZ+kAQTQSu+fJnpUGz1qE6ghF5jnETmrk8XMU86mIP3lolvnCgR61XbZ+Ht6hdBjiQOmQ=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/token-providers": ["@aws-sdk/token-providers@3.1166.0", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/nested-clients": "^3.998.3", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-ngJ8mxXqtQ9mnp7QV6TWKJCxkpjVfPWxKQSc2FYhCyCfOVFIGdFv7P+/RqVffFrJAorwBPpktnv32gNlcEgF4g=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients": ["@aws-sdk/nested-clients@3.998.3", "", { "dependencies": { "@aws-sdk/core": "^3.981.0", "@aws-sdk/signature-v4-multi-region": "^3.996.52", "@aws-sdk/types": "^3.975.1", "@smithy/core": "^3.40.0", "@smithy/fetch-http-handler": "^5.8.1", "@smithy/node-http-handler": "^4.14.2", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-acHTTzMB13CU6dU4sxABYExMI3PQM2zStWH2MiUwJp/7QKTrLg2f7mbzSXoegW2kYOk2tdqQYagsZrWB8Xv7eA=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region": ["@aws-sdk/signature-v4-multi-region@3.996.52", "", { "dependencies": { "@aws-sdk/types": "^3.975.1", "@smithy/signature-v4": "^5.7.5", "@smithy/types": "^4.20.0", "tslib": "^2.6.2" } }, "sha512-6W6SjGc8OXUhMzNxU1X922ghD+PP1XvzmCk5Scui0jaYsLezycMYR1RaLp5xTIOUrhTXyb4DnAbPr3fBgmdnzg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-ini/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-sso/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], + + "@aws-sdk/client-ssm/@aws-sdk/credential-provider-node/@aws-sdk/credential-provider-web-identity/@aws-sdk/nested-clients/@aws-sdk/signature-v4-multi-region/@smithy/signature-v4": ["@smithy/signature-v4@5.7.5", "", { "dependencies": { "@smithy/core": "^3.38.0", "@smithy/types": "^4.19.0", "tslib": "^2.6.2" } }, "sha512-WPjdr5oWOk1LArpI4pavu+fSo+/evi0Re1olxGvqwuZopd4gYR1UGCi+Soyn/IjmafqbWs+ZC+3AKxJS3ZpwUg=="], + } +} diff --git a/secure/result-consumer/knip.json b/secure/result-consumer/knip.json new file mode 100644 index 00000000..0fbf4f39 --- /dev/null +++ b/secure/result-consumer/knip.json @@ -0,0 +1,12 @@ +{ + "$schema": "https://unpkg.com/knip@6/schema.json", + "entry": [ + "src/handlers/*.ts" + ], + "project": [ + "src/**/*.ts" + ], + "ignoreDependencies": [ + "@aws-sdk/client-ssm" + ] +} diff --git a/secure/result-consumer/package.json b/secure/result-consumer/package.json new file mode 100644 index 00000000..c6f11583 --- /dev/null +++ b/secure/result-consumer/package.json @@ -0,0 +1,28 @@ +{ + "name": "result-consumer", + "version": "0.1.0", + "private": true, + "type": "module", + "scripts": { + "deploy": "serverless deploy", + "remove": "serverless remove", + "typecheck": "tsc --noEmit", + "lint": "biome check src", + "lint:fix": "biome check --write src", + "knip": "knip" + }, + "devDependencies": { + "@biomejs/biome": "^2.5.10", + "@types/aws-lambda": "^8.10.152", + "@types/node": "^22.0.0", + "knip": "^6.32.2", + "serverless": "^4.4.0", + "typescript": "^5.7.0" + }, + "dependencies": { + "@aws-sdk/client-dynamodb": "^3.700.0", + "@aws-sdk/lib-dynamodb": "^3.700.0", + "@srads/common": "file:../../packages/common", + "@aws-sdk/client-ssm": "^3.700.0" + } +} diff --git a/secure/result-consumer/serverless.yml b/secure/result-consumer/serverless.yml new file mode 100644 index 00000000..946e10b5 --- /dev/null +++ b/secure/result-consumer/serverless.yml @@ -0,0 +1,53 @@ +service: secure-rads-result-consumer + +build: + esbuild: + format: cjs + outExtension: + ".js": ".cjs" + +provider: + name: aws + runtime: nodejs24.x + region: ${env:AWS_REGION} + iam: + role: + statements: + - Effect: Allow + Action: dynamodb:PutItem + Resource: !GetAtt RunResultsTable.Arn + environment: + RUN_RESULTS_TABLE: !Ref RunResultsTable + VERIFIER_ATTEST_HOST: ${env:VERIFIER_ATTEST_HOST} + VERIFIER_ATTEST_PUBKEY_SHA256: ${env:VERIFIER_PUBKEY_SHA256} + TELEMETRY_HOST: ${env:TELEMETRY_HOST_SECURE_RADS} + COST_HOST: ${env:COST_HOST_SECURE_RADS} + +functions: + receive: + handler: src/handlers/receive.handler + events: + - httpApi: + method: POST + path: /results + +resources: + Resources: + RunResultsTable: + Type: AWS::DynamoDB::Table + Properties: + BillingMode: PAY_PER_REQUEST + AttributeDefinitions: + - AttributeName: RunId + AttributeType: S + KeySchema: + - AttributeName: RunId + KeyType: HASH + + Outputs: + ResultWebhookUrl: + Value: !Sub "https://${HttpApi}.execute-api.${AWS::Region}.amazonaws.com/results" + RunResultsTableName: + Value: !Ref RunResultsTable + RunResultsTableArn: + Value: !GetAtt RunResultsTable.Arn diff --git a/secure/result-consumer/src/handlers/receive.ts b/secure/result-consumer/src/handlers/receive.ts new file mode 100644 index 00000000..5e6f7c4e --- /dev/null +++ b/secure/result-consumer/src/handlers/receive.ts @@ -0,0 +1,67 @@ +import { DynamoDBClient } from "@aws-sdk/client-dynamodb"; +import { DynamoDBDocumentClient, PutCommand } from "@aws-sdk/lib-dynamodb"; +import { CostPhase, costEvent, recordRequest } from "@srads/common/cost"; +import { requiredEnv } from "@srads/common/env"; +import { emitEvent } from "@srads/common/log"; +import type { APIGatewayProxyHandlerV2 } from "aws-lambda"; +import { fetchRunAttestation } from "../lib/attestation.js"; +import { type SignedResultMessage, verifySignedResult } from "../lib/verify.js"; + +const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); +const table = requiredEnv("RUN_RESULTS_TABLE"); +const verifierAttestHost = requiredEnv("VERIFIER_ATTEST_HOST"); +const verifierAttestPin = requiredEnv("VERIFIER_ATTEST_PUBKEY_SHA256"); + +function jsonResponse(statusCode: number, body: unknown) { + return { statusCode, headers: { "content-type": "application/json" }, body: JSON.stringify(body) }; +} + +// Receives the enclave's signed result envelope over HTTPS, verifies it against the attested run key, and +// persists the verified fields for GET /run/{runId}. A bad signature is rejected; a DynamoDB error is a 500 +// so the enclave's webhook retry can try again. +export const handler: APIGatewayProxyHandlerV2 = async (event) => { + const startedAt = process.hrtime.bigint(); + let message: SignedResultMessage; + try { + message = JSON.parse(event.body ?? "") as SignedResultMessage; + } catch { + return jsonResponse(400, { error: "invalid JSON" }); + } + if (typeof message.runId !== "string") return jsonResponse(400, { error: "runId is required" }); + + const attested = await fetchRunAttestation(verifierAttestHost, verifierAttestPin, message.runId); + if (!attested || attested.runId !== message.runId) { + return jsonResponse(404, { error: "run has not attested" }); + } + + const result = verifySignedResult(message, attested.algorithmId, attested.publicKey); + if (!result) return jsonResponse(401, { error: "invalid signature" }); + + const write = await ddb.send( + new PutCommand({ + TableName: table, + Item: { + RunId: result.runId, + InstanceId: typeof message.instanceId === "string" ? message.instanceId : undefined, + AlgorithmId: result.algorithmId, + Status: result.status, + Output: result.output, + Diag: result.diag, + ReceivedAt: new Date().toISOString(), + }, + ReturnConsumedCapacity: "TOTAL", + }), + ); + + await costEvent( + result.algorithmId, + result.runId, + CostPhase.Execution, + "dynamodb", + "write-capacity", + write.ConsumedCapacity?.CapacityUnits ?? 0, + ); + await recordRequest(result.algorithmId, result.runId, CostPhase.Execution, startedAt); + await emitEvent(result.algorithmId, result.runId, "result-persisted", { status: result.status }); + return jsonResponse(200, { runId: result.runId }); +}; diff --git a/secure/result-consumer/src/lib/attestation.ts b/secure/result-consumer/src/lib/attestation.ts new file mode 100644 index 00000000..aba57218 --- /dev/null +++ b/secure/result-consumer/src/lib/attestation.ts @@ -0,0 +1,47 @@ +import https from "node:https"; +import { pinnedServerIdentity } from "@srads/common/tls"; + +export interface RunAttestation { + runId: string; + algorithmId: string; + publicKey: string; +} + +// Fetches the key verifier-service bound to this run during attestation. The response is pinned to the +// verifier leaf SPKI, the same way downstream services pin the JWKS endpoint. +export function fetchRunAttestation( + host: string, + pinSha256: string, + runId: string, +): Promise { + const checkServerIdentity = pinnedServerIdentity(pinSha256, "verifier attestation server"); + const url = new URL(`https://${host}/runs/${encodeURIComponent(runId)}`); + + return new Promise((resolve, reject) => { + https + .get(url, { rejectUnauthorized: true, checkServerIdentity }, async (res) => { + try { + const chunks: Buffer[] = []; + for await (const chunk of res) chunks.push(chunk as Buffer); + if (res.statusCode === 404) { + resolve(undefined); + return; + } + if (res.statusCode !== 200) throw new Error(`run attestation fetch returned ${res.statusCode}`); + + const parsed = JSON.parse(Buffer.concat(chunks).toString("utf8")) as Record; + if ( + typeof parsed.runId !== "string" || + typeof parsed.algorithmId !== "string" || + typeof parsed.publicKey !== "string" + ) { + throw new Error("unexpected run attestation response shape"); + } + resolve({ runId: parsed.runId, algorithmId: parsed.algorithmId, publicKey: parsed.publicKey }); + } catch (err) { + reject(err); + } + }) + .on("error", reject); + }); +} diff --git a/secure/result-consumer/src/lib/verify.ts b/secure/result-consumer/src/lib/verify.ts new file mode 100644 index 00000000..0bea0206 --- /dev/null +++ b/secure/result-consumer/src/lib/verify.ts @@ -0,0 +1,80 @@ +import { createPublicKey, verify as verifySignature } from "node:crypto"; + +const SIGNATURE_CONTEXT = "sce-result-v1\n"; + +export interface SignedResultMessage { + runId?: unknown; + algorithmId?: unknown; + instanceId?: unknown; + payload?: unknown; + signature?: unknown; +} + +export interface VerifiedResult { + runId: string; + algorithmId: string; + status: string; + output: string; + diag: unknown; +} + +interface ResultPayload { + runId: string; + algorithmId: string; + status: string; + output: string; + diag?: unknown; +} + +function isResultPayload(value: unknown): value is ResultPayload { + if (typeof value !== "object" || value === null) return false; + const payload = value as Record; + return ( + typeof payload.runId === "string" && + typeof payload.algorithmId === "string" && + typeof payload.status === "string" && + typeof payload.output === "string" + ); +} + +// The enclave signs the exact payload bytes it sent, so verification never depends on JSON re-serialization. +export function verifySignedResult( + message: SignedResultMessage, + attestedAlgorithmId: string, + publicKeyBase64: string, +): VerifiedResult | undefined { + if ( + typeof message.runId !== "string" || + typeof message.payload !== "string" || + typeof message.signature !== "string" + ) { + return undefined; + } + + let payload: unknown; + try { + payload = JSON.parse(Buffer.from(message.payload, "base64").toString("utf8")); + } catch { + return undefined; + } + if (!isResultPayload(payload)) return undefined; + if (payload.runId !== message.runId || payload.algorithmId !== attestedAlgorithmId) return undefined; + + try { + const payloadBytes = Buffer.from(message.payload, "base64"); + const key = createPublicKey({ key: Buffer.from(publicKeyBase64, "base64"), format: "der", type: "spki" }); + const signature = Buffer.from(message.signature, "base64"); + const signedBytes = Buffer.concat([Buffer.from(SIGNATURE_CONTEXT), payloadBytes]); + if (!verifySignature("sha256", signedBytes, { key, dsaEncoding: "der" }, signature)) return undefined; + } catch { + return undefined; + } + + return { + runId: payload.runId, + algorithmId: payload.algorithmId, + status: payload.status, + output: payload.output, + diag: payload.diag ?? null, + }; +} diff --git a/secure/result-consumer/tsconfig.json b/secure/result-consumer/tsconfig.json new file mode 100644 index 00000000..16a7162b --- /dev/null +++ b/secure/result-consumer/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "ES2022", + "moduleResolution": "bundler", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "noEmit": true + }, + "include": ["src/**/*.ts"] +} diff --git a/secure/sce/Makefile b/secure/sce/Makefile index 86690058..187039e6 100644 --- a/secure/sce/Makefile +++ b/secure/sce/Makefile @@ -12,6 +12,10 @@ ALGORITHM_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure --query "Stacks[0].Outputs[?OutputKey=='AlgorithmTableName'].OutputValue" --output text) PDM_MTLS_HOST = $(shell aws cloudformation describe-stacks --stack-name secure-rads-pdm-service-dev --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='PdmMtlsHost'].OutputValue" --output text) +RUN_RESULTS_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ + --query "Stacks[0].Outputs[?OutputKey=='RunResultsTableName'].OutputValue" --output text) +RESULT_WEBHOOK_URL = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ + --query "Stacks[0].Outputs[?OutputKey=='ResultWebhookUrl'].OutputValue" --output text) API_URL = $(shell aws cloudformation describe-stacks --stack-name $(STACK_NAME) --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='ExecutionApiUrl'].OutputValue" --output text) @@ -24,6 +28,8 @@ deploy: env-check --param="artifactBucket=$(ARTIFACT_BUCKET)" \ --param="algorithmTable=$(ALGORITHM_TABLE)" \ --param="pdmMtlsHost=$(PDM_MTLS_HOST)" \ + --param="runResultsTable=$(RUN_RESULTS_TABLE)" \ + --param="resultWebhookUrl=$(RESULT_WEBHOOK_URL)" \ --param="enclaveInstanceType=c6g.large" destroy: diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index 4c247c0a..fd5de5ec 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -4,20 +4,24 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given `POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. The check calls PDM's `/count` endpoint over mTLS with a client certificate fetched from SSM; this Lambda has no DynamoDB access to PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. -The request requires a webhook URL: +The request accepts an optional `webhookUrl`: ```json { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -The URL must be `https` and must not target localhost or an obvious private/internal address. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. The DC verifies the envelope with verifier-service `GET /runs/{runId}`. There is no result SQS queue or result table. +When omitted, results go to secure-rads-result-consumer's HTTPS receiver and `GET /run/{runId}` returns them. When provided, the URL must be `https` and must not target localhost or an obvious private/internal address; the signed result goes to that DC webhook instead and `GET /run/{runId}` stays `pending`. -The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. SCE-unit emits the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). +The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope over CA-verified TLS. For the internal receiver, result-consumer verifies the signature and writes the RunResults table. For a DC webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}`. + +`GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result for internally delivered runs. `algorithmId` is required so every poll can be attributed to its run. + +The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. result-consumer emits `result-persisted` for internally delivered runs. SCE-unit and result-consumer emit the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). See [../README.md](../README.md) for the full SCE context. ## Deployment -`make -C sce deploy` deploys the Lambda stack. It requires registry-service storage, verifier-service, and kms-service to exist first. +`make -C sce deploy` deploys the Lambda stack. It requires registry-service storage, verifier-service, result-consumer, and kms-service to exist first. The enclave host pulls the EIF but does not publish the result; it has no algorithm-key KMS permission. Data-key decryption runs in kms-service, so the per-algorithm key policy names the kms-service role rather than this per-deployment host role. `KMS_HOST` is passed as `KMS_SERVICE_HOST` and baked into the host user data, which proxies the enclave's `/decrypt` call. diff --git a/secure/sce/execution-service/serverless.yml b/secure/sce/execution-service/serverless.yml index 7c7782e4..eb52ceac 100644 --- a/secure/sce/execution-service/serverless.yml +++ b/secure/sce/execution-service/serverless.yml @@ -19,7 +19,9 @@ provider: statements: - Effect: Allow Action: dynamodb:GetItem - Resource: !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:algorithmTable}" + Resource: + - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:algorithmTable}" + - !Sub "arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/${param:runResultsTable}" - Effect: Allow Action: ssm:GetParameter Resource: @@ -51,6 +53,8 @@ provider: Resource: !GetAtt EnclaveHostInstanceRole.Arn environment: ALGORITHM_TABLE: ${param:algorithmTable} + RUN_RESULTS_TABLE: ${param:runResultsTable} + RESULT_WEBHOOK_URL: ${param:resultWebhookUrl} # Pinned to match rads EXECUTOR_AMI_ID so both trees boot the same AL2023 arm64 build. ENCLAVE_AMI_ID: ${env:SCE_ENCLAVE_AMI_ID} ENCLAVE_INSTANCE_TYPE: ${param:enclaveInstanceType, 'c6g.large'} @@ -76,6 +80,13 @@ functions: - httpApi: method: POST path: /run + result: + handler: src/handlers/run.result + timeout: 10 + events: + - httpApi: + method: GET + path: /run/{runId} resources: Resources: diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index a530da4c..8e2f9af9 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -12,6 +12,8 @@ import { userData } from "../lib/userdata.js"; const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const ec2 = new EC2Client({}); const algorithmTable = requiredEnv("ALGORITHM_TABLE"); +const runResultsTable = requiredEnv("RUN_RESULTS_TABLE"); +const resultWebhookUrl = requiredEnv("RESULT_WEBHOOK_URL"); const enclaveAmiId = requiredEnv("ENCLAVE_AMI_ID"); const enclaveInstanceType = requiredEnv("ENCLAVE_INSTANCE_TYPE") as RunInstancesCommandInput["InstanceType"]; const enclaveAz = requiredEnv("ENCLAVE_AZ"); @@ -29,7 +31,17 @@ const region = requiredEnv("AWS_REGION"); interface RunRequest { algorithmId: string; size?: number; - webhookUrl: string; + webhookUrl?: string; +} + +interface RunResult { + AlgorithmId?: string; + Diag?: unknown; + InstanceId?: string; + Output?: string; + ReceivedAt?: string; + RunId?: string; + Status?: string; } const PRIVATE_HOST = @@ -71,8 +83,12 @@ function parseRunRequest(body: string | undefined): RunRequest | undefined { return undefined; } const webhook = parseWebhookUrl(webhookUrl); - if (typeof webhook !== "string") return undefined; - return { algorithmId, webhookUrl: webhook, ...(size === undefined ? {} : { size }) }; + if (webhook === null) return undefined; + return { + algorithmId, + ...(size === undefined ? {} : { size }), + ...(webhook === undefined ? {} : { webhookUrl: webhook }), + }; } catch { return undefined; } @@ -156,7 +172,7 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { s3Key: record.S3Key, size: request.size, verifierHost, - webhookUrl: request.webhookUrl, + webhookUrl: request.webhookUrl ?? resultWebhookUrl, }), ).toString("base64"), TagSpecifications: [ @@ -183,3 +199,41 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { return jsonResponse(500, { error: "launch failed" }); } }; + +export const result: APIGatewayProxyHandlerV2 = async (event) => { + const startedAt = process.hrtime.bigint(); + const runId = event.pathParameters?.runId; + if (!runId) return jsonResponse(400, { error: "runId is required" }); + const algorithmId = event.queryStringParameters?.algorithmId; + if (!algorithmId) return jsonResponse(400, { error: "algorithmId is required" }); + + try { + const response = await ddb.send( + new GetCommand({ TableName: runResultsTable, Key: { RunId: runId }, ReturnConsumedCapacity: "TOTAL" }), + ); + const item = response.Item as RunResult | undefined; + const costAlgorithmId = item?.AlgorithmId ?? algorithmId; + await costEvent( + costAlgorithmId, + runId, + CostPhase.Execution, + "dynamodb", + "read-capacity", + response.ConsumedCapacity?.CapacityUnits ?? 0, + ); + await recordRequest(costAlgorithmId, runId, CostPhase.Execution, startedAt); + if (!item) return jsonResponse(200, { runId, status: "pending" }); + return jsonResponse(200, { + runId: item.RunId, + instanceId: item.InstanceId, + algorithmId: item.AlgorithmId, + status: item.Status, + output: item.Output, + diag: item.Diag, + receivedAt: item.ReceivedAt, + }); + } catch (error) { + console.error("result lookup failed", error); + return jsonResponse(500, { error: "result lookup failed" }); + } +}; diff --git a/secure/telemetry-service/README.md b/secure/telemetry-service/README.md index 41900d3b..a1d17229 100644 --- a/secure/telemetry-service/README.md +++ b/secure/telemetry-service/README.md @@ -10,7 +10,7 @@ Serverless Framework v4, TypeScript. Diagnostic timeline for performance, test, Both export routes take `?format=csv` (`text/csv`) or default to JSON. CSV columns: `algorithmId,runId,event,timestamp,receivedAt,origin,detail`. -Producers: registry-service build events, execution-service control-plane events, the host-reported checkpoints, and the enclave run timeline. +Producers: registry-service build events, execution-service control-plane events, the host-reported checkpoints, the enclave run timeline, and result-consumer `result-persisted`. ## Queue diff --git a/secure/telemetry-service/src/lib/events.ts b/secure/telemetry-service/src/lib/events.ts index 896d166f..efb13d3d 100644 --- a/secure/telemetry-service/src/lib/events.ts +++ b/secure/telemetry-service/src/lib/events.ts @@ -17,7 +17,7 @@ export const ENCLAVE_EVENTS = [ // instead of being presented as enclave claims. export const HOST_EVENTS = ["executor-ready", "artifact-retrieved", "enclave-launched", "executor-finished"] as const; -// Control-plane producers: registry-service and execution-service. +// Control-plane producers: registry-service, execution-service, and result-consumer. export const INTERNAL_EVENTS = [ "build-started", "build-completed", @@ -29,6 +29,7 @@ export const INTERNAL_EVENTS = [ "run-requested", "executor-launched", "launch-failed", + "result-persisted", ] as const; export const RUN_EVENTS = [ diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index a7ffb767..3b8c89df 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -27,7 +27,7 @@ To verify: 2. Check the signed `runId` and `algorithmId` match the values you expect. 3. Verify the signature with `publicKey`. -The webhook is the only result delivery path for secure-rads; there is no result table or `GET /run/{runId}` result route. +The webhook is the only result delivery path for secure-rads. The default webhook is result-consumer, which writes `RunResultsTable` and backs `GET /run/{runId}`. A DC-supplied webhook bypasses that table. ### Access token format (ML-DSA-87 compact JWS) From 1e94762c77c390e9bc7002ad7e4f643365a375bd Mon Sep 17 00:00:00 2001 From: prdai Date: Fri, 27 Nov 2026 10:00:46 +0530 Subject: [PATCH 08/13] refactor(sce): drop instance id from signed results Co-authored-by: Codex --- secure/result-consumer/README.md | 2 +- secure/result-consumer/src/handlers/receive.ts | 1 - secure/result-consumer/src/lib/verify.ts | 1 - secure/sce-unit/result.go | 2 -- secure/sce-unit/runinfo.go | 8 +++----- secure/sce/execution-service/src/handlers/run.ts | 2 -- secure/sce/execution-service/userdata.sh.tmpl | 7 ++----- secure/verifier-service/README.md | 2 +- 8 files changed, 7 insertions(+), 18 deletions(-) diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index 55e12187..0767fc8e 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -4,7 +4,7 @@ Serverless Framework v4, TypeScript. HTTPS receiver for the enclave's signed run ## Flow -`POST /results` accepts the signed envelope `{ runId, algorithmId, instanceId?, payload, signature }`: +`POST /results` accepts the signed envelope `{ runId, algorithmId, payload, signature }`: 1. Fetch the run's attested public key from verifier-service `GET /runs/{runId}`, pinned to the verifier leaf SPKI. 2. Check the returned `runId` matches, then verify the signature and signed `algorithmId`. diff --git a/secure/result-consumer/src/handlers/receive.ts b/secure/result-consumer/src/handlers/receive.ts index 5e6f7c4e..50a1075b 100644 --- a/secure/result-consumer/src/handlers/receive.ts +++ b/secure/result-consumer/src/handlers/receive.ts @@ -42,7 +42,6 @@ export const handler: APIGatewayProxyHandlerV2 = async (event) => { TableName: table, Item: { RunId: result.runId, - InstanceId: typeof message.instanceId === "string" ? message.instanceId : undefined, AlgorithmId: result.algorithmId, Status: result.status, Output: result.output, diff --git a/secure/result-consumer/src/lib/verify.ts b/secure/result-consumer/src/lib/verify.ts index 0bea0206..7c1606f0 100644 --- a/secure/result-consumer/src/lib/verify.ts +++ b/secure/result-consumer/src/lib/verify.ts @@ -5,7 +5,6 @@ const SIGNATURE_CONTEXT = "sce-result-v1\n"; export interface SignedResultMessage { runId?: unknown; algorithmId?: unknown; - instanceId?: unknown; payload?: unknown; signature?: unknown; } diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index b5df586d..31c8eb44 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -23,7 +23,6 @@ type resultPayload struct { type signedResult struct { RunID string `json:"runId"` AlgorithmID string `json:"algorithmId"` - InstanceID string `json:"instanceId,omitempty"` Payload string `json:"payload"` Signature string `json:"signature"` } @@ -66,7 +65,6 @@ func sendResult(info runInfo, p resultPayload) error { envelope, err := json.Marshal(signedResult{ RunID: p.RunID, AlgorithmID: p.AlgorithmID, - InstanceID: info.InstanceID, Payload: base64.StdEncoding.EncodeToString(payload), Signature: base64.StdEncoding.EncodeToString(signature), }) diff --git a/secure/sce-unit/runinfo.go b/secure/sce-unit/runinfo.go index 6cc407c4..05d0ff80 100644 --- a/secure/sce-unit/runinfo.go +++ b/secure/sce-unit/runinfo.go @@ -15,12 +15,10 @@ import ( const hostRunIDPort = 5001 // runInfo is the per-run data the host serves on hostRunIDPort: the run id, record limit (0 = whole -// dataset), instance id, and DC webhook URL. The enclave takes no user-data, so this is its only source -// for all of them. +// dataset), and DC webhook URL. The enclave takes no user-data, so this is its only source for all of them. type runInfo struct { RunID string `json:"runId"` Size int `json:"size"` - InstanceID string `json:"instanceId"` WebhookURL string `json:"webhookUrl"` } @@ -69,8 +67,8 @@ func readRunInfo() (runInfo, error) { if info.RunID == "" || info.Size < 0 { return runInfo{}, fmt.Errorf("invalid run-info: runId must be nonempty and size must be nonnegative") } - if info.InstanceID == "" || info.WebhookURL == "" { - return runInfo{}, fmt.Errorf("invalid run-info: instanceId and webhookUrl must be nonempty") + if info.WebhookURL == "" { + return runInfo{}, fmt.Errorf("invalid run-info: webhookUrl must be nonempty") } return info, nil } diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 8e2f9af9..00026fae 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -37,7 +37,6 @@ interface RunRequest { interface RunResult { AlgorithmId?: string; Diag?: unknown; - InstanceId?: string; Output?: string; ReceivedAt?: string; RunId?: string; @@ -225,7 +224,6 @@ export const result: APIGatewayProxyHandlerV2 = async (event) => { if (!item) return jsonResponse(200, { runId, status: "pending" }); return jsonResponse(200, { runId: item.RunId, - instanceId: item.InstanceId, algorithmId: item.AlgorithmId, status: item.Status, output: item.Output, diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index 4f9f3690..d7089291 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -52,10 +52,8 @@ emit_event artifact-retrieved # Serve this run's id, record limit, instance id, region, and queue URL to the enclave on port 5001 - the # enclave takes no user-data, so it has no other way to learn them (the EIF carries per-algorithm config). -TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") -INSTANCE_ID=$(curl -s -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/instance-id) -python3 - "$INSTANCE_ID" > /dev/null <<'PYEOF' & -import json, socket, sys +python3 - > /dev/null <<'PYEOF' & +import json, socket s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind((socket.VMADDR_CID_ANY, 5001)) @@ -63,7 +61,6 @@ s.listen(5) body = json.dumps({ "runId": "{{.RunId}}", "size": {{.Size}}, - "instanceId": sys.argv[1], "region": "{{.Region}}", "webhookUrl": "{{.WebhookURL}}", }).encode() diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index 3b8c89df..9b35932e 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -16,7 +16,7 @@ Serverless Framework v4, TypeScript. Receives `AlgorithmId` + PCR values from re A webhook run delivers this body to the DC: ```json -{ "runId": "...", "algorithmId": "...", "instanceId": "...", "payload": "", "signature": "" } +{ "runId": "...", "algorithmId": "...", "payload": "", "signature": "" } ``` `payload` decodes to the signed JSON `{runId, algorithmId, status, output, diag?}`. The signature is ECDSA P-384 over SHA-256 of `sce-result-v1\n` followed by the exact payload bytes. From 8876fc4abece7ee4e9b15ea02c017915f12b064f Mon Sep 17 00:00:00 2001 From: prdai Date: Fri, 27 Nov 2026 16:24:03 +0530 Subject: [PATCH 09/13] refactor(sce): require webhook url per run Co-authored-by: Codex --- CLAUDE.md | 2 +- Makefile | 15 ++++++---- README.md | 2 +- benchmark/src/lib/catalog.py | 6 ++++ benchmark/src/lib/config.py | 8 +++--- benchmark/src/lib/trees/__init__.py | 2 +- benchmark/src/lib/trees/secure_rads.py | 28 +++++++++++++++++++ docs/e2e-secure-rads.txt | 2 +- docs/running.md | 10 +++---- secure/result-consumer/README.md | 2 +- secure/sce/Makefile | 3 -- secure/sce/execution-service/README.md | 8 +++--- secure/sce/execution-service/serverless.yml | 1 - .../sce/execution-service/src/handlers/run.ts | 13 +++------ secure/sce/execution-service/userdata.sh.tmpl | 1 - secure/verifier-service/README.md | 2 +- 16 files changed, 66 insertions(+), 39 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 164fa05d..abffbf3f 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -6,7 +6,7 @@ The human user is the technical lead. The agent is a supporting engineer that he ## Project Context -This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery by signed webhook to result-consumer by default or a per-run DC webhook, verifiable via verifier-service). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. +This repo is a PoC of the Secure Computing Environment (SCE), running on AWS Nitro Enclaves. It covers the end-to-end workflow: a build phase (Registry Service, part of the CSAV, turns a Data Controller's OCI image into a single EIF, layering the SCE Unit and nsjail on top, stores the artifact in S3, records `AlgorithmId` -> S3 path in DynamoDB) and an execution phase (enclave provisioning, remote attestation against the Verifier Service, data fetch from the Personal Data Management Service and KMS, computation over decrypted records files inside the enclave (`RECORDS_PATH` / `RESULT_PATH`, same contract as rads), async result delivery by signed webhook to a per-run URL, with result-consumer as the store-backed receiver, verifiable via verifier-service). See the architecture section in `README.md` and the docs it links before making assumptions about scope or design. ## Operating Rules diff --git a/Makefile b/Makefile index 812d1491..735773b0 100644 --- a/Makefile +++ b/Makefile @@ -93,6 +93,8 @@ instance_ip = $(shell aws ec2 describe-instances --region $(REGION) --instance-i CSAV_IP = $(call instance_ip,secure-rads-csav,CsavInstanceId) EXECUTION_API_URL = $(shell aws cloudformation describe-stacks --stack-name secure-rads-execution-service-dev --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='ExecutionApiUrl'].OutputValue" --output text) +RESULT_WEBHOOK_URL = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ + --query "Stacks[0].Outputs[?OutputKey=='ResultWebhookUrl'].OutputValue" --output text) PDM_TABLE_PREFIX = $(shell aws cloudformation describe-stacks --stack-name secure-rads-pdm-service-dev --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='PdmTablePrefix'].OutputValue" --output text) DATA_KEY_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure-rads-pdm-service-dev --region $(REGION) \ @@ -219,17 +221,16 @@ secure-rads-build-all: $(MAKE) secure-rads-build APP=$$app ALGORITHM_ID=$$id || exit 1; \ done -# Execution phase (one run): make secure-rads-run ALGORITHM_ID=. -# Fires /run (202 + runId), then polls GET /run/{runId} until the enclave reports back. +# Execution phase (one run): make secure-rads-run ALGORITHM_ID= WEBHOOK_URL=. +# Fires /run with the required webhook. When the webhook is result-consumer, GET /run/{runId} is polled. secure-rads-run: @test -n "$(ALGORITHM_ID)" || { echo "ALGORITHM_ID is required"; exit 1; } + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @api=$(EXECUTION_API_URL); \ - payload='{"algorithmId":"$(ALGORITHM_ID)"}'; \ - if [ -n "$(WEBHOOK_URL)" ]; then payload='{"algorithmId":"$(ALGORITHM_ID)","webhookUrl":"$(WEBHOOK_URL)"}'; fi; \ runId=$$(curl -sS -X POST "$$api/run" -H 'Content-Type: application/json' \ - -d "$$payload" | python3 -c 'import sys,json; print(json.load(sys.stdin)["runId"])'); \ + -d '{"algorithmId":"$(ALGORITHM_ID)","webhookUrl":"$(WEBHOOK_URL)"}' | python3 -c 'import sys,json; print(json.load(sys.stdin)["runId"])'); \ echo "runId=$$runId"; \ - if [ -n "$(WEBHOOK_URL)" ]; then echo "webhook run; result goes to $(WEBHOOK_URL)"; exit 0; fi; \ + if [ "$(WEBHOOK_URL)" != "$(RESULT_WEBHOOK_URL)" ]; then echo "webhook run; result goes to $(WEBHOOK_URL)"; exit 0; fi; \ for i in $$(seq 1 132); do \ res=$$(curl -sS "$$api/run/$$runId?algorithmId=$(ALGORITHM_ID)"); \ status=$$(echo "$$res" | python3 -c 'import sys,json; print(json.load(sys.stdin).get("status",""))'); \ @@ -244,6 +245,7 @@ secure-rads-run: # Fire and poll every sample app in turn (sequential - each spins up its own enclave). secure-rads-run-all: + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } @for pair in $(SAMPLE_APPS); do \ app=$${pair%%:*}; id=$${pair##*:}; \ $(MAKE) secure-rads-run ALGORITHM_ID=$$id WEBHOOK_URL="$(WEBHOOK_URL)" || exit 1; \ @@ -252,6 +254,7 @@ secure-rads-run-all: # Start the existing hosts, then build, seed, and run the whole fleet. Build comes first because it # provisions the per-algorithm KMS keys used by seeding. secure-rads-all: + @test -n "$(WEBHOOK_URL)" || { echo "WEBHOOK_URL is required"; exit 1; } $(MAKE) secure-rads-ready $(MAKE) secure-rads-build-all $(MAKE) secure-rads-seed diff --git a/README.md b/README.md index 0ce9f27f..1511d871 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,7 @@ Every rads AWS resource is prefixed `rads-`; every secure-rads resource is prefi **Build phase (CSAV).** A Data Controller uploads an OCI image and assigns it an `algorithmId`. registry-service unpacks the image (daemonless: skopeo + umoci), layers the SCE Unit and nsjail on top, and builds a single Nitro Enclave Image File (EIF). It registers the EIF's PCR measurements against that `algorithmId` with the Verifier Service (over mTLS) and stores the EIF in S3, recording `algorithmId -> S3 path` in DynamoDB. -**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and POSTs it to result-consumer by default or to a DC-supplied webhook; result-consumer verifies the signature and `GET /run/{runId}` reads the stored result. +**Execution phase (SCE).** A caller POSTs an `algorithmId` to the API Gateway and Lambda execution-service control plane, which launches a per-run Nitro Enclave parent EC2 instance. Inside, the SCE Unit seeds enclave entropy from the NSM, attests to the Verifier Service, and - once attestation passes - fetches that algorithm's records from the PDM Service, gets the data key unwrapped by the KMS Service, decrypts them, and writes `records.json` for the jailed Data Controller app (`RECORDS_PATH` / `RESULT_PATH`, same file contract as rads). Results come back asynchronously: `/run` returns a `runId` immediately, the enclave signs the result with its attested key and POSTs it to a per-run webhook; when that webhook is result-consumer, it verifies the signature and `GET /run/{runId}` reads the stored result. Throughout both phases every component posts timestamped events to the telemetry-service, so a run's full timeline - build to execution - can be exported for benchmarking. The log-service records only the subject-access trail. Components also report selected, attributable AWS operations to the cost-service, keyed by the same `(AlgorithmId, runId)`, so their estimated costs can be summed per AWS service ([`docs/cost-service.md`](docs/cost-service.md)). Event-by-event plaintext flows: [`docs/e2e-rads.txt`](docs/e2e-rads.txt), [`docs/e2e-secure-rads.txt`](docs/e2e-secure-rads.txt). diff --git a/benchmark/src/lib/catalog.py b/benchmark/src/lib/catalog.py index 84936afc..8f780b19 100644 --- a/benchmark/src/lib/catalog.py +++ b/benchmark/src/lib/catalog.py @@ -22,6 +22,8 @@ class ApiGatewayService(BaseModel): has_url: bool = True # Env var holding the caller-facing hostname, for stacks whose URL is a custom domain. host_env: str | None = None + # Stack output that holds the URL, when it is not HttpApiUrl. + url_output: str = "HttpApiUrl" class Ec2HttpService(BaseModel): @@ -61,6 +63,10 @@ class Ec2HttpService(BaseModel): ), "pdm": ApiGatewayService(stack="secure-rads-pdm-service-dev"), "execution": ApiGatewayService(stack="secure-rads-execution-service-dev"), + "result_consumer": ApiGatewayService( + stack="secure-rads-result-consumer-dev", + url_output="ResultWebhookUrl", + ), "log": ApiGatewayService( stack="secure-rads-log-service-dev", host_env="LOG_HOST_SECURE_RADS", diff --git a/benchmark/src/lib/config.py b/benchmark/src/lib/config.py index 39227f3a..9b664fc3 100644 --- a/benchmark/src/lib/config.py +++ b/benchmark/src/lib/config.py @@ -49,18 +49,18 @@ def stack_outputs(stack: str) -> dict[str, str]: return outputs -def _api_gateway_url(outputs: dict[str, str], host_env: str | None) -> str: +def _api_gateway_url(outputs: dict[str, str], host_env: str | None, url_output: str) -> str: if host_env: host = os.environ.get(host_env) if not host: msg = f"{host_env} is required to resolve the service URL" raise RuntimeError(msg) return f"https://{host}" - if url := outputs.get("HttpApiUrl"): + if url := outputs.get(url_output): return url domain = outputs.get("ApiRegionalDomainName") if not domain: - msg = "stack outputs missing HttpApiUrl and ApiRegionalDomainName" + msg = f"stack outputs missing {url_output} and ApiRegionalDomainName" raise RuntimeError(msg) return f"https://{domain}" @@ -91,7 +91,7 @@ def _ec2_http_url(service: Ec2HttpService, outputs: dict[str, str]) -> str: def _service_url(service: ApiGatewayService | Ec2HttpService, outputs: dict[str, str]) -> str: if service.kind is ServiceKind.API_GATEWAY: - return _api_gateway_url(outputs, service.host_env) + return _api_gateway_url(outputs, service.host_env, service.url_output) if service.kind is ServiceKind.EC2_HTTP: return _ec2_http_url(service, outputs) msg = f"unknown service kind {service.kind!r}" diff --git a/benchmark/src/lib/trees/__init__.py b/benchmark/src/lib/trees/__init__.py index f0364325..174e6b3a 100644 --- a/benchmark/src/lib/trees/__init__.py +++ b/benchmark/src/lib/trees/__init__.py @@ -13,6 +13,6 @@ def harness_for(tree: Tree, endpoints: dict[str, str]) -> TreeHarness: if tree is Tree.RADS: return RadsHarness(endpoints["registry"], endpoints["execution"]) if tree is Tree.SECURE_RADS: - return SecureRadsHarness(endpoints["registry"], endpoints["execution"]) + return SecureRadsHarness(endpoints["registry"], endpoints["execution"], endpoints["result_consumer"]) msg = f"unknown tree {tree!r}" raise ValueError(msg) diff --git a/benchmark/src/lib/trees/secure_rads.py b/benchmark/src/lib/trees/secure_rads.py index 152bb98c..39d1f877 100644 --- a/benchmark/src/lib/trees/secure_rads.py +++ b/benchmark/src/lib/trees/secure_rads.py @@ -16,6 +16,34 @@ class SecureRadsHarness(TreeHarness): name: ClassVar[Tree] = Tree.SECURE_RADS + def __init__(self, registry_url: str, execution_url: str, result_webhook_url: str) -> None: + super().__init__(registry_url, execution_url) + self._webhook = result_webhook_url + + async def execute(self, client: httpx.AsyncClient, algorithm_id: str, size: int) -> tuple[str, str, str]: + status, body = await http.arequest( + client, + "POST", + f"{self._execution}/run", + json={"algorithmId": algorithm_id, "size": size, "webhookUrl": self._webhook}, + ) + http.require(status, http.HTTP_ACCEPTED, "/run", body) + + run_id = http.parse_json(body)["runId"] + deadline = asyncio.get_running_loop().time() + http.POLL_TIMEOUT_SECONDS + while asyncio.get_running_loop().time() < deadline: + status, result_body = await http.arequest( + client, "GET", f"{self._execution}/run/{run_id}?algorithmId={algorithm_id}" + ) + http.require(status, http.HTTP_OK, f"/run/{run_id}", result_body) + result = http.parse_json(result_body) + if result.get("status") != "pending": + return run_id, result.get("status", ""), result.get("output", "") or "" + await asyncio.sleep(http.POLL_INTERVAL_SECONDS) + + msg = f"timed out after {http.POLL_TIMEOUT_SECONDS:.0f}s waiting for runId={run_id}" + raise http.FlowError(msg) + async def upload(self, client: httpx.AsyncClient, algorithm_id: str) -> None: tar_path = await asyncio.to_thread(self.build_sample_tar, self.name) content = await asyncio.to_thread(tar_path.read_bytes) diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 450cfcf6..6f1d2be0 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -108,7 +108,7 @@ Input: SECURE-RADS-RESULT-CONSUMER(result) Input: - result ← signed envelope POSTed by the SCE-UNIT (default webhook) + result ← signed envelope POSTed by the SCE-UNIT webhook 1 key ← GET-VERIFIER-RUN-ATTESTATION(result.runId) // verifier GET /runs/{runId} 2 if not VERIFY-SIGNATURE(key, result) then reject 3 persist verified result to DynamoDB diff --git a/docs/running.md b/docs/running.md index 6e7d337c..0050ef5d 100644 --- a/docs/running.md +++ b/docs/running.md @@ -37,14 +37,14 @@ and `AWS_DEFAULT_REGION` as `ap-southeast-2`, and uses the ignored local AWS fil devbox shell make up # start the CSAV EC2 host and wait for registry-service make status # show the CSAV, SCE, and rads stacks -make secure-rads # build, seed, and run all five samples +make secure-rads WEBHOOK_URL=... # build, seed, and run all five samples make down # stop the CSAV EC2 host when finished ``` `make secure-rads` is a persistent, repeatable fleet: it registers each sample under its fixed `algorithmId`, seeds its data, and runs it. Building happens before seeding because registration -creates the KMS key used to encrypt each dataset. Results go to the internal result-consumer by -default; pass `WEBHOOK_URL=https://...` to send them to a DC webhook instead. +creates the KMS key used to encrypt each dataset. Results go to the required per-run webhook; use +result-consumer's `ResultWebhookUrl` to store them and poll `GET /run`, or a DC URL. Useful root targets: @@ -52,7 +52,7 @@ Useful root targets: make secure-rads-ready # start and verify the CSAV host make secure-rads-build-all # build and register all samples make secure-rads-seed # generate and seed all datasets -make secure-rads-run-all # run all samples +make secure-rads-run-all WEBHOOK_URL=... # run all samples make benchmark # Exp1/Exp2 size sweep (override REPS= TREES= …) make benchmark-report # export sweep CSV + figures make logs # tail the CSAV host and all Lambda logs @@ -66,7 +66,7 @@ Single app (APP is a secure/samples/ dir, ALGORITHM_ID its fixed id): ```sh make secure-rads-build APP=health-risk-python ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc -make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc +make secure-rads-run ALGORITHM_ID=662fa378-dc53-425d-9225-a187b11ea7dc WEBHOOK_URL=... ``` Export a run's timeline (build through execution) as CSV: diff --git a/secure/result-consumer/README.md b/secure/result-consumer/README.md index 0767fc8e..40427ed9 100644 --- a/secure/result-consumer/README.md +++ b/secure/result-consumer/README.md @@ -15,7 +15,7 @@ Returns `200` on success, `400` for malformed input, `404` when the run has not ## Resources - `RunResultsTable` - PAY_PER_REQUEST DynamoDB table, PK `RunId`. -- `ResultWebhookUrl` - output consumed by execution-service as the default webhook target. +- `ResultWebhookUrl` - pass this as `webhookUrl` on `POST /run` when you want results stored for `GET /run/{runId}`. Deploy verifier-service first so `GET /runs/{runId}` exists: diff --git a/secure/sce/Makefile b/secure/sce/Makefile index 187039e6..6aa1d341 100644 --- a/secure/sce/Makefile +++ b/secure/sce/Makefile @@ -14,8 +14,6 @@ PDM_MTLS_HOST = $(shell aws cloudformation describe-stacks --stack-name secure-r --query "Stacks[0].Outputs[?OutputKey=='PdmMtlsHost'].OutputValue" --output text) RUN_RESULTS_TABLE = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='RunResultsTableName'].OutputValue" --output text) -RESULT_WEBHOOK_URL = $(shell aws cloudformation describe-stacks --stack-name secure-rads-result-consumer-dev --region $(REGION) \ - --query "Stacks[0].Outputs[?OutputKey=='ResultWebhookUrl'].OutputValue" --output text) API_URL = $(shell aws cloudformation describe-stacks --stack-name $(STACK_NAME) --region $(REGION) \ --query "Stacks[0].Outputs[?OutputKey=='ExecutionApiUrl'].OutputValue" --output text) @@ -29,7 +27,6 @@ deploy: env-check --param="algorithmTable=$(ALGORITHM_TABLE)" \ --param="pdmMtlsHost=$(PDM_MTLS_HOST)" \ --param="runResultsTable=$(RUN_RESULTS_TABLE)" \ - --param="resultWebhookUrl=$(RESULT_WEBHOOK_URL)" \ --param="enclaveInstanceType=c6g.large" destroy: diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index fd5de5ec..fbd31293 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -4,17 +4,17 @@ Part of the SCE. API Gateway invokes the TypeScript Lambda control plane. Given `POST /run` is fire-and-forget: it assigns a `runId`, looks up the EIF, and — when `size` is set — rejects the request if that count exceeds the rows already seeded for the algorithm in PDM. The check calls PDM's `/count` endpoint over mTLS with a client certificate fetched from SSM; this Lambda has no DynamoDB access to PDM. It then launches the enclave and returns `202 {runId, algorithmId, instanceId, status: "pending"}` immediately. -The request accepts an optional `webhookUrl`: +The request requires a `webhookUrl`: ```json { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -When omitted, results go to secure-rads-result-consumer's HTTPS receiver and `GET /run/{runId}` returns them. When provided, the URL must be `https` and must not target localhost or an obvious private/internal address; the signed result goes to that DC webhook instead and `GET /run/{runId}` stays `pending`. +The URL must be `https` and must not target localhost or an obvious private/internal address. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. -The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope over CA-verified TLS. For the internal receiver, result-consumer verifies the signature and writes the RunResults table. For a DC webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}`. +If the webhook is result-consumer's `ResultWebhookUrl`, result-consumer verifies the signature and writes the RunResults table, so `GET /run/{runId}` returns the result. For any other webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}` and `GET /run/{runId}` stays `pending`. -`GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result for internally delivered runs. `algorithmId` is required so every poll can be attributed to its run. +`GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result for runs delivered to result-consumer. `algorithmId` is required so every poll can be attributed to its run. The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. result-consumer emits `result-persisted` for internally delivered runs. SCE-unit and result-consumer emit the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). diff --git a/secure/sce/execution-service/serverless.yml b/secure/sce/execution-service/serverless.yml index eb52ceac..1dd64d23 100644 --- a/secure/sce/execution-service/serverless.yml +++ b/secure/sce/execution-service/serverless.yml @@ -54,7 +54,6 @@ provider: environment: ALGORITHM_TABLE: ${param:algorithmTable} RUN_RESULTS_TABLE: ${param:runResultsTable} - RESULT_WEBHOOK_URL: ${param:resultWebhookUrl} # Pinned to match rads EXECUTOR_AMI_ID so both trees boot the same AL2023 arm64 build. ENCLAVE_AMI_ID: ${env:SCE_ENCLAVE_AMI_ID} ENCLAVE_INSTANCE_TYPE: ${param:enclaveInstanceType, 'c6g.large'} diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 00026fae..7da22961 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -13,7 +13,6 @@ const ddb = DynamoDBDocumentClient.from(new DynamoDBClient({})); const ec2 = new EC2Client({}); const algorithmTable = requiredEnv("ALGORITHM_TABLE"); const runResultsTable = requiredEnv("RUN_RESULTS_TABLE"); -const resultWebhookUrl = requiredEnv("RESULT_WEBHOOK_URL"); const enclaveAmiId = requiredEnv("ENCLAVE_AMI_ID"); const enclaveInstanceType = requiredEnv("ENCLAVE_INSTANCE_TYPE") as RunInstancesCommandInput["InstanceType"]; const enclaveAz = requiredEnv("ENCLAVE_AZ"); @@ -31,7 +30,7 @@ const region = requiredEnv("AWS_REGION"); interface RunRequest { algorithmId: string; size?: number; - webhookUrl?: string; + webhookUrl: string; } interface RunResult { @@ -82,12 +81,8 @@ function parseRunRequest(body: string | undefined): RunRequest | undefined { return undefined; } const webhook = parseWebhookUrl(webhookUrl); - if (webhook === null) return undefined; - return { - algorithmId, - ...(size === undefined ? {} : { size }), - ...(webhook === undefined ? {} : { webhookUrl: webhook }), - }; + if (typeof webhook !== "string") return undefined; + return { algorithmId, webhookUrl: webhook, ...(size === undefined ? {} : { size }) }; } catch { return undefined; } @@ -171,7 +166,7 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { s3Key: record.S3Key, size: request.size, verifierHost, - webhookUrl: request.webhookUrl ?? resultWebhookUrl, + webhookUrl: request.webhookUrl, }), ).toString("base64"), TagSpecifications: [ diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index d7089291..f6fa369f 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -61,7 +61,6 @@ s.listen(5) body = json.dumps({ "runId": "{{.RunId}}", "size": {{.Size}}, - "region": "{{.Region}}", "webhookUrl": "{{.WebhookURL}}", }).encode() while True: diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index 9b35932e..82e9fabb 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -27,7 +27,7 @@ To verify: 2. Check the signed `runId` and `algorithmId` match the values you expect. 3. Verify the signature with `publicKey`. -The webhook is the only result delivery path for secure-rads. The default webhook is result-consumer, which writes `RunResultsTable` and backs `GET /run/{runId}`. A DC-supplied webhook bypasses that table. +The webhook is the only result delivery path for secure-rads. When the run webhook is result-consumer, it writes `RunResultsTable` and backs `GET /run/{runId}`. A DC-supplied webhook bypasses that table. ### Access token format (ML-DSA-87 compact JWS) From d94094438b7f2b8c03565b793ba34b9488bfaa3a Mon Sep 17 00:00:00 2001 From: prdai Date: Sat, 28 Nov 2026 08:56:53 +0530 Subject: [PATCH 10/13] feat(sce): probe webhook reachability before launch Co-authored-by: Codex --- secure/sce/execution-service/README.md | 2 +- .../sce/execution-service/src/handlers/run.ts | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index fbd31293..b7c382bd 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -10,7 +10,7 @@ The request requires a `webhookUrl`: { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -The URL must be `https` and must not target localhost or an obvious private/internal address. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. +The URL must be `https` and must not target localhost or an obvious private/internal address. The control plane makes a 5s `HEAD` reachability check with redirects disabled; any HTTP response counts, only DNS/TLS/connection failures reject the request. That probe is an accepted SSRF surface for now: the Lambda can reach VPC-internal hosts, so a production deployment should move delivery behind a public-egress-only proxy. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. If the webhook is result-consumer's `ResultWebhookUrl`, result-consumer verifies the signature and writes the RunResults table, so `GET /run/{runId}` returns the result. For any other webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}` and `GET /run/{runId}` stays `pending`. diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 7da22961..82c3b2e3 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -47,6 +47,24 @@ const PRIVATE_HOST = // Webhooks run from the host network, so reject obvious internal targets. DNS resolving to a private // address after this check is still possible; see docs for the remaining SSRF caveat. +const WEBHOOK_PROBE_TIMEOUT_MS = 5000; + +// Checks that the webhook host answers at all. Any HTTP status counts as reachable; only DNS/TLS/connection +// failures reject. The control plane is making an attacker-influenced request here, so this is a known SSRF +// surface accepted for now - see the webhook note in the README. +async function webhookReachable(url: string): Promise { + try { + await fetch(url, { + method: "HEAD", + redirect: "manual", + signal: AbortSignal.timeout(WEBHOOK_PROBE_TIMEOUT_MS), + }); + return true; + } catch { + return false; + } +} + function parseWebhookUrl(value: unknown): string | null | undefined { if (value === undefined) return undefined; if (typeof value !== "string" || value.length === 0) return null; @@ -140,6 +158,11 @@ export const create: APIGatewayProxyHandlerV2 = async (event) => { } } + if (!(await webhookReachable(request.webhookUrl))) { + await recordRequest(request.algorithmId, runId, CostPhase.Execution, startedAt); + return jsonResponse(400, { error: "webhook unreachable" }); + } + await emitEvent(request.algorithmId, runId, "run-requested"); const launched = await ec2.send( new RunInstancesCommand({ From a8092bcd1fdb9f0da036873c81b42ea5596326e9 Mon Sep 17 00:00:00 2001 From: prdai Date: Sun, 29 Nov 2026 07:42:15 +0530 Subject: [PATCH 11/13] refactor(sce): rely on webhook reachability probe Co-authored-by: Codex --- secure/sce/execution-service/README.md | 2 +- .../sce/execution-service/src/handlers/run.ts | 22 ++++++------------- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index b7c382bd..596cb697 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -10,7 +10,7 @@ The request requires a `webhookUrl`: { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -The URL must be `https` and must not target localhost or an obvious private/internal address. The control plane makes a 5s `HEAD` reachability check with redirects disabled; any HTTP response counts, only DNS/TLS/connection failures reject the request. That probe is an accepted SSRF surface for now: the Lambda can reach VPC-internal hosts, so a production deployment should move delivery behind a public-egress-only proxy. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. +The URL must be `https`. The control plane makes a 5s `HEAD` reachability check with redirects disabled; any HTTP response counts, only DNS/TLS/connection failures reject the request. That probe is an accepted SSRF surface for now: the Lambda can reach VPC-internal hosts, so a production deployment should move delivery behind a public-egress-only proxy. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. If the webhook is result-consumer's `ResultWebhookUrl`, result-consumer verifies the signature and writes the RunResults table, so `GET /run/{runId}` returns the result. For any other webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}` and `GET /run/{runId}` stays `pending`. diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 82c3b2e3..16d5c35a 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -42,11 +42,6 @@ interface RunResult { Status?: string; } -const PRIVATE_HOST = - /^(localhost|.*\.local|.*\.internal|127\.|10\.|192\.168\.|169\.254\.|0\.0\.0\.0$|172\.(1[6-9]|2\d|3[01])\.)/i; - -// Webhooks run from the host network, so reject obvious internal targets. DNS resolving to a private -// address after this check is still possible; see docs for the remaining SSRF caveat. const WEBHOOK_PROBE_TIMEOUT_MS = 5000; // Checks that the webhook host answers at all. Any HTTP status counts as reachable; only DNS/TLS/connection @@ -65,18 +60,15 @@ async function webhookReachable(url: string): Promise { } } -function parseWebhookUrl(value: unknown): string | null | undefined { - if (value === undefined) return undefined; - if (typeof value !== "string" || value.length === 0) return null; - let url: URL; +function parseWebhookUrl(value: unknown): string | undefined { + if (typeof value !== "string" || value.length === 0) return undefined; try { - url = new URL(value); + const url = new URL(value); + if (url.protocol !== "https:") return undefined; + return url.toString(); } catch { - return null; + return undefined; } - if (url.protocol !== "https:" || !url.hostname || url.username || url.password) return null; - if (url.hostname.includes(":") || PRIVATE_HOST.test(url.hostname)) return null; - return url.toString(); } interface AlgorithmRecord { @@ -99,7 +91,7 @@ function parseRunRequest(body: string | undefined): RunRequest | undefined { return undefined; } const webhook = parseWebhookUrl(webhookUrl); - if (typeof webhook !== "string") return undefined; + if (webhook === undefined) return undefined; return { algorithmId, webhookUrl: webhook, ...(size === undefined ? {} : { size }) }; } catch { return undefined; From d8bab2ddaffde926a8afb38cea82c13939e220a3 Mon Sep 17 00:00:00 2001 From: prdai Date: Sun, 29 Nov 2026 21:37:01 +0530 Subject: [PATCH 12/13] fix(sce): harden webhook delivery and host failure reporting Co-Authored-By: Claude Opus 5.5 --- docs/e2e-secure-rads.txt | 8 ++--- .../result-consumer/src/handlers/receive.ts | 5 +--- secure/result-consumer/src/lib/verify.ts | 3 -- secure/sce-unit/result.go | 4 +-- secure/sce-unit/webhook.go | 29 +++++++++++++++---- secure/sce/execution-service/README.md | 4 +-- .../sce/execution-service/src/handlers/run.ts | 12 ++++---- .../sce/execution-service/src/lib/userdata.ts | 2 +- secure/sce/execution-service/userdata.sh.tmpl | 28 ++++++++++-------- secure/telemetry-service/src/lib/events.ts | 8 ++++- secure/verifier-service/README.md | 2 +- 11 files changed, 63 insertions(+), 42 deletions(-) diff --git a/docs/e2e-secure-rads.txt b/docs/e2e-secure-rads.txt index 6f1d2be0..e8759717 100644 --- a/docs/e2e-secure-rads.txt +++ b/docs/e2e-secure-rads.txt @@ -52,9 +52,9 @@ Input: 6 emit artifact-retrieved // direct, auth none 7 start vsock listeners // runInfo :5001, webhook :8006 8 configure vsock-proxy -9 RUN-ENCLAVE(EIF) +9 RUN-ENCLAVE(EIF) // on failure: emit enclave-launch-failed {runEnclave log tail}, go to 12 10 emit enclave-launched // direct, auth none -11 wait for enclave exit +11 wait for enclave exit // absent from describe-enclaves for 5 consecutive polls 12 emit executor-finished // direct, auth none 13 cost ec2:instance // captured before the cost POST and terminate request 14 terminate instance @@ -86,9 +86,9 @@ Input: 21 output ← read /data/result.json 22 emit dc-app-completed // on success, else run-failed 23 SIGN result // signature key registered at attestation -24 SEND signed envelope to webhook // CA-verified TLS via vsock :8006 +24 SEND signed envelope to webhook // CA-verified TLS via vsock :8006; retry transport/429/5xx only 25 emit output-sent -26 // on failure: emit run-failed +26 // on failure: emit run-failed; before attestation no signed result is sent diff --git a/secure/result-consumer/src/handlers/receive.ts b/secure/result-consumer/src/handlers/receive.ts index 50a1075b..0afe6077 100644 --- a/secure/result-consumer/src/handlers/receive.ts +++ b/secure/result-consumer/src/handlers/receive.ts @@ -16,9 +16,7 @@ function jsonResponse(statusCode: number, body: unknown) { return { statusCode, headers: { "content-type": "application/json" }, body: JSON.stringify(body) }; } -// Receives the enclave's signed result envelope over HTTPS, verifies it against the attested run key, and -// persists the verified fields for GET /run/{runId}. A bad signature is rejected; a DynamoDB error is a 500 -// so the enclave's webhook retry can try again. +// A DynamoDB failure returns 500 so the enclave's webhook retry tries again. export const handler: APIGatewayProxyHandlerV2 = async (event) => { const startedAt = process.hrtime.bigint(); let message: SignedResultMessage; @@ -45,7 +43,6 @@ export const handler: APIGatewayProxyHandlerV2 = async (event) => { AlgorithmId: result.algorithmId, Status: result.status, Output: result.output, - Diag: result.diag, ReceivedAt: new Date().toISOString(), }, ReturnConsumedCapacity: "TOTAL", diff --git a/secure/result-consumer/src/lib/verify.ts b/secure/result-consumer/src/lib/verify.ts index 7c1606f0..dc9ed647 100644 --- a/secure/result-consumer/src/lib/verify.ts +++ b/secure/result-consumer/src/lib/verify.ts @@ -14,7 +14,6 @@ export interface VerifiedResult { algorithmId: string; status: string; output: string; - diag: unknown; } interface ResultPayload { @@ -22,7 +21,6 @@ interface ResultPayload { algorithmId: string; status: string; output: string; - diag?: unknown; } function isResultPayload(value: unknown): value is ResultPayload { @@ -74,6 +72,5 @@ export function verifySignedResult( algorithmId: payload.algorithmId, status: payload.status, output: payload.output, - diag: payload.diag ?? null, }; } diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index 31c8eb44..ad334e11 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -17,7 +17,6 @@ type resultPayload struct { AlgorithmID string `json:"algorithmId"` Status string `json:"status"` Output string `json:"output"` - Diag any `json:"diag,omitempty"` } type signedResult struct { @@ -44,8 +43,7 @@ func getResultSigner() *ecdsa.PrivateKey { return resultSigner.key } -// sendResult signs the enclave-owned result fields and POSTs the envelope to the run's DC webhook. The DC -// verifies the signature against the public key verifier-service recorded at attestation. +// Verified against the public key verifier-service recorded at attestation. func sendResult(info runInfo, p resultPayload) error { key := getResultSigner() if key == nil { diff --git a/secure/sce-unit/webhook.go b/secure/sce-unit/webhook.go index 40f72a9e..685097ed 100644 --- a/secure/sce-unit/webhook.go +++ b/secure/sce-unit/webhook.go @@ -4,6 +4,7 @@ import ( "bytes" "context" "crypto/tls" + "errors" "fmt" "io" "net" @@ -12,12 +13,26 @@ import ( "time" ) -// The host forwards this port over vsock to the DC webhook host:port (see userdata.sh.tmpl). The host is -// untrusted, so TLS uses the normal CA chain and the webhook hostname - unlike the fixed internal services, -// the webhook can be any public host and cannot be pinned ahead of time. +// Forwarded by the host to the webhook (see userdata.sh.tmpl); any public host, so CA-verified, not pinned. const webhookProxyPort = 8006 -const webhookRequestTimeout = 30 * time.Second +const ( + webhookRequestTimeout = 30 * time.Second + webhookAttempts = 3 +) + +type webhookRejectedError struct { + status string + body []byte +} + +func (e *webhookRejectedError) Error() string { + return fmt.Sprintf("webhook rejected result with %s: %s", e.status, e.body) +} + +func retryableStatus(code int) bool { + return code == http.StatusTooManyRequests || code >= 500 +} func sendWebhookResult(info runInfo, envelope []byte) error { target, err := url.Parse(info.WebhookURL) @@ -31,7 +46,8 @@ func sendWebhookResult(info runInfo, envelope []byte) error { if err == nil { return nil } - if attempt >= 3 { + var permanent *webhookRejectedError + if attempt >= webhookAttempts || errors.As(err, &permanent) { return err } time.Sleep(time.Duration(attempt) * time.Second) @@ -56,6 +72,9 @@ func postWebhook(target *url.URL, body *bytes.Reader) error { defer resp.Body.Close() if resp.StatusCode < 200 || resp.StatusCode >= 300 { respBody, _ := io.ReadAll(io.LimitReader(resp.Body, 1024)) + if !retryableStatus(resp.StatusCode) { + return &webhookRejectedError{status: resp.Status, body: respBody} + } return fmt.Errorf("webhook returned %s: %s", resp.Status, respBody) } return nil diff --git a/secure/sce/execution-service/README.md b/secure/sce/execution-service/README.md index 596cb697..4118f258 100644 --- a/secure/sce/execution-service/README.md +++ b/secure/sce/execution-service/README.md @@ -10,13 +10,13 @@ The request requires a `webhookUrl`: { "algorithmId": "...", "size": 1000, "webhookUrl": "https://dc.example/results" } ``` -The URL must be `https`. The control plane makes a 5s `HEAD` reachability check with redirects disabled; any HTTP response counts, only DNS/TLS/connection failures reject the request. That probe is an accepted SSRF surface for now: the Lambda can reach VPC-internal hosts, so a production deployment should move delivery behind a public-egress-only proxy. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. +The URL must be `https` with a plain DNS hostname (no IP literals or credentials), because the hostname is written into the host's vsock-proxy config. The control plane makes a 5s `HEAD` reachability check with redirects disabled; any HTTP response counts, only DNS/TLS/connection failures reject the request. That probe is an accepted SSRF surface for now: the Lambda can reach VPC-internal hosts, so a production deployment should move delivery behind a public-egress-only proxy. The enclave signs the result (run id, algorithm id, status, and output) with its attested ephemeral key and POSTs the signed envelope to that webhook over CA-verified TLS. It retries transport errors, `429`, and `5xx` up to three times; any other non-2xx is final. If the webhook is result-consumer's `ResultWebhookUrl`, result-consumer verifies the signature and writes the RunResults table, so `GET /run/{runId}` returns the result. For any other webhook, the DC verifies the envelope with verifier-service `GET /runs/{runId}` and `GET /run/{runId}` stays `pending`. `GET /run/{runId}?algorithmId={algorithmId}` polls for the result: `{runId, status: "pending"}` until it lands, then the stored result for runs delivered to result-consumer. `algorithmId` is required so every poll can be attributed to its run. -The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched`, and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. result-consumer emits `result-persisted` for internally delivered runs. SCE-unit and result-consumer emit the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). +The control plane logs `run-requested` and `executor-launched` (or `launch-failed`). The parent posts `executor-ready`, `artifact-retrieved`, `enclave-launched` (or `enclave-launch-failed` with the run-enclave log tail in `detail`), and `executor-finished` directly to telemetry-service with `origin: host`. The host holds no credential; telemetry ingest is unauthenticated. The enclave emits `run-failed` before it exits. A run that fails before attestation or never launches has no signed result, so `GET /run/{runId}` stays `pending`; the cause is in the telemetry timeline. result-consumer emits `result-persisted` for internally delivered runs. SCE-unit and result-consumer emit the remaining events in [the execution flow](../../../docs/e2e-secure-rads.txt). See [../README.md](../README.md) for the full SCE context. diff --git a/secure/sce/execution-service/src/handlers/run.ts b/secure/sce/execution-service/src/handlers/run.ts index 16d5c35a..a24b531b 100644 --- a/secure/sce/execution-service/src/handlers/run.ts +++ b/secure/sce/execution-service/src/handlers/run.ts @@ -35,7 +35,6 @@ interface RunRequest { interface RunResult { AlgorithmId?: string; - Diag?: unknown; Output?: string; ReceivedAt?: string; RunId?: string; @@ -43,10 +42,10 @@ interface RunResult { } const WEBHOOK_PROBE_TIMEOUT_MS = 5000; +// The hostname is spliced into host shell and vsock-proxy config, so only plain DNS names are accepted. +const DNS_HOSTNAME = /^(?=.{1,253}$)([a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$/; -// Checks that the webhook host answers at all. Any HTTP status counts as reachable; only DNS/TLS/connection -// failures reject. The control plane is making an attacker-influenced request here, so this is a known SSRF -// surface accepted for now - see the webhook note in the README. +// Known SSRF surface accepted for now; see the webhook note in the README. async function webhookReachable(url: string): Promise { try { await fetch(url, { @@ -64,7 +63,9 @@ function parseWebhookUrl(value: unknown): string | undefined { if (typeof value !== "string" || value.length === 0) return undefined; try { const url = new URL(value); - if (url.protocol !== "https:") return undefined; + if (url.protocol !== "https:" || url.username || url.password || !DNS_HOSTNAME.test(url.hostname)) { + return undefined; + } return url.toString(); } catch { return undefined; @@ -237,7 +238,6 @@ export const result: APIGatewayProxyHandlerV2 = async (event) => { algorithmId: item.AlgorithmId, status: item.Status, output: item.Output, - diag: item.Diag, receivedAt: item.ReceivedAt, }); } catch (error) { diff --git a/secure/sce/execution-service/src/lib/userdata.ts b/secure/sce/execution-service/src/lib/userdata.ts index fbdb6a13..3ee05378 100644 --- a/secure/sce/execution-service/src/lib/userdata.ts +++ b/secure/sce/execution-service/src/lib/userdata.ts @@ -42,7 +42,7 @@ export function userData(values: UserDataValues): string { VerifierHost: values.verifierHost, WebhookAllowlist: ` - {address: "${webhook.hostname}", port: ${webhookPort}}`, WebhookProxy: `vsock-proxy 8006 "${webhook.hostname}" ${webhookPort} --config /etc/nitro_enclaves/vsock-proxy.yaml &`, - WebhookURL: values.webhookUrl, + WebhookURL: JSON.stringify(values.webhookUrl), }; return Object.entries(replacements).reduce( diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index f6fa369f..7b175a7e 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -6,7 +6,7 @@ exec > >(tee /var/log/execution-service-run.log) 2>&1 # auth=none, origin=host. The enclave owns the post-attestation and terminal events. emit_event() { curl -sS --max-time 5 -X POST "https://{{.TelemetryHost}}/events" -H 'content-type: application/json' \ - -d "{\"algorithmId\":\"{{.AlgorithmId}}\",\"runId\":\"{{.RunId}}\",\"event\":\"$1\",\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)\",\"origin\":\"host\"}" >/dev/null || true + -d "{\"algorithmId\":\"{{.AlgorithmId}}\",\"runId\":\"{{.RunId}}\",\"event\":\"$1\",\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)\",\"origin\":\"host\",\"detail\":${2:-null}}" >/dev/null || true } # Cost metering reports selected AWS operations, keyed by (AlgorithmId, runId). Best-effort. @@ -50,8 +50,8 @@ emit_cost s3 get 1 # Checkpoint: the algorithm artifact (EIF) is now on the host, before the enclave is launched. emit_event artifact-retrieved -# Serve this run's id, record limit, instance id, region, and queue URL to the enclave on port 5001 - the -# enclave takes no user-data, so it has no other way to learn them (the EIF carries per-algorithm config). +# Serve this run's id, record limit, and webhook URL to the enclave on port 5001 - the enclave takes no +# user-data, so it has no other way to learn them (the EIF carries per-algorithm config). python3 - > /dev/null <<'PYEOF' & import json, socket s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) @@ -61,7 +61,7 @@ s.listen(5) body = json.dumps({ "runId": "{{.RunId}}", "size": {{.Size}}, - "webhookUrl": "{{.WebhookURL}}", + "webhookUrl": {{.WebhookURL}}, }).encode() while True: conn, _ = s.accept() @@ -99,14 +99,18 @@ for attempt in 1 2 3 4 5; do sleep 5 done -if [ "$launched" = true ]; then - emit_event enclave-launched - while true; do - ENCLAVE_COUNT=$(nitro-cli describe-enclaves | python3 -c 'import json, sys; print(sum(e.get("EnclaveCID") == 16 for e in json.load(sys.stdin)))') || exit 1 - [ "$ENCLAVE_COUNT" -eq 0 ] && break - sleep 1 - done -else +if [ "$launched" = false ]; then kill "$RUNINFO_LISTENER_PID" 2>/dev/null || true + emit_event enclave-launch-failed "$(tail -c 4096 /tmp/run-enclave.log | python3 -c 'import json, sys; print(json.dumps({"runEnclave": sys.stdin.read()}))')" exit 1 fi + +emit_event enclave-launched +# A single empty describe-enclaves can be transient right after launch; require several in a row. +ENCLAVE_GONE_POLLS=5 +gone=0 +while [ "$gone" -lt "$ENCLAVE_GONE_POLLS" ]; do + ENCLAVE_COUNT=$(nitro-cli describe-enclaves | python3 -c 'import json, sys; print(sum(e.get("EnclaveCID") == 16 for e in json.load(sys.stdin)))') || exit 1 + if [ "$ENCLAVE_COUNT" -eq 0 ]; then gone=$((gone + 1)); else gone=0; fi + sleep 1 +done diff --git a/secure/telemetry-service/src/lib/events.ts b/secure/telemetry-service/src/lib/events.ts index efb13d3d..f7b147dd 100644 --- a/secure/telemetry-service/src/lib/events.ts +++ b/secure/telemetry-service/src/lib/events.ts @@ -15,7 +15,13 @@ export const ENCLAVE_EVENTS = [ // Host-reported events. The EC2 host posts them directly without a token, so they carry origin=host // instead of being presented as enclave claims. -export const HOST_EVENTS = ["executor-ready", "artifact-retrieved", "enclave-launched", "executor-finished"] as const; +export const HOST_EVENTS = [ + "executor-ready", + "artifact-retrieved", + "enclave-launched", + "enclave-launch-failed", + "executor-finished", +] as const; // Control-plane producers: registry-service, execution-service, and result-consumer. export const INTERNAL_EVENTS = [ diff --git a/secure/verifier-service/README.md b/secure/verifier-service/README.md index 82e9fabb..8b14e86c 100644 --- a/secure/verifier-service/README.md +++ b/secure/verifier-service/README.md @@ -19,7 +19,7 @@ A webhook run delivers this body to the DC: { "runId": "...", "algorithmId": "...", "payload": "", "signature": "" } ``` -`payload` decodes to the signed JSON `{runId, algorithmId, status, output, diag?}`. The signature is ECDSA P-384 over SHA-256 of `sce-result-v1\n` followed by the exact payload bytes. +`payload` decodes to the signed JSON `{runId, algorithmId, status, output}`. The signature is ECDSA P-384 over SHA-256 of `sce-result-v1\n` followed by the exact payload bytes. To verify: From b8f4d11e440e731c3aeec469b551042b4395f244 Mon Sep 17 00:00:00 2001 From: prdai Date: Sun, 29 Nov 2026 21:40:42 +0530 Subject: [PATCH 13/13] style(sce): trim comments Co-Authored-By: Claude Opus 5.5 --- secure/result-consumer/src/lib/attestation.ts | 3 +-- secure/sce-unit/result.go | 1 - secure/sce-unit/runinfo.go | 3 +-- secure/sce/execution-service/userdata.sh.tmpl | 6 ++---- secure/verifier-service/serverless.yml | 2 +- secure/verifier-service/src/handlers/runSigningKey.ts | 2 -- 6 files changed, 5 insertions(+), 12 deletions(-) diff --git a/secure/result-consumer/src/lib/attestation.ts b/secure/result-consumer/src/lib/attestation.ts index aba57218..8f26d51a 100644 --- a/secure/result-consumer/src/lib/attestation.ts +++ b/secure/result-consumer/src/lib/attestation.ts @@ -7,8 +7,7 @@ export interface RunAttestation { publicKey: string; } -// Fetches the key verifier-service bound to this run during attestation. The response is pinned to the -// verifier leaf SPKI, the same way downstream services pin the JWKS endpoint. +// Pinned to the verifier leaf SPKI, the same way downstream services pin the JWKS endpoint. export function fetchRunAttestation( host: string, pinSha256: string, diff --git a/secure/sce-unit/result.go b/secure/sce-unit/result.go index ad334e11..ea9b59b2 100644 --- a/secure/sce-unit/result.go +++ b/secure/sce-unit/result.go @@ -43,7 +43,6 @@ func getResultSigner() *ecdsa.PrivateKey { return resultSigner.key } -// Verified against the public key verifier-service recorded at attestation. func sendResult(info runInfo, p resultPayload) error { key := getResultSigner() if key == nil { diff --git a/secure/sce-unit/runinfo.go b/secure/sce-unit/runinfo.go index 05d0ff80..45942d94 100644 --- a/secure/sce-unit/runinfo.go +++ b/secure/sce-unit/runinfo.go @@ -14,8 +14,7 @@ import ( // no other way to learn the per-run id it was launched for (the EIF only carries the per-algorithm config). const hostRunIDPort = 5001 -// runInfo is the per-run data the host serves on hostRunIDPort: the run id, record limit (0 = whole -// dataset), and DC webhook URL. The enclave takes no user-data, so this is its only source for all of them. +// The enclave takes no user-data, so the host serves these on hostRunIDPort; Size 0 means the whole dataset. type runInfo struct { RunID string `json:"runId"` Size int `json:"size"` diff --git a/secure/sce/execution-service/userdata.sh.tmpl b/secure/sce/execution-service/userdata.sh.tmpl index 7b175a7e..9b31ddba 100644 --- a/secure/sce/execution-service/userdata.sh.tmpl +++ b/secure/sce/execution-service/userdata.sh.tmpl @@ -16,8 +16,7 @@ emit_cost() { -d "{\"algorithmId\":\"{{.AlgorithmId}}\",\"runId\":\"{{.RunId}}\",\"eventId\":\"$(cat /proc/sys/kernel/random/uuid)\",\"phase\":\"execution\",\"service\":\"$1\",\"operation\":\"$2\",\"quantity\":$3,\"timestamp\":\"$(date -u +%Y-%m-%dT%H:%M:%S.%NZ)\"}" >/dev/null || true } -# Always self-terminate on exit. sce-unit sends the signed result to the DC webhook itself, so the host -# never builds or publishes results. +# Always self-terminate on exit; sce-unit delivers the signed result itself. finish() { set +e TOKEN=$(curl -s -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") @@ -50,8 +49,7 @@ emit_cost s3 get 1 # Checkpoint: the algorithm artifact (EIF) is now on the host, before the enclave is launched. emit_event artifact-retrieved -# Serve this run's id, record limit, and webhook URL to the enclave on port 5001 - the enclave takes no -# user-data, so it has no other way to learn them (the EIF carries per-algorithm config). +# The enclave takes no user-data, so per-run values (the EIF carries per-algorithm config) come from port 5001. python3 - > /dev/null <<'PYEOF' & import json, socket s = socket.socket(socket.AF_VSOCK, socket.SOCK_STREAM) diff --git a/secure/verifier-service/serverless.yml b/secure/verifier-service/serverless.yml index 7189c98c..e80ef1d3 100644 --- a/secure/verifier-service/serverless.yml +++ b/secure/verifier-service/serverless.yml @@ -76,7 +76,7 @@ functions: jwks: handler: src/handlers/jwks.handler - # The DC reads the public key recorded for one run. + # No auth: it only serves the public key the DC verifies a run's signed result against. runSigningKey: handler: src/handlers/runSigningKey.handler diff --git a/secure/verifier-service/src/handlers/runSigningKey.ts b/secure/verifier-service/src/handlers/runSigningKey.ts index 265bf554..7781b607 100644 --- a/secure/verifier-service/src/handlers/runSigningKey.ts +++ b/secure/verifier-service/src/handlers/runSigningKey.ts @@ -12,8 +12,6 @@ interface AttestedRun { PublicKey?: unknown; } -// The DC fetches this by run id to verify the enclave's result signature against the key that was -// bound to the run during attestation. Public keys are public, so this needs no auth. export const handler: APIGatewayProxyHandlerV2 = async (event) => { const startedAt = process.hrtime.bigint(); const runId = event.pathParameters?.runId;