Add role-based HR data agent with scope-based field redaction via AgentCore Gateway#1262
Add role-based HR data agent with scope-based field redaction via AgentCore Gateway#1262zubeens wants to merge 4 commits intoawslabs:mainfrom
Conversation
Demonstrates scope-based HR data access using AgentCore Gateway interceptors and Cedar policy engine. An HR Manager sees full employee records; an HR Specialist sees profiles but not compensation; an Employee sees names only. DLP redaction is applied transparently by the Response Interceptor — no application code changes needed when switching personas.
- dummy_data.py: MD5 usedforsecurity=False (bandit B324) - cognito.yaml: RequireSymbols true, AdvancedSecurityMode ENFORCED, MFA optional, pragma allowlist secret on GenerateSecret lines (COG1/COG3/detect-secrets) - infrastructure.yaml: Lambda runtime python3.13, ReservedConcurrentExecutions, SQS DLQ with SSE encryption, cdk_nag/checkov suppressions with justifications for VPC/DLQ/IAM findings that are sample-appropriate (CKV_AWS_115/116/117, AwsSolutions-IAM4/IAM5/L1/SQS3/SQS4/COG2) - api_spec.json: add securitySchemes + global security field (CKV_OPENAPI_4/5) - main.py: nosemgrep for BedrockAgentCoreApp.run() false positive - app.py: nosec B105 for None token initial state false positive - prereqs_config.yaml: runtime python3.13 - README.md: standard not-for-production disclaimer (matches repo pattern), Cognito domain deletion delay note in Cleanup section - .gitignore: add .ash/ash_output/ to exclude generated scan reports ASH scan result: 0 actionable findings (bandit, cdk-nag, checkov, detect-secrets, semgrep all PASSED). 6 suppressions with justifications. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Security Scan Results — ASH v3.2.5All required security fixes have been applied and the ASH scan is clean (exit 0 — 0 actionable findings). What was fixed
Suppressions with justification (6 total)All suppressions include documented justifications in the CloudFormation
ASH Security Scan Report
Scan Metadata
SummaryScanner ResultsThe table below shows findings by scanner, with status based on severity thresholds and dependencies:
Report generated by Automated Security Helper (ASH) at 2026-04-13T18:42:32+00:00 |
AWS Holmes Security Scan — Findings FixedRan AWS Holmes ( Real Fixes Applied
Justified Suppressions (Not Fixed)
|
…-guard suppressions, naming standards AWS Holmes (HolmesContentSecurityReviewBaselinePolicy) reported 108 findings. All actionable findings addressed: Security fixes: - Cedar: replace hardcoded AWS account ID 943677087104 with <YOUR-ACCOUNT-ID> placeholder - S3: add Block Public Access, AES-256 encryption, and TLS-only bucket policy in prereq.sh CloudFormation cfn-guard suppressions (guard.SuppressedRules): - SQS_QUEUE_KMS_MASTER_KEY_ID_RULE on DLQ (uses SqsManagedSseEnabled) - IAM_NO_INLINE_POLICY_CHECK on all 3 IAM roles - LAMBDA_INSIDE_VPC on all 3 Lambda functions - LAMBDA_DLQ_CHECK on interceptor Lambdas (synchronous invocation) Documentation / naming: - AWS Service Name Standards: "Amazon Bedrock AgentCore" first-mention across 15 files - CloudFormation section comments: AWS Lambda, Amazon SQS, AWS IAM full names - README: soften superlative language; update AwsSolutions-L1 reason to python3.13 - utils.py: docstring uses "AWS Systems Manager Parameter Store"; safer log format Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Guardian Review — Security Review ✅ ApprovedTicket: V2175137440 The security scan identified 108 findings spanning 27 files. This PR update resolves all actionable items either through direct fixes or documented suppressions with proper justification. ASH Security ScanAll scanners passed with 0 actionable findings. The ASH Security Scan Report looks good. AWS Holmes Security ScanAll 108 findings resolved:
ResolutionAll actionable security findings addressed. Closing as approved.
|
Summary
Key capabilities demonstrated
tools/call)tools/list) and scope-based field redactionclient_id→ tenant mapping in SSM (no custom JWT claims required)client_credentialsflow with custom scopes per personaTest plan
bash scripts/prereq.sh --region us-east-1 --env dev— deploys Lambda, IAM, Cognitopython scripts/agentcore_gateway.py create— creates Gateway with interceptors and Lambda targetpython scripts/create_cedar_policies.py— attaches Cedar engine and creates 3 HR authorization policiesbash scripts/package_runtime.sh && python scripts/agentcore_agent_runtime.py create— deploys Runtimepython test/test_dlp_redaction.py— verifies all 4 personas pass field redaction assertionspython test/test_agent.py --persona hr-manager --prompt "Show me John Smith's compensation"— full agent teststreamlit run app.py— UI smoke test across all personas