Token导航 LogoToken导航TokenDH.com
研究检索操作浏览器github未标认证来源可访问许可证需确认审计通过

apim-policy-authoringAPIM 政策制定

Agent Skill

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

总安装

196

周安装

8

GitHub Stars

162

下载量

63
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/thomast1906/github-copilot-agent-skills --skill apim-policy-authoring

简介

生成 Azure API Management 生产就绪的策略 XML,涵盖认证、限流、CORS 和安全头设置。

  • 适合需要标准化 API 网关配置、统一错误响应格式或实施细粒度访问控制的场景。
  • 支持 OAuth2、JWT 验证、请求转换和关联 ID 注入等功能,满足企业级安全要求。
  • 输出结果需人工复核后再部署,尤其涉及生产环境时应先测试策略对现有流量的影响。
  • apim-policy-authoring 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

APIM Policy Authoring Skill

Generates production-ready Azure API Management policy XML with authentication, rate limiting, CORS, error handling, correlation IDs, and security headers.

When to Use This Skill

Activate this skill when users need:

  • Authentication policies: OAuth 2.0, JWT validation, hybrid auth with subscription keys
  • Rate limiting: Per-user or per-subscription throttling
  • CORS configuration: Cross-origin access for browser-based clients
  • Error handling: Standardized error responses with correlation IDs
  • Request/response transformation: Header manipulation, body transformations
  • Security headers: X-Content-Type-Options, X-Frame-Options, etc.

Policy Templates

See references/POLICY_TEMPLATES.md for complete production-ready XML templates:

  1. Hybrid Authentication - OAuth + subscription key fallback for public APIs
  2. OAuth Only - Internal corporate APIs with Entra ID
  3. Subscription Key Only - Simple public read-only APIs

Policy Execution Flow

INBOUND → BACKEND → OUTBOUND → ON-ERROR

1. INBOUND: Authentication, rate limiting, CORS, headers
2. BACKEND: Forwarding, retry, circuit breaker
3. OUTBOUND: Response transform, security headers, cleanup
4. ON-ERROR: Structured errors, logging, correlation ID

Important: MCP Tools (ALWAYS Use Before Writing Policies)

1. Call Best Practices FIRST

Before ANY policy generation, call:

Tool: mcp_azure_mcp_get_azure_bestpractices
Intent: "Azure API Management policy best practices for [authentication|rate-limiting|CORS|error-handling]"

2. Search Documentation

For specific policy elements:

Tool: mcp_azure_mcp_documentation search
Query: "APIM validate-jwt policy reference"

1. JWT Validation with Entra ID

<validate-jwt header-name="Authorization">
    <openid-config url="https://login.microsoftonline.com/{tenant}/v2.0/.well-known/openid-configuration" />
    <audiences>
        <audience>api://{client-id}</audience>
    </audiences>
</validate-jwt>

2. Per-User Rate Limiting

<set-variable name="userId" value="@(context.Request.Headers.GetValueOrDefault('Authorization','').AsJwt()?.Subject)" />
<rate-limit-by-key calls="1000" renewal-period="3600" counter-key="@((string)context.Variables['userId'])" />

3. Correlation ID Generation

<set-variable name="correlationId" value="@(Guid.NewGuid().ToString())" />
<set-header name="X-Correlation-ID" exists-action="override">
    <value>@((string)context.Variables["correlationId"])</value>
</set-header>

4. Standardized Error Response

<on-error>
    <set-body>@{
        return new JObject(
            new JProperty("error", new JObject(
                new JProperty("code", context.LastError.Source),
                new JProperty("message", context.LastError.Message),
                new JProperty("correlationId", context.Variables["correlationId"]),
                new JProperty("timestamp", DateTime.UtcNow.ToString("o"))
            ))
        ).ToString();
    }</set-body>
</on-error>

5. Security Headers

<set-header name="X-Content-Type-Options" exists-action="override">
    <value>nosniff</value>
</set-header>
<set-header name="X-Frame-Options" exists-action="override">
    <value>DENY</value>
</set-header>
<set-header name="Strict-Transport-Security" exists-action="override">
    <value>max-age=31536000; includeSubDomains</value>
</set-header>

Authentication Decision Matrix

API TypeAuthenticationRate LimitUse Case
Public Read-OnlySubscription Keys500 req/hourWeather API, Public Holidays
Internal CorporateOAuth (Entra ID)10,000 req/hourEmployee Directory, HR Systems
Sensitive PublicOAuth (Entra External ID)1,000 req/hourPayment, Health Records
HybridOAuth + Keys Fallback1,000/500 req/hourAPIs with free/premium tiers

Policy Validation Checklist

Before deploying, verify:

  • Correlation ID: Generated in <inbound>, included in response + error
  • Authentication: JWT validation or subscription key check
  • Rate limiting: Configured with appropriate limits
  • Error handling: <on-error> block with structured JSON
  • Security headers: X-Content-Type-Options, X-Frame-Options, HSTS
  • Backend cleanup: Remove X-Powered-By, Server in <outbound>
  • XML validity: Well-formed, no unclosed tags
  • Testing: Valid/invalid tokens, rate limit exceeded

Related Skills

  • azure-apim-architecture - Understand architecture before policy authoring
  • api-security-review - Validate security after policy creation

Microsoft Documentation


Skill Version: 1.0 Last Updated: 29 January 2026 Primary Knowledge: APIM_PLATFORM_BASELINE_POLICIES.md, references/POLICY_TEMPLATES.md

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

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

平台分布

Codex

35.35%
按下载量换算22

Claude

28.51%
按下载量换算18

Cursor

18.99%
按下载量换算12

Gemini CLI

8.51%
按下载量换算5

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

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

来源信息

继续浏览同类 Skills