Skip to content

CIMD support for AgentCore Gateway + Cognito#1149

Open
massi-ang wants to merge 2 commits intoawslabs:mainfrom
massi-ang:feat/cimd
Open

CIMD support for AgentCore Gateway + Cognito#1149
massi-ang wants to merge 2 commits intoawslabs:mainfrom
massi-ang:feat/cimd

Conversation

@massi-ang
Copy link
Contributor

Amazon Bedrock AgentCore Samples Pull Request

Important

  1. We strictly follow a issue-first approach, please first open an issue relating to this Pull Request.
  2. Once this Pull Request is ready for review please attach review ready label to it. Only PRs with review ready will be reviewed.

Issue number: #1148

Concise description of the PR

Sample showcasing how to add CIMD support to MCP servers provides by AgentCore Gateway with Cognito auth.
CIMD is the new standard to allow clients to dynamically interact with OAuth Servers, and replaces DCR in the MCP specs. Neither AgentCore Gateway nor Cognito currently support this feature and this sample shows how to add such support

User experience

Please share what the user experience looks like before and after this change

With this sample, you can add AgentCore Gateway as an MCP server to a client supporting CIMD (VS Code)

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • I have reviewed the contributing guidelines
  • Add your name to CONTRIBUTORS.md
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • [] Are you uploading a dataset?
  • [x ] Have you documented Introduction, Architecture Diagram, Prerequisites, Usage, Sample Prompts, and Clean Up steps in your example README?
  • I agree to resolve any issues created for this example in the future.
  • I have performed a self-review of this change
  • Changes have been tested
  • Changes are documented

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@review-notebook-app
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@github-actions github-actions bot added 01-tutorials 01-tutorials 01-AgentCore-runtime 01-tutorials/01-AgentCore-runtime 02-AgentCore-gateway 01-tutorials/02-AgentCore-gateway labels Mar 20, 2026
@github-actions
Copy link

github-actions bot commented Mar 20, 2026

Latest scan for commit: 123785c | Updated: 2026-03-20 15:50:57 UTC

Security Scan Results

Scan Metadata

  • Project: ASH
  • Scan executed: 2026-03-20T15:50:41+00:00
  • ASH version: 3.0.0

Summary

Scanner Results

The table below shows findings by scanner, with status based on severity thresholds and dependencies:

Column Explanations:

Severity Levels (S/C/H/M/L/I):

  • Suppressed (S): Security findings that have been explicitly suppressed/ignored and don't affect the scanner's pass/fail status
  • Critical (C): The most severe security vulnerabilities requiring immediate remediation (e.g., SQL injection, remote code execution)
  • High (H): Serious security vulnerabilities that should be addressed promptly (e.g., authentication bypasses, privilege escalation)
  • Medium (M): Moderate security risks that should be addressed in normal development cycles (e.g., weak encryption, input validation issues)
  • Low (L): Minor security concerns with limited impact (e.g., information disclosure, weak recommendations)
  • Info (I): Informational findings for awareness with minimal security risk (e.g., code quality suggestions, best practice recommendations)

Other Columns:

  • Time: Duration taken by each scanner to complete its analysis
  • Action: Total number of actionable findings at or above the configured severity threshold that require attention

Scanner Results:

  • PASSED: Scanner found no security issues at or above the configured severity threshold - code is clean for this scanner
  • FAILED: Scanner found security vulnerabilities at or above the threshold that require attention and remediation
  • MISSING: Scanner could not run because required dependencies/tools are not installed or available
  • SKIPPED: Scanner was intentionally disabled or excluded from this scan
  • ERROR: Scanner encountered an execution error and could not complete successfully

Severity Thresholds (Thresh Column):

  • CRITICAL: Only Critical severity findings cause scanner to fail
  • HIGH: High and Critical severity findings cause scanner to fail
  • MEDIUM (MED): Medium, High, and Critical severity findings cause scanner to fail
  • LOW: Low, Medium, High, and Critical severity findings cause scanner to fail
  • ALL: Any finding of any severity level causes scanner to fail

Threshold Source: Values in parentheses indicate where the threshold is configured:

  • (g) = global: Set in the global_settings section of ASH configuration
  • (c) = config: Set in the individual scanner configuration section
  • (s) = scanner: Default threshold built into the scanner itself

Statistics calculation:

  • All statistics are calculated from the final aggregated SARIF report
  • Suppressed findings are counted separately and do not contribute to actionable findings
  • Scanner status is determined by comparing actionable findings to the threshold
Scanner S C H M L I Time Action Result Thresh
bandit 0 4 0 0 1 0 711ms 4 FAILED MED (g)
cdk-nag 0 0 0 0 0 0 35.8s 0 PASSED MED (g)
cfn-nag 0 0 0 0 0 0 793ms 0 PASSED MED (g)
checkov 0 0 0 0 0 0 5.6s 0 PASSED MED (g)
detect-secrets 0 0 0 0 0 0 1.1s 0 PASSED MED (g)
grype 0 3 0 1 0 0 38.0s 4 FAILED MED (g)
npm-audit 0 0 0 0 0 0 197ms 0 PASSED MED (g)
opengrep 0 0 0 0 0 0 <1ms 0 SKIPPED MED (g)
semgrep 0 3 0 0 0 0 18.9s 3 FAILED MED (g)
syft 0 0 0 0 0 0 3.2s 0 PASSED MED (g)

Detailed Findings

Show 11 actionable findings

Finding 1: B113

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B113
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:177-179

Description:
Call to requests without timeout

Code Snippet:

# we assume the client_id is an url
        cimd_manifest = requests.get(client_id).json()
        resp = cognito.create_user_pool_client(

Finding 2: B310

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B310
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:293-295

Description:
Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.

Code Snippet:

try:
        with urllib.request.urlopen(req, timeout=30) as resp:
            token_data = json.loads(resp.read().decode())

Finding 3: B310

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B310
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:377-379

Description:
Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.

Code Snippet:

with urllib.request.urlopen(req, timeout=60) as resp:
            resp_body = resp.read().decode()

Finding 4: B310

  • Severity: HIGH
  • Scanner: bandit
  • Rule ID: B310
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:442-444

Description:
Audit url open for permitted schemes. Allowing use of file:/ or custom schemes is often unexpected.

Code Snippet:

req.add_header("Content-Type", "application/json")
        urllib.request.urlopen(req, timeout=5)
    except Exception as e:

Finding 5: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected

  • Severity: HIGH
  • Scanner: semgrep
  • Rule ID: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:294

Description:
Detected a dynamic value being used with urllib. urllib supports 'file://' schemes, so a dynamic value controlled by a malicious actor may allow them to read arbitrary files. Audit uses of urllib calls to ensure user data cannot control the URLs, or consider using the 'requests' library instead.

Code Snippet:

with urllib.request.urlopen(req, timeout=30) as resp:

Finding 6: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected

  • Severity: HIGH
  • Scanner: semgrep
  • Rule ID: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:378

Description:
Detected a dynamic value being used with urllib. urllib supports 'file://' schemes, so a dynamic value controlled by a malicious actor may allow them to read arbitrary files. Audit uses of urllib calls to ensure user data cannot control the URLs, or consider using the 'requests' library instead.

Code Snippet:

with urllib.request.urlopen(req, timeout=60) as resp:

Finding 7: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected

  • Severity: HIGH
  • Scanner: semgrep
  • Rule ID: python.lang.security.audit.dynamic-urllib-use-detected.dynamic-urllib-use-detected
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/lambda/mcp_proxy_lambda.py:443

Description:
Detected a dynamic value being used with urllib. urllib supports 'file://' schemes, so a dynamic value controlled by a malicious actor may allow them to read arbitrary files. Audit uses of urllib calls to ensure user data cannot control the URLs, or consider using the 'requests' library instead.

Code Snippet:

urllib.request.urlopen(req, timeout=5)

Finding 8: GHSA-3ppc-4f35-3m26-minimatch

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-3ppc-4f35-3m26-minimatch
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json:1

Description:
A high vulnerability in npm package: minimatch, version 3.1.2 was found at: /01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json


Finding 9: GHSA-7r86-cg39-jmmj-minimatch

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-7r86-cg39-jmmj-minimatch
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json:1

Description:
A high vulnerability in npm package: minimatch, version 3.1.2 was found at: /01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json


Finding 10: GHSA-23c5-xmqv-rm74-minimatch

  • Severity: HIGH
  • Scanner: grype
  • Rule ID: GHSA-23c5-xmqv-rm74-minimatch
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json:1

Description:
A high vulnerability in npm package: minimatch, version 3.1.2 was found at: /01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json


Finding 11: GHSA-2g4f-4pwh-qvx6-ajv

  • Severity: MEDIUM
  • Scanner: grype
  • Rule ID: GHSA-2g4f-4pwh-qvx6-ajv
  • Location: 01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json:1

Description:
A medium vulnerability in npm package: ajv, version 8.17.1 was found at: /01-tutorials/02-AgentCore-gateway/04-integration/06-gateway-with-cimd/cdk/package-lock.json


Report generated by Automated Security Helper (ASH) at 2026-03-20T15:50:35+00:00

@github-actions github-actions bot removed the 01-AgentCore-runtime 01-tutorials/01-AgentCore-runtime label Mar 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

01-tutorials 01-tutorials 02-AgentCore-gateway 01-tutorials/02-AgentCore-gateway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant