main
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b840ec34b0 |
Fix interceptor Lambda syntax error from over-escaped embedded code (#1968)
The interceptor Lambda cannot load. Cell 9 writes lambda_function.py from the embedded
INTERCEPTOR_CODE string, and line 28 of that string contains a literal backslash before
each quote:
print(f"[STEP 3] Entra JWT | email={claims.get(\"email\")} ...")
Deploying exactly what the notebook produces fails at module import:
errorType: Runtime.UserCodeSyntaxError
errorMessage: Syntax error in module 'lambda_function': unexpected character after
line continuation character (lambda_function.py, line 28)
Every Python version from 3.9 through 3.14 rejects it, with the wording differing before
and after 3.12. Because it is an import failure rather than a runtime one, it affects
every invocation, including the tools/list pass-through.
Swapping the outbound Authorization header for the caller's exchanged token is the
interceptor's entire job, so while it fails to load no token exchange happens and the
sample cannot demonstrate the per-user delegation it is about. The exact caller-visible
symptom depends on how the gateway handles an interceptor invocation failure, which I did
not verify. Either way the notebook does not raise: cell 16 gates its success banner on
"@" appearing in the result of SELECT current_user(), so the banner just never prints, and
the [STEP 3] through [STEP 6] lines that cell 17 tells you to look for are absent from
CloudWatch.
The fix single-quotes the dict keys inside the f-string. This matches cell 15, which
already writes claims.get('name') and claims.get('email') that way, so it also makes the
notebook internally consistent. Nested double quotes would work on the python3.12 runtime
this notebook pins, but the single-quoted form is valid on every version, and the update
path here (update_function_code on ResourceConflictException) never re-sets the runtime on
a function that already exists -- so version-independent sample code is the safer choice.
Verified by extracting INTERCEPTOR_CODE from this notebook, deploying it to a python3.12
Lambda and invoking it. Before: StatusCode 200 with FunctionError Unhandled and the syntax
error above. After: FunctionError none, with the interceptor logging the decoded caller
identity at STEP 3 and reaching the token exchange at STEP 4. I did not exercise the
exchange itself end to end, which needs a federation policy for the caller's issuer, so
this is verified as far as the module importing and the identity decoding correctly.
One line changed. No behaviour change beyond making the module importable.
|
||
|
|
3a8d5352da |
Restructure use cases (#1653)
* restructure 02-use-cases into three agent-type categories
Reorganizes all 27 use case samples into category subfolders aligned
with the AgentCore GTM workload definitions:
- 01-conversational-agents/ (19 samples): user-facing agents with
streaming, user OAuth, and session/long-term memory
- 02-automation-agents/ (4 samples): event-driven agents with service
identity and stateless execution
- 03-coding-assistants/ (3 samples): developer tools with sandboxed
execution and project-scoped memory
Other changes:
- Moves okta-auth-three-tier-end-to-end-demo to
01-features/05-authenticate-and-authorize (identity pattern, not a
use case)
- Adds 02-use-cases/README.md with category index and sample table
- Adds category README for each subfolder, aligned with GTM definitions,
no em-dashes
- Adds use-case-assessment.md with per-sample scoring, recommendations,
and a starter toolkit migration list (18 of 27 samples need migrating)
- Fixes all cross-folder relative links broken by the restructure
(LICENSE, LOCAL_DEVELOPMENT.md, AGENTCORE_DEPLOYMENT.md)
* cull low-quality conversational agent samples and reorganise identity demos
Reviewed all 19 conversational agent samples against actual AgentCore
feature usage, blog post references, and code quality. Removed 9 samples
that did not meet the bar and moved 2 identity-pattern demos to the
correct location.
Dropped from 01-conversational-agents/:
- gateway-schema-support-agent: misclassified coding agent, 82-line README,
only 1 real feature, no blog post
- slide-deck-generator-memory-agent: narrow use case, no blog post,
deprecated starter toolkit, 5 features
- local-prototype-to-agentcore: claimed 9 features, only 3 in code,
tutorial format belongs in 01-tutorials/
- role-based-hr-data-agent: no blog post, deprecated starter toolkit,
Cedar pattern needs full rebuild to be useful
- A2A-realestate-agentcore-multiagents: claimed 10 features, only 3 in
code (Runtime, Cognito, A2A), no blog post
- cost-optimization-agent: only Runtime in code, notebook-driven, no
blog post
- DB-performance-analyzer: only Gateway + Cognito in code, no blog post
- farm-management-advisor: notebook-only, mixed deprecated/native SDK,
191-line README, no blog post
Moved to 01-features/05-authenticate-and-authorize/:
- auth0-multi-agent-obo: RFC 8693 OBO token exchange is an identity
pattern, not a use case; sits alongside okta and entra OBO samples
- okta-auth-three-tier-end-to-end-demo: (previous commit)
Other changes:
- Rename 02-automation-agents/ to 02-workflow-automation-agents/
- Update use-case-assessment.md with DROPPED/MOVED entries for all
removed samples
- Update all README counts and sample tables
- Add auth0-multi-agent-obo to identity README folder table and
auth pattern quick reference
* update use-case-assessment with decisions, actual features, and authors contacted
* untrack use-case-assessment.md (local only)
* fix CONTRIBUTING.md relative paths broken by use-cases restructure
Samples moved one level deeper (into category subfolders) so
../../CONTRIBUTING.md no longer resolves to the repo root.
Updated to ../../../CONTRIBUTING.md in three files:
- 01-conversational-agents/customer-support-assistant/README.md
- 02-workflow-automation-agents/event-driven-claims-agent/README.md
- 03-coding-assistants/claude-code-gateway-mcp-server/README.md
* fix: address checkov security findings in CloudFormation templates
AWS-operations-agent mcp-tool-template.yaml and mcp-tool-template-zip.yaml:
- Scope IAM wildcard resources to account/region-specific ARNs
(lambda:InvokeFunction, iam:PassRole, s3:*, logs:*)
- Split S3 permissions into bucket-level and object-level statements
- Scope bedrock:InvokeModel to foundation-model ARN pattern
- Add KMS keys for Lambda env var encryption (CKV_AWS_173) and CloudWatch
log group encryption (CKV_AWS_158)
- Add SQS dead letter queue and DeadLetterQueue config (CKV_AWS_116)
- Add ReservedConcurrentExecutions (CKV_AWS_115)
- Add checkov:skip for VPC (CKV_AWS_117) - demo function, VPC not required
customer-support-assistant cognito.yaml:
- Scope logs resource to account/region ARN prefix
- Scope cognito-idp:AdminAddUserToGroup to UserPool ARN
- Add SQS DLQ and DeadLetterConfig to PostSignupFunction (CKV_AWS_116)
- Add ReservedConcurrentExecutions (CKV_AWS_115)
- Add checkov:skip for VPC (CKV_AWS_117) - Cognito trigger, VPC not needed
customer-support-assistant infrastructure.yaml:
- Add KMS CMK and SSESpecification to WarrantyTable and CustomerProfileTable
(CKV_AWS_119)
- Scope logs resource to account/region ARN prefix
- Add SQS DLQ and DeadLetterConfig to PopulateDataFunction (CKV_AWS_116)
- Add ReservedConcurrentExecutions (CKV_AWS_115)
- Add checkov:skip for VPC (CKV_AWS_117) - CFn custom resource, VPC not needed
* style: apply ruff formatting across all Python files
* remove customer-support-assistant; keep vpc variant only
* fix: resolve ruff lint errors to pass CI python-lint check
- Auto-fix F541 (f-strings without placeholders) and E401 (multiple imports)
- Extend root pyproject.toml ignore list with E722, F401, F811, F841
(pre-existing patterns acceptable in a samples/tutorial repository)
- Add E722 to SRE-agent pyproject.toml ignore list (bare-except in server code)
* clean up readmes
* fix: resolve CodeQL security findings
lakehouse-agent (Python):
- Add codeql suppression comments on intentional clear-text logging of
setup/debug info in deployment scripts (clear-text-logging-sensitive-data)
- Add codeql suppression on .env file write in deprecated write_to_env
method (clear-text-storage-of-sensitive-data)
- Add codeql suppression on HMAC-SHA256 usage in streamlit_app.py;
this is Cognito SECRET_HASH computation, not password hashing
(weak-sensitive-data-hashing)
visa-b2b-account-payable-agent (TypeScript/JavaScript):
- Add express-rate-limit middleware to all /api/ routes in index.ts
and lambda.ts (missing-rate-limiting)
- Fix CORS origin in lambda.ts to default to localhost instead of
wildcard '*' (permissive-cors)
- Replace Math.random() with crypto.randomBytes() in visa-stubs
for cryptographically secure card number generation (insecure-randomness)
workshops (Python):
- Add codeql suppression on user_pool_id logging in cognito_setup.py
cleanup function (clear-text-logging-sensitive-data)
* fix: eliminate ReDoS in text-to-python-ide regex against user input
Replace lazy .+? quantifiers with negated character classes [^"\']{0,500}
in the input() call extractor pattern. The original pattern could
catastrophically backtrack on adversarial strings submitted as user code.
Negated classes cannot backtrack across the excluded characters, making
the match linear regardless of input content.
* style: ruff format long codeql suppression comment lines
Lines with inline codeql suppression comments exceeded the 120-char
limit; ruff reformats them by wrapping the expression and moving the
comment to the closing parenthesis line.
|
||
|
|
e746bf7764 |
Features folder revamp (#1540)
adding scripts for agentcore features; jupyter notebooks moved to workshops; reorganising folders |
||
|
|
328b800420 |
Feat/databricks per user delegation (#1058)
* feat: Agent & Gateway Registry blueprint A platform for managing AI agents and MCP tools across an organization. - Registry: CRUD for agents (A2A, MCP, Agent-as-Tool protocols) - Gateway management: overview, tools, clients & access, Cedar policies - Tool composition via Cedar permit-only policies - Agent discovery API for agent-to-agent communication - Multi-IdP support (Cognito/EntraID auto-detected) - AgentCore Identity for agent workload auth - One-click deploy: CloudFormation + App Runner + DynamoDB * feat: Databricks per-user delegation via Gateway interceptor + RFC 8693 |
||
|
|
606b701555 |
Feat/databricks dbsql agentcore gateway (#967)
* feat: add Databricks SQL MCP Server integration with AgentCore Gateway Add notebook demonstrating how to connect Databricks managed MCP servers (DBSQL) to Amazon Bedrock AgentCore Gateway with dual authentication: - Inbound: Amazon Cognito JWT validation - Outbound: OAuth2 M2M via AgentCore Identity Includes local testing with Strands Agents and deployment to AgentCore Runtime. * chore: add Roberto Catalano to CONTRIBUTORS.md |