Repository navigation
fix(invoke): allow bearer tokens for harness IDs - #2753
Conversation
Package TarballHow to installgh release download pr-2753-tarball --repo aws/agentcore-cli --pattern "*.tgz" --dir /tmp/pr-tarball
npm install -g /tmp/pr-tarball/aws-agentcore-1.0.1.tgz |
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
nborges-aws
left a comment
There was a problem hiding this comment.
one finding otherwise LGTM
| const HTTP_BEARER_AUTH_SCHEME = "smithy.api#httpBearerAuth"; | ||
|
|
||
| export const createDataClient: CreateDataClient = ({ bearerToken, ...config }) => { | ||
| if ( |
There was a problem hiding this comment.
Can we enforce HTTPS on the request endpoint before sending? The check we have now only covers config.endpoint. If the endpoint is resolved through AWS config or any other means, it could send the token over plaintext
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
| import { InvokeHarnessCommand } from "@aws-sdk/client-bedrock-agentcore"; | ||
| import { createDataClient } from "./factories"; | ||
|
|
||
| test("createDataClient signs bearer invocations without resolving AWS credentials", async () => { |
There was a problem hiding this comment.
remove this for now.
| expect(pending).rejects.toMatchObject({ name: "AbortError" }); | ||
| }); | ||
|
|
||
| test("invokeHarness uses an uncached bearer client and destroys it after streaming", async () => { |
4e3c18f to
54bab64
Compare
|
Claude Security Review: no high-confidence findings. (run) |
| @@ -0,0 +1,64 @@ | |||
| import { expect, spyOn, test } from "bun:test"; | |||
There was a problem hiding this comment.
no core tests please. This should covered by golden tests.
|
Claude Security Review: no high-confidence findings. (run) |
Description
Allow one-shot CUSTOM_JWT Harness invocation with
--bearer-tokenonagentcore invoke --harnessandagentcore harness invoke --id.Like Runtime invoke, Harness invoke first calls
GetHarnessusing AWS credentials and validates the configured authorizer. The data-plane request uses a Harness-only Smithy bearer client rather than SigV4. The sharedcreateDataClientfactory is unchanged. Harness IDs are required byharness invoke;agentcore invokecan select a Harness by ARN but still resolves it throughGetHarness. This change does not enable invocation without AWS credentials.Tokens can be inline, read from stdin (
-), or read fromfile://. Empty and multiline tokens are rejected. IAM Harnesses reject bearer tokens, and CUSTOM_JWT Harnesses require them. The bearer client enforces HTTPS and is destroyed after the response stream is consumed.Related Issue
Related to #2741, but does not close it: the credential-free full-ARN use case remains unsupported.
Documentation PR
Documentation is included in this PR.
Type of Change
Testing
bun test: 4,719 passed, 6 Windows-only skips on Linuxbun run typecheckbun run lint:checkbun run format:checkbun run buildbun run secrets:checkbun run audit: configured CodeArtifact advisory endpoint returned HTTP 404Checklist
command.mdBy submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution to your work, under the terms of your choice.