Repository navigation
Conversation
added 3 commits
October 15, 2026 21:26
runtime get/version/endpoint and gateway get/target/rule/connector took any string as the ID, so an ARN reached the service and came back as a misleading AccessDeniedException. invoke/exec/logs already used runtimeIdSchema / gatewayIdSchema to reject ARNs client-side; use them here too.
Same gap as runtime/gateway: a Memory ARN reached the service and surfaced as a misleading AccessDeniedException. Reject it client-side.
…lear error Every harness --id flag capped input at 48 characters, but 48 is the harness name limit; the service's ID is a <=40-char name plus a 10-char suffix (51 max), so valid IDs of 49-51 characters were rejected client-side. Passing an ARN also failed with an opaque length error. Share one schema across harness commands.
Contributor
|
Claude Security Review: no high-confidence findings. (run) |
Contributor
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nicely scoped refactor. Consolidating the per-resource idSchema constants and giving ARN inputs a clear, resource-specific error message is a real UX win over the generic Invalid value for option '--id'.
A couple of small observations (none blocking):
src/handlers/harness/idSchema.tschains.max(51)after.refine(...). This works in zod v4 (the test for the 51-char boundary confirms it), but there's no negative test for a 52-char input — worth adding alongside the existing cases if you want to lock the upper bound down.runtimeIdSchemaandgatewayIdSchemadon't bake in.min(1), so some call sites still need to tack on.min(1)while others (e.g.,runtime/invoke,gateway/invoke) rely on the schema's lack of a min. Not introduced by this PR, but folding.min(1)into the base schemas (matchingharnessIdSchema/memoryIdSchema) would make the four schemas symmetric and remove the per-call-site.min(1)noise.- The new memory ARN-rejection test exercises
memory session list/memory record listwithout their other required flags (--actor-id, etc.). It passes today becauseidis validated first, but that ordering is a bit implicit — passing the other required flags would make the test less fragile.
Nothing here needs to block merge.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1. Reject ARNs passed as
--idon runtime and gateway read commandsWhat:
runtime get,runtime version get|list,runtime endpoint get|list,gateway get, andgateway target|rule|connector get|listnow reject an ARN passed where an ID is expected, withmust be a Runtime ID, not an ARN/must be a Gateway ID, not an ARN(exit 2).Why: These commands took any non-empty string, so an ARN reached the service and came back as
AccessDeniedException ... not authorized to perform: bedrock-agentcore:GetAgentRuntime— even for a fully privileged caller. That reads like an IAM problem, not a typo.runtime invoke|exec|logs|shell|tracesandgateway invokealready rejected ARNs client-side; the read commands just didn't use the same schema.How: Reuse the existing
runtimeIdSchema/gatewayIdSchema.gateway policy generateis untouched — its flag explicitly accepts an ID or ARN.2. Same fix for memory read commands
What/Why:
memory get,memory session|actor list,memory event get|list,memory record get|listhad the same misleading-AccessDenied behavior with an ARN. AddedmemoryIdSchemaand used it across all seven.3. Harness
--idrejected valid full-length IDsWhat: Every harness command capped
--idat 48 characters. That's the harness name limit; the service'sharnessIdpattern is[a-zA-Z][a-zA-Z0-9_]{0,39}-[a-zA-Z0-9]{10}, so IDs can be up to 51 characters. IDs of 49–51 characters were rejected client-side, and passing an ARN failed with an opaqueToo big: expected string to have <=48 characters.How: One shared
harnessIdSchema(max 51, explicit ARN rejection) across the 16 harness commands. Kept it loose rather than matching the exact service regex, so the CLI doesn't break if the suffix format changes.Testing
bun test(4585 pass, 0 fail) — new cases inruntime.test.tsx,gateway.test.tsx,memory.test.tsx,harness/idSchema.test.tsbun run typecheck,lint:check,format:checkFindings not fixed here
agentcore <group> <typo> --helpexits 0 and shows the group's help rather than the "unknown subcommand" error the no---helppath gives. Commander resolves--helpduring option parsing, before the router's typo check runs. Repro:agentcore runtime gett --help; echo $?.--regionsurfaces as a raw DNS error.agentcore --region not-a-region runtime list→getaddrinfo ENOTFOUND bedrock-agentcore-control.not-a-region.amazonaws.com. The supported-region check exists only in the deploy path (src/core/project/manager.tsx). Making it global needs a decision on per-service region availability.eval online-eval get/eval dataset getwith an ARN give the same misleading AccessDenied. Left alone: this was previously triaged as expected service behavior; worth revisiting for consistency with the fixes above.--jsonis not honored on error paths foradd/remove/status: stdout is empty and the error is plain text on stderr.deployalready usesrenderJsonError. Repro:agentcore add memory --name Dup --jsontwice.status --jsonon a project that hasn't been deployed errors (exit 1, "No deployment targets are configured") instead of listing local resources as not deployed.