Skip to content

fix(invoke): allow bearer tokens for harness IDs - #2753

Merged
nborges-aws merged 2 commits into
v1.xfrom
fix/harness-bearer-token-direct-invoke
Nov 5, 2026
Merged

nborges-aws merged 2 commits into
v1.xfrom
fix/harness-bearer-token-direct-invoke

Conversation

@jariy17

@jariy17 jariy17 commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Description

Allow one-shot CUSTOM_JWT Harness invocation with --bearer-token on agentcore invoke --harness and agentcore harness invoke --id.

Like Runtime invoke, Harness invoke first calls GetHarness using AWS credentials and validates the configured authorizer. The data-plane request uses a Harness-only Smithy bearer client rather than SigV4. The shared createDataClient factory is unchanged. Harness IDs are required by harness invoke; agentcore invoke can select a Harness by ARN but still resolves it through GetHarness. This change does not enable invocation without AWS credentials.

Tokens can be inline, read from stdin (-), or read from file://. 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

  • Bug fix
  • Documentation update

Testing

  • bun test: 4,719 passed, 6 Windows-only skips on Linux
  • bun run typecheck
  • bun run lint:check
  • bun run format:check
  • bun run build
  • bun run secrets:check
  • Built CLI help smoke checks for both invoke commands
  • Live CUSTOM_JWT Harness invocation was not rerun after changing the lookup flow
  • bun run audit: configured CodeArtifact advisory endpoint returned HTTP 404

Checklist

  • I have read CONTRIBUTING.md
  • I have tested lookup routing, IAM/JWT authorizer validation, bearer signing, HTTPS enforcement, token input validation, and stream handling
  • I have updated the README example
  • This PR does not change generated command.md

By 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.

@jariy17
jariy17 requested a review from a team November 4, 2026 14:50
@github-actions github-actions Bot added the size/m PR size: M label Nov 4, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Nov 4, 2026
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Package Tarball

aws-agentcore-1.0.1.tgz

How to install

gh 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

@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026

@nborges-aws nborges-aws left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one finding otherwise LGTM

Comment thread src/core/factories.tsx Outdated
const HTTP_BEARER_AUTH_SCHEME = "smithy.api#httpBearerAuth";

export const createDataClient: CreateDataClient = ({ bearerToken, ...config }) => {
if (

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@jariy17 jariy17 changed the title fix(invoke): allow bearer tokens for harness ARNs fix(invoke): allow bearer tokens for harness IDs Nov 4, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
Comment thread src/core/factories.test.ts Outdated
import { InvokeHarnessCommand } from "@aws-sdk/client-bedrock-agentcore";
import { createDataClient } from "./factories";

test("createDataClient signs bearer invocations without resolving AWS credentials", async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this for now.

Comment thread src/core/core.test.ts Outdated
expect(pending).rejects.toMatchObject({ name: "AbortError" });
});

test("invokeHarness uses an uncached bearer client and destroys it after streaming", async () => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this for now

@jariy17
jariy17 force-pushed the fix/harness-bearer-token-direct-invoke branch from 4e3c18f to 54bab64 Compare November 4, 2026 20:53
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 4, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 4, 2026
Comment thread src/core/harnessBearer.test.ts Outdated
@@ -0,0 +1,64 @@
import { expect, spyOn, test } from "bun:test";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no core tests please. This should covered by golden tests.

@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Nov 5, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Nov 5, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Nov 5, 2026
@nborges-aws
nborges-aws merged commit 9a321a9 into v1.x Nov 5, 2026
19 of 22 checks passed
@nborges-aws
nborges-aws deleted the fix/harness-bearer-token-direct-invoke branch November 5, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants