Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

mcp-gateway-securityMCP gateway 安全

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

318

周安装

13

GitHub Stars

219

下载量

102
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:mcp-gateway-security(MCP gateway 安全)
来源仓库:https://github.com/hack23/cia
仓库路径:skills/mcp-gateway-security
安装命令:
npx skills add https://github.com/hack23/cia --skill mcp-gateway-security
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/hack23/cia --skill mcp-gateway-security

简介

用于辅助安全审计、权限检查和认证流程分析,适合梳理敏感配置或生成复核清单。

  • 适用于需要排查常见漏洞或分析依赖风险的场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用。
  • 不能将工具输出直接当作最终结论,需人工复核关键判断。
  • 涉及密钥、令牌或生产系统时应先确认最小权限与脱敏方式。

SKILL.md

MCP Gateway Security Skill

Purpose

This skill provides security patterns and best practices for securing MCP (Model Context Protocol) gateway communications in the CIA platform. It covers token management, request validation, audit logging, and threat mitigation for AI-assisted development workflows.

When to Use This Skill

Apply this skill when:

  • ✅ Hardening MCP gateway configurations
  • ✅ Managing tokens and credentials for MCP servers
  • ✅ Implementing request validation for MCP tool calls
  • ✅ Setting up audit logging for MCP communications
  • ✅ Conducting security reviews of MCP configurations
  • ✅ Responding to security incidents involving MCP
  • ✅ Assessing risks of new MCP server integrations

Do NOT use for:

  • ❌ Initial MCP setup (use mcp-gateway-configuration)
  • ❌ Application-level security (use secure-code-review)
  • ❌ Infrastructure security (use security-architecture-validation)

Threat Model for MCP

Attack Surface

┌──────────────────────────────────────────────┐
│                 Threat Vectors                │
├──────────────────────────────────────────────┤
│                                              │
│  ┌──────────┐    ┌──────────┐    ┌────────┐ │
│  │ Token     │    │ Prompt   │    │ Supply │ │
│  │ Theft     │    │ Injection│    │ Chain  │ │
│  └────┬─────┘    └────┬─────┘    └───┬────┘ │
│       │               │              │       │
│       ▼               ▼              ▼       │
│  ┌─────────────────────────────────────────┐ │
│  │         MCP Gateway                      │ │
│  └────┬────────────┬────────────┬──────────┘ │
│       │            │            │            │
│  ┌────▼────┐  ┌────▼────┐  ┌───▼─────┐     │
│  │ Unauth  │  │ Data    │  │ Lateral │     │
│  │ Access  │  │ Exfil   │  │ Movement│     │
│  └─────────┘  └─────────┘  └─────────┘     │
└──────────────────────────────────────────────┘

Threat Matrix

ThreatLikelihoodImpactMitigation
Token theft from configMediumCriticalEnvironment variables, secret managers
Prompt injection via toolsMediumHighInput validation, output sanitization
Supply chain attack on MCP packagesLowCriticalVersion pinning, integrity checks
Unauthorized file accessMediumHighDirectory restrictions, least privilege
Data exfiltration via MCP toolsLowHighOutput monitoring, allowed destinations
Privilege escalationLowCriticalRole-based access, capability limits

Token Management

Token Security Requirements

RequirementImplementationPriority
No hardcoded tokensEnvironment variables onlyCritical
Token rotationRegular rotation scheduleHigh
Least privilege scopesMinimal required permissionsCritical
Token encryption at restOS keychain or secret managerHigh
Token audit trailLog token usage, not valuesMedium

Secure Token Configuration

{
  "mcpServers": {
    "github": {
      "type": "stdio",
      "command": "github-mcp-server",
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}

Token Handling Rules:

✅ DO: Use environment variable references (${VAR_NAME})
✅ DO: Use GitHub Actions secrets for CI/CD tokens
✅ DO: Rotate tokens at least quarterly
✅ DO: Use fine-grained PATs with minimal scopes
✅ DO: Revoke tokens immediately when compromised

❌ DON'T: Hardcode tokens in configuration files
❌ DON'T: Commit tokens to version control
❌ DON'T: Share tokens between environments
❌ DON'T: Use classic PATs with broad scopes
❌ DON'T: Log token values in any log output

GitHub Token Scopes (Principle of Least Privilege)

MCP OperationRequired ScopeJustification
Read codecontents:readCode search and file reading
Create PRspull_requests:writePR creation and updates
Manage issuesissues:writeIssue creation and updates
Read workflowsactions:readCI/CD status checking
Security alertssecurity_events:readCodeQL and Dependabot

Request Validation

Input Validation for MCP Tools

File Operations:

Validation Rules:
1. Path must be within allowed directories
2. Path must not contain traversal sequences (../)
3. File extension must be in allowed list
4. File size must not exceed limits
5. Content must not contain known malicious patterns

Code Operations:

Validation Rules:
1. Branch names must match allowed pattern
2. Commit messages must not contain secrets
3. File content must pass security scanning
4. PR descriptions must not leak sensitive data

Output Sanitization

Before Returning MCP Tool Output:
1. Strip any credential-like patterns
2. Remove internal IP addresses/hostnames
3. Truncate excessively large outputs
4. Validate JSON/structured output format
5. Log sanitization actions for audit

Dangerous Tool Patterns

ToolRiskMitigation
filesystem.write_fileOverwrite critical filesRestrict to project directories
filesystem.deleteData lossRequire confirmation, backup
github.push_filesInject malicious codeCode review before merge
playwright.evaluateExecute arbitrary JSSandbox, restrict domains
bash.executeSystem command executionAllowlist commands, sandbox

Audit Logging

What to Log

EventLog LevelData to Capture
MCP server start/stopINFOServer name, timestamp
Tool invocationINFOTool name, parameters (sanitized)
Authentication successINFOServer name, token type (not value)
Authentication failureWARNServer name, failure reason
Access deniedWARNTool, resource, reason
Configuration changeINFOWhat changed, who changed it
Error/exceptionERRORError details, stack trace

What NOT to Log

❌ Token values or API keys
❌ File contents containing secrets
❌ User passwords or credentials
❌ Full request/response bodies with PII
❌ Internal network topology details

Audit Log Format

{
  "timestamp": "2024-01-15T10:30:00Z",
  "event": "mcp.tool.invocation",
  "server": "github",
  "tool": "create_pull_request",
  "parameters": {
    "owner": "Hack23",
    "repo": "cia",
    "title": "[REDACTED]"
  },
  "result": "success",
  "duration_ms": 1250,
  "user": "copilot-agent"
}

Security Configuration Checklist

Pre-Deployment

□ All tokens use environment variables (never hardcoded)
□ Token scopes follow least privilege
□ Filesystem access restricted to project directory only
□ MCP package versions pinned to specific releases
□ Configuration file committed (without secrets)
□ No sensitive data in MCP server arguments
□ SSE server URLs use HTTPS only
□ Certificate validation enabled for remote servers

Periodic Review (Monthly)

□ Review token scopes — remove unnecessary permissions
□ Rotate tokens per schedule
□ Check for new MCP package versions and CVEs
□ Review audit logs for anomalies
□ Verify directory restrictions still appropriate
□ Test authentication failure handling
□ Review and update threat model
□ Check for deprecated MCP server versions

Incident Response

MCP Security Incident
    │
    ├─→ Token Compromise
    │   ├─→ Revoke token immediately
    │   ├─→ Rotate all related tokens
    │   ├─→ Review audit logs for unauthorized access
    │   └─→ Update token storage mechanism
    │
    ├─→ Unauthorized File Access
    │   ├─→ Review filesystem server configuration
    │   ├─→ Check for directory traversal attempts
    │   ├─→ Restrict filesystem paths
    │   └─→ Review accessed files for data exposure
    │
    ├─→ Supply Chain Attack
    │   ├─→ Pin to known-good version
    │   ├─→ Verify package integrity
    │   ├─→ Check for malicious tool behavior
    │   └─→ Report to MCP package maintainers
    │
    └─→ Prompt Injection
        ├─→ Review tool invocation logs
        ├─→ Identify injected content
        ├─→ Assess data exposure
        └─→ Update input validation rules

OWASP Agentic Security Alignment

OWASP Agentic RiskMCP Mitigation
Excessive AgencyRestrict tool capabilities, require confirmation
Tool MisuseInput validation, output monitoring
Privilege EscalationLeast privilege tokens, capability limits
Data LeakageOutput sanitization, logging controls
Insecure OutputValidate all MCP tool responses
Supply ChainPin versions, verify integrity

ISMS Alignment

Security AreaISO 27001NIST CSFCIS Controls
Token ManagementA.8.24, A.5.17PR.DS-1CIS 3.11
Access ControlA.8.3, A.8.5PR.AC-4CIS 6.1
Audit LoggingA.8.15DE.AE-3CIS 8.2
Input ValidationA.8.28PR.IP-12CIS 16.1
Configuration MgmtA.8.9PR.IP-1CIS 4.1
Incident ResponseA.5.24-A.5.27RS.MA-1CIS 17.1

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

33.87%
按下载量换算35

Claude

27.86%
按下载量换算28

Cursor

19.15%
按下载量换算20

Gemini CLI

10.6%
按下载量换算11

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills