[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71B7FKYPTDEXWMZKM6MEYRY":3,"skill-same:01M71B7FKYPTDEXWMZKM6MEYRY":78},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":49,"linkOnly":50,"markdownContent":51,"markdownBody":52,"frontMatter":53,"refName":57,"commitSha":58,"skillDirectory":59,"forksCount":60,"repositoryHtmlUrl":61,"repositoryHomepageUrl":6,"ownerHtmlUrl":62,"ownerBlogUrl":6,"ownerDescription":63,"updatedAt":64,"install":65,"resources":77},"01M71B7FKYPTDEXWMZKM6MEYRY","cyber-implementing-api-security-posture-management",null,"Implement API Security Posture Management to continuously discover, classify, and score APIs based on risk while enforcing security policies across the API lifecycle.","nexuslinkproductions\u002Fyuri-os","nexuslinkproductions","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F273246263?v=4","01M718YX9NZRCW50B59B8ZVDKN","Marcel Spatz","01M718YXAQ7530F4B1VKN6SFQV",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-implementing-api-security-posture-management\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],"api","cyber implementing api security posture management","security","api security","implementing api security posture management","api security posture","security posture","management","implementing","apache","subdomain","across","monitoring","scoring","continuous-monitoring","false","cybersecurity","api-security","inventory","discover","2026-11-10 10:12:30",false,"---\nname: cyber-implementing-api-security-posture-management\ndescription: \"Implement API Security Posture Management to continuously discover, classify, and score APIs based on risk while enforcing security policies across the API lifecycle.\"\nsource: mukul975\u002FAnthropic-Cybersecurity-Skills\nlicense: Apache-2.0\nauthorized_lab: false\norigin_frontmatter: \"name: implementing-api-security-posture-management | description: Implement API Security Posture Management to continuously discover, classify, |   and score APIs based on risk while enforcing security policies across the API lifecycle. | domain: cybersecurity | subdomain: api-security | tags: | - api-security | - aspm | - api-posture-management | - api-discovery | - risk-scoring | - api-governance | - continuous-monitoring | - api-inventory | version: '1.0' | author: mahipal | license: Apache-2\"\nhide: true\n---\n\n> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Implementing API Security Posture Management\n\n## Overview\n\nAPI Security Posture Management (API-SPM) provides continuous visibility into an organization's API attack surface by automatically discovering, classifying, and risk-scoring all APIs including internal, external, partner, and shadow endpoints. Unlike point-in-time testing tools, API-SPM operates continuously to detect configuration drift, policy violations, missing security controls, sensitive data exposure, and compliance gaps. It aggregates findings from DAST, SAST, SCA, and runtime monitoring tools to provide a unified view of API risk posture across the organization.\n\n\n## When to Use\n\n- When deploying or configuring implementing api security posture management capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- API gateway with traffic logging (Kong, AWS API Gateway, Apigee, Envoy)\n- OpenAPI specifications for documented APIs\n- SIEM or log aggregation platform (Splunk, Elastic)\n- CI\u002FCD pipeline access for shift-left integration\n- Cloud provider APIs for infrastructure discovery\n- Python 3.8+ for custom posture assessment tooling\n\n## Core Components\n\n### 1. API Discovery and Inventory\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"API Security Posture Management Engine\n\nContinuously discovers, classifies, and risk-scores APIs\nto maintain a comprehensive security posture inventory.\n\"\"\"\n\nimport json\nimport re\nimport hashlib\nfrom datetime import datetime, timedelta\nfrom typing import Dict, List, Optional, Set\nfrom dataclasses import dataclass, field\nfrom enum import Enum\n\nclass APIClassification(Enum):\n    EXTERNAL = \"external\"\n    INTERNAL = \"internal\"\n    PARTNER = \"partner\"\n    SHADOW = \"shadow\"\n    DEPRECATED = \"deprecated\"\n\nclass RiskLevel(Enum):\n    CRITICAL = 4\n    HIGH = 3\n    MEDIUM = 2\n    LOW = 1\n    INFO = 0\n\n@dataclass\nclass SecurityControl:\n    name: str\n    present: bool\n    required: bool\n    severity: RiskLevel\n    details: str = \"\"\n\n@dataclass\nclass APIEndpoint:\n    api_id: str\n    method: str\n    path: str\n    service_name: str\n    classification: APIClassification\n    owner: Optional[str] = None\n    version: Optional[str] = None\n    first_discovered: str = \"\"\n    last_seen: str = \"\"\n    documented: bool = False\n    security_controls: List[SecurityControl] = field(default_factory=list)\n    risk_score: float = 0.0\n    sensitive_data_types: Set[str] = field(default_factory=set)\n    compliance_tags: Set[str] = field(default_factory=set)\n    traffic_volume_daily: int = 0\n\nclass APIPostureManager:\n    SENSITIVE_PATTERNS = {\n        \"ssn\": re.compile(r'\\b\\d{3}-\\d{2}-\\d{4}\\b'),\n        \"credit_card\": re.compile(r'\\b\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}\\b'),\n        \"email\": re.compile(r'\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b'),\n        \"api_key\": re.compile(r'\\b[A-Za-z0-9]{32,}\\b'),\n        \"jwt\": re.compile(r'eyJ[A-Za-z0-9_-]+\\.eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+'),\n        \"phone\": re.compile(r'\\b\\+?1?\\d{10,15}\\b'),\n    }\n\n    def __init__(self):\n        self.inventory: Dict[str, APIEndpoint] = {}\n        self.policy_rules: List[dict] = []\n\n    def generate_api_id(self, method: str, path: str, service: str) -> str:\n        raw = f\"{service}:{method}:{path}\"\n        return hashlib.sha256(raw.encode()).hexdigest()[:16]\n\n    def register_api(self, method: str, path: str, service_name: str,\n                     classification: APIClassification,\n                     documented: bool = False, owner: str = None) -> APIEndpoint:\n        api_id = self.generate_api_id(method, path, service_name)\n        now = datetime.now().isoformat()\n\n        if api_id in self.inventory:\n            endpoint = self.inventory[api_id]\n            endpoint.last_seen = now\n            return endpoint\n\n        endpoint = APIEndpoint(\n            api_id=api_id,\n            method=method,\n            path=path,\n            service_name=service_name,\n            classification=classification,\n            owner=owner,\n            first_discovered=now,\n            last_seen=now,\n            documented=documented\n        )\n        self.inventory[api_id] = endpoint\n        return endpoint\n\n    def assess_security_controls(self, endpoint: APIEndpoint,\n                                  traffic_sample: dict) -> List[SecurityControl]:\n        \"\"\"Evaluate security controls present on an API endpoint.\"\"\"\n        controls = []\n\n        # Authentication check\n        has_auth = any(h in traffic_sample.get('request_headers', {})\n                      for h in ['Authorization', 'X-API-Key', 'Cookie'])\n        controls.append(SecurityControl(\n            name=\"authentication\",\n            present=has_auth,\n            required=True,\n            severity=RiskLevel.CRITICAL,\n            details=\"No authentication mechanism detected\" if not has_auth else \"Authentication present\"\n        ))\n\n        # TLS\u002FHTTPS check\n        is_https = traffic_sample.get('scheme', '').lower() == 'https'\n        controls.append(SecurityControl(\n            name=\"transport_encryption\",\n            present=is_https,\n            required=True,\n            severity=RiskLevel.CRITICAL,\n            details=\"API accessible over HTTP without TLS\" if not is_https else \"HTTPS enforced\"\n        ))\n\n        # Rate limiting check\n        has_rate_limit = any(h.startswith('X-RateLimit') or h == 'Retry-After'\n                           for h in traffic_sample.get('response_headers', {}).keys())\n        controls.append(SecurityControl(\n            name=\"rate_limiting\",\n            present=has_rate_limit,\n            required=True,\n            severity=RiskLevel.HIGH,\n            details=\"No rate limiting headers detected\" if not has_rate_limit else \"Rate limiting active\"\n        ))\n\n        # CORS policy check\n        cors_origin = traffic_sample.get('response_headers', {}).get('Access-Control-Allow-Origin', '')\n        has_strict_cors = cors_origin and cors_origin != '*'\n        controls.append(SecurityControl(\n            name=\"cors_policy\",\n            present=has_strict_cors,\n            required=endpoint.classification == APIClassification.EXTERNAL,\n            severity=RiskLevel.HIGH if cors_origin == '*' else RiskLevel.MEDIUM,\n            details=f\"CORS origin: {cors_origin}\" if cors_origin else \"No CORS headers\"\n        ))\n\n        # Security headers\n        sec_headers = traffic_sample.get('response_headers', {})\n        required_headers = {\n            'X-Content-Type-Options': 'nosniff',\n            'Strict-Transport-Security': None,\n            'X-Frame-Options': None,\n            'Cache-Control': 'no-store',\n        }\n        missing = [h for h in required_headers if h not in sec_headers]\n        controls.append(SecurityControl(\n            name=\"security_headers\",\n            present=len(missing) == 0,\n            required=True,\n            severity=RiskLevel.MEDIUM,\n            details=f\"Missing headers: {', '.join(missing)}\" if missing else \"All security headers present\"\n        ))\n\n        # Input validation (check for schema validation errors in logs)\n        has_validation = traffic_sample.get('has_schema_validation', False)\n        controls.append(SecurityControl(\n            name=\"input_validation\",\n            present=has_validation,\n            required=True,\n            severity=RiskLevel.HIGH,\n            details=\"No schema validation detected\" if not has_validation else \"Input validation active\"\n        ))\n\n        endpoint.security_controls = controls\n        return controls\n\n    def calculate_risk_score(self, endpoint: APIEndpoint) -> float:\n        \"\"\"Calculate a composite risk score (0-100) for an API endpoint.\"\"\"\n        score = 0.0\n        max_score = 0.0\n\n        # Security controls scoring\n        for control in endpoint.security_controls:\n            weight = control.severity.value * 5\n            max_score += weight\n            if not control.present and control.required:\n                score += weight\n\n        # Classification risk multiplier\n        classification_weights = {\n            APIClassification.EXTERNAL: 1.5,\n            APIClassification.PARTNER: 1.3,\n            APIClassification.SHADOW: 2.0,\n            APIClassification.DEPRECATED: 1.8,\n            APIClassification.INTERNAL: 1.0,\n        }\n        multiplier = classification_weights.get(endpoint.classification, 1.0)\n\n        # Documentation penalty\n        if not endpoint.documented:\n            score += 10\n\n        # Sensitive data penalty\n        score += len(endpoint.sensitive_data_types) * 5\n\n        # Normalize to 0-100\n        if max_score > 0:\n            normalized = min(100, (score \u002F max_score) * 100 * multiplier)\n        else:\n            normalized = 0\n\n        endpoint.risk_score = round(normalized, 1)\n        return endpoint.risk_score\n\n    def generate_posture_report(self) -> dict:\n        \"\"\"Generate organization-wide API security posture report.\"\"\"\n        total = len(self.inventory)\n        if total == 0:\n            return {\"error\": \"No APIs in inventory\"}\n\n        risk_distribution = {level.name: 0 for level in RiskLevel}\n        classification_counts = {c.value: 0 for c in APIClassification}\n        undocumented = 0\n        missing_auth = 0\n        missing_tls = 0\n\n        for endpoint in self.inventory.values():\n            self.calculate_risk_score(endpoint)\n\n            if endpoint.risk_score >= 75:\n                risk_distribution[\"CRITICAL\"] += 1\n            elif endpoint.risk_score >= 50:\n                risk_distribution[\"HIGH\"] += 1\n            elif endpoint.risk_score >= 25:\n                risk_distribution[\"MEDIUM\"] += 1\n            else:\n                risk_distribution[\"LOW\"] += 1\n\n            classification_counts[endpoint.classification.value] += 1\n\n            if not endpoint.documented:\n                undocumented += 1\n\n            for control in endpoint.security_controls:\n                if control.name == \"authentication\" and not control.present:\n                    missing_auth += 1\n                if control.name == \"transport_encryption\" and not control.present:\n                    missing_tls += 1\n\n        avg_risk = sum(e.risk_score for e in self.inventory.values()) \u002F total\n\n        return {\n            \"report_date\": datetime.now().isoformat(),\n            \"total_apis\": total,\n            \"average_risk_score\": round(avg_risk, 1),\n            \"risk_distribution\": risk_distribution,\n            \"classification\": classification_counts,\n            \"undocumented_apis\": undocumented,\n            \"missing_authentication\": missing_auth,\n            \"missing_tls\": missing_tls,\n            \"top_risks\": sorted(\n                [{\"api_id\": e.api_id, \"method\": e.method, \"path\": e.path,\n                  \"service\": e.service_name, \"risk_score\": e.risk_score,\n                  \"classification\": e.classification.value}\n                 for e in self.inventory.values()],\n                key=lambda x: x[\"risk_score\"],\n                reverse=True\n            )[:20]\n        }\n```\n\n### 2. Policy Enforcement\n\nDefine and enforce security policies across all APIs:\n\n```yaml\n# api-security-policies.yaml\npolicies:\n  - name: require-authentication\n    description: All external APIs must require authentication\n    scope:\n      classification: [external, partner]\n    rule:\n      control: authentication\n      required: true\n    severity: critical\n    remediation: \"Add OAuth2, API key, or JWT authentication\"\n\n  - name: enforce-tls\n    description: All APIs must use HTTPS\n    scope:\n      classification: [external, internal, partner]\n    rule:\n      control: transport_encryption\n      required: true\n    severity: critical\n    remediation: \"Configure TLS certificates and redirect HTTP to HTTPS\"\n\n  - name: require-rate-limiting\n    description: External APIs must implement rate limiting\n    scope:\n      classification: [external]\n    rule:\n      control: rate_limiting\n      required: true\n    severity: high\n    remediation: \"Configure rate limiting at API gateway level\"\n\n  - name: no-wildcard-cors\n    description: APIs must not use wildcard CORS origins\n    scope:\n      classification: [external]\n    rule:\n      control: cors_policy\n      condition: \"origin != '*'\"\n    severity: high\n    remediation: \"Specify explicit allowed origins in CORS configuration\"\n\n  - name: documentation-required\n    description: All APIs must have OpenAPI documentation\n    scope:\n      classification: [external, partner]\n    rule:\n      documented: true\n    severity: medium\n    remediation: \"Create and publish OpenAPI specification\"\n\n  - name: deprecation-sunset\n    description: Deprecated APIs must have sunset headers\n    scope:\n      classification: [deprecated]\n    rule:\n      header_present: \"Sunset\"\n    severity: medium\n    remediation: \"Add Sunset header with planned removal date\"\n```\n\n## Continuous Monitoring Dashboard Metrics\n\n| Metric | Description | Target |\n|--------|------------|--------|\n| API Discovery Coverage | % of APIs with documentation | > 95% |\n| Average Risk Score | Mean risk score across all APIs | \u003C 25 |\n| Critical Findings | Number of critical-risk APIs | 0 |\n| Shadow API Count | Undocumented\u002Funmanaged APIs | 0 |\n| Authentication Coverage | % of APIs with auth controls | 100% |\n| TLS Coverage | % of APIs using HTTPS | 100% |\n| Policy Compliance | % of APIs meeting all policies | > 90% |\n| Mean Time to Remediate | Average days to fix findings | \u003C 7 days |\n\n## References\n\n- OX Security ASPM Guide 2025: https:\u002F\u002Fwww.ox.security\u002Fblog\u002Fapplication-security-posture-management-aspm\u002F\n- IBM ASPM Overview: https:\u002F\u002Fwww.ibm.com\u002Fthink\u002Ftopics\u002Faspm\n- StackHawk Best ASPM Tools: https:\u002F\u002Fwww.stackhawk.com\u002Fblog\u002Fbest-aspm-tools\u002F\n- AppSentinels API Security Posture Management: https:\u002F\u002Fappsentinels.ai\u002Fblog\u002Fapi-security-posture-management-from-reactive-protection-to-continuous-governance\u002F\n- Palo Alto Networks ASPM: https:\u002F\u002Fwww.paloaltonetworks.com\u002Fcyberpedia\u002Faspm-application-security-posture-management\n","> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\n\n# Implementing API Security Posture Management\n\n## Overview\n\nAPI Security Posture Management (API-SPM) provides continuous visibility into an organization's API attack surface by automatically discovering, classifying, and risk-scoring all APIs including internal, external, partner, and shadow endpoints. Unlike point-in-time testing tools, API-SPM operates continuously to detect configuration drift, policy violations, missing security controls, sensitive data exposure, and compliance gaps. It aggregates findings from DAST, SAST, SCA, and runtime monitoring tools to provide a unified view of API risk posture across the organization.\n\n\n## When to Use\n\n- When deploying or configuring implementing api security posture management capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- API gateway with traffic logging (Kong, AWS API Gateway, Apigee, Envoy)\n- OpenAPI specifications for documented APIs\n- SIEM or log aggregation platform (Splunk, Elastic)\n- CI\u002FCD pipeline access for shift-left integration\n- Cloud provider APIs for infrastructure discovery\n- Python 3.8+ for custom posture assessment tooling\n\n## Core Components\n\n### 1. API Discovery and Inventory\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv python3\n\"\"\"API Security Posture Management Engine\n\nContinuously discovers, classifies, and risk-scores APIs\nto maintain a comprehensive security posture inventory.\n\"\"\"\n\nimport json\nimport re\nimport hashlib\nfrom datetime import datetime, timedelta\nfrom typing import Dict, List, Optional, Set\nfrom dataclasses import dataclass, field\nfrom enum import Enum\n\nclass APIClassification(Enum):\n    EXTERNAL = \"external\"\n    INTERNAL = \"internal\"\n    PARTNER = \"partner\"\n    SHADOW = \"shadow\"\n    DEPRECATED = \"deprecated\"\n\nclass RiskLevel(Enum):\n    CRITICAL = 4\n    HIGH = 3\n    MEDIUM = 2\n    LOW = 1\n    INFO = 0\n\n@dataclass\nclass SecurityControl:\n    name: str\n    present: bool\n    required: bool\n    severity: RiskLevel\n    details: str = \"\"\n\n@dataclass\nclass APIEndpoint:\n    api_id: str\n    method: str\n    path: str\n    service_name: str\n    classification: APIClassification\n    owner: Optional[str] = None\n    version: Optional[str] = None\n    first_discovered: str = \"\"\n    last_seen: str = \"\"\n    documented: bool = False\n    security_controls: List[SecurityControl] = field(default_factory=list)\n    risk_score: float = 0.0\n    sensitive_data_types: Set[str] = field(default_factory=set)\n    compliance_tags: Set[str] = field(default_factory=set)\n    traffic_volume_daily: int = 0\n\nclass APIPostureManager:\n    SENSITIVE_PATTERNS = {\n        \"ssn\": re.compile(r'\\b\\d{3}-\\d{2}-\\d{4}\\b'),\n        \"credit_card\": re.compile(r'\\b\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}\\b'),\n        \"email\": re.compile(r'\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b'),\n        \"api_key\": re.compile(r'\\b[A-Za-z0-9]{32,}\\b'),\n        \"jwt\": re.compile(r'eyJ[A-Za-z0-9_-]+\\.eyJ[A-Za-z0-9_-]+\\.[A-Za-z0-9_-]+'),\n        \"phone\": re.compile(r'\\b\\+?1?\\d{10,15}\\b'),\n    }\n\n    def __init__(self):\n        self.inventory: Dict[str, APIEndpoint] = {}\n        self.policy_rules: List[dict] = []\n\n    def generate_api_id(self, method: str, path: str, service: str) -> str:\n        raw = f\"{service}:{method}:{path}\"\n        return hashlib.sha256(raw.encode()).hexdigest()[:16]\n\n    def register_api(self, method: str, path: str, service_name: str,\n                     classification: APIClassification,\n                     documented: bool = False, owner: str = None) -> APIEndpoint:\n        api_id = self.generate_api_id(method, path, service_name)\n        now = datetime.now().isoformat()\n\n        if api_id in self.inventory:\n            endpoint = self.inventory[api_id]\n            endpoint.last_seen = now\n            return endpoint\n\n        endpoint = APIEndpoint(\n            api_id=api_id,\n            method=method,\n            path=path,\n            service_name=service_name,\n            classification=classification,\n            owner=owner,\n            first_discovered=now,\n            last_seen=now,\n            documented=documented\n        )\n        self.inventory[api_id] = endpoint\n        return endpoint\n\n    def assess_security_controls(self, endpoint: APIEndpoint,\n                                  traffic_sample: dict) -> List[SecurityControl]:\n        \"\"\"Evaluate security controls present on an API endpoint.\"\"\"\n        controls = []\n\n        # Authentication check\n        has_auth = any(h in traffic_sample.get('request_headers', {})\n                      for h in ['Authorization', 'X-API-Key', 'Cookie'])\n        controls.append(SecurityControl(\n            name=\"authentication\",\n            present=has_auth,\n            required=True,\n            severity=RiskLevel.CRITICAL,\n            details=\"No authentication mechanism detected\" if not has_auth else \"Authentication present\"\n        ))\n\n        # TLS\u002FHTTPS check\n        is_https = traffic_sample.get('scheme', '').lower() == 'https'\n        controls.append(SecurityControl(\n            name=\"transport_encryption\",\n            present=is_https,\n            required=True,\n            severity=RiskLevel.CRITICAL,\n            details=\"API accessible over HTTP without TLS\" if not is_https else \"HTTPS enforced\"\n        ))\n\n        # Rate limiting check\n        has_rate_limit = any(h.startswith('X-RateLimit') or h == 'Retry-After'\n                           for h in traffic_sample.get('response_headers', {}).keys())\n        controls.append(SecurityControl(\n            name=\"rate_limiting\",\n            present=has_rate_limit,\n            required=True,\n            severity=RiskLevel.HIGH,\n            details=\"No rate limiting headers detected\" if not has_rate_limit else \"Rate limiting active\"\n        ))\n\n        # CORS policy check\n        cors_origin = traffic_sample.get('response_headers', {}).get('Access-Control-Allow-Origin', '')\n        has_strict_cors = cors_origin and cors_origin != '*'\n        controls.append(SecurityControl(\n            name=\"cors_policy\",\n            present=has_strict_cors,\n            required=endpoint.classification == APIClassification.EXTERNAL,\n            severity=RiskLevel.HIGH if cors_origin == '*' else RiskLevel.MEDIUM,\n            details=f\"CORS origin: {cors_origin}\" if cors_origin else \"No CORS headers\"\n        ))\n\n        # Security headers\n        sec_headers = traffic_sample.get('response_headers', {})\n        required_headers = {\n            'X-Content-Type-Options': 'nosniff',\n            'Strict-Transport-Security': None,\n            'X-Frame-Options': None,\n            'Cache-Control': 'no-store',\n        }\n        missing = [h for h in required_headers if h not in sec_headers]\n        controls.append(SecurityControl(\n            name=\"security_headers\",\n            present=len(missing) == 0,\n            required=True,\n            severity=RiskLevel.MEDIUM,\n            details=f\"Missing headers: {', '.join(missing)}\" if missing else \"All security headers present\"\n        ))\n\n        # Input validation (check for schema validation errors in logs)\n        has_validation = traffic_sample.get('has_schema_validation', False)\n        controls.append(SecurityControl(\n            name=\"input_validation\",\n            present=has_validation,\n            required=True,\n            severity=RiskLevel.HIGH,\n            details=\"No schema validation detected\" if not has_validation else \"Input validation active\"\n        ))\n\n        endpoint.security_controls = controls\n        return controls\n\n    def calculate_risk_score(self, endpoint: APIEndpoint) -> float:\n        \"\"\"Calculate a composite risk score (0-100) for an API endpoint.\"\"\"\n        score = 0.0\n        max_score = 0.0\n\n        # Security controls scoring\n        for control in endpoint.security_controls:\n            weight = control.severity.value * 5\n            max_score += weight\n            if not control.present and control.required:\n                score += weight\n\n        # Classification risk multiplier\n        classification_weights = {\n            APIClassification.EXTERNAL: 1.5,\n            APIClassification.PARTNER: 1.3,\n            APIClassification.SHADOW: 2.0,\n            APIClassification.DEPRECATED: 1.8,\n            APIClassification.INTERNAL: 1.0,\n        }\n        multiplier = classification_weights.get(endpoint.classification, 1.0)\n\n        # Documentation penalty\n        if not endpoint.documented:\n            score += 10\n\n        # Sensitive data penalty\n        score += len(endpoint.sensitive_data_types) * 5\n\n        # Normalize to 0-100\n        if max_score > 0:\n            normalized = min(100, (score \u002F max_score) * 100 * multiplier)\n        else:\n            normalized = 0\n\n        endpoint.risk_score = round(normalized, 1)\n        return endpoint.risk_score\n\n    def generate_posture_report(self) -> dict:\n        \"\"\"Generate organization-wide API security posture report.\"\"\"\n        total = len(self.inventory)\n        if total == 0:\n            return {\"error\": \"No APIs in inventory\"}\n\n        risk_distribution = {level.name: 0 for level in RiskLevel}\n        classification_counts = {c.value: 0 for c in APIClassification}\n        undocumented = 0\n        missing_auth = 0\n        missing_tls = 0\n\n        for endpoint in self.inventory.values():\n            self.calculate_risk_score(endpoint)\n\n            if endpoint.risk_score >= 75:\n                risk_distribution[\"CRITICAL\"] += 1\n            elif endpoint.risk_score >= 50:\n                risk_distribution[\"HIGH\"] += 1\n            elif endpoint.risk_score >= 25:\n                risk_distribution[\"MEDIUM\"] += 1\n            else:\n                risk_distribution[\"LOW\"] += 1\n\n            classification_counts[endpoint.classification.value] += 1\n\n            if not endpoint.documented:\n                undocumented += 1\n\n            for control in endpoint.security_controls:\n                if control.name == \"authentication\" and not control.present:\n                    missing_auth += 1\n                if control.name == \"transport_encryption\" and not control.present:\n                    missing_tls += 1\n\n        avg_risk = sum(e.risk_score for e in self.inventory.values()) \u002F total\n\n        return {\n            \"report_date\": datetime.now().isoformat(),\n            \"total_apis\": total,\n            \"average_risk_score\": round(avg_risk, 1),\n            \"risk_distribution\": risk_distribution,\n            \"classification\": classification_counts,\n            \"undocumented_apis\": undocumented,\n            \"missing_authentication\": missing_auth,\n            \"missing_tls\": missing_tls,\n            \"top_risks\": sorted(\n                [{\"api_id\": e.api_id, \"method\": e.method, \"path\": e.path,\n                  \"service\": e.service_name, \"risk_score\": e.risk_score,\n                  \"classification\": e.classification.value}\n                 for e in self.inventory.values()],\n                key=lambda x: x[\"risk_score\"],\n                reverse=True\n            )[:20]\n        }\n```\n\n### 2. Policy Enforcement\n\nDefine and enforce security policies across all APIs:\n\n```yaml\n# api-security-policies.yaml\npolicies:\n  - name: require-authentication\n    description: All external APIs must require authentication\n    scope:\n      classification: [external, partner]\n    rule:\n      control: authentication\n      required: true\n    severity: critical\n    remediation: \"Add OAuth2, API key, or JWT authentication\"\n\n  - name: enforce-tls\n    description: All APIs must use HTTPS\n    scope:\n      classification: [external, internal, partner]\n    rule:\n      control: transport_encryption\n      required: true\n    severity: critical\n    remediation: \"Configure TLS certificates and redirect HTTP to HTTPS\"\n\n  - name: require-rate-limiting\n    description: External APIs must implement rate limiting\n    scope:\n      classification: [external]\n    rule:\n      control: rate_limiting\n      required: true\n    severity: high\n    remediation: \"Configure rate limiting at API gateway level\"\n\n  - name: no-wildcard-cors\n    description: APIs must not use wildcard CORS origins\n    scope:\n      classification: [external]\n    rule:\n      control: cors_policy\n      condition: \"origin != '*'\"\n    severity: high\n    remediation: \"Specify explicit allowed origins in CORS configuration\"\n\n  - name: documentation-required\n    description: All APIs must have OpenAPI documentation\n    scope:\n      classification: [external, partner]\n    rule:\n      documented: true\n    severity: medium\n    remediation: \"Create and publish OpenAPI specification\"\n\n  - name: deprecation-sunset\n    description: Deprecated APIs must have sunset headers\n    scope:\n      classification: [deprecated]\n    rule:\n      header_present: \"Sunset\"\n    severity: medium\n    remediation: \"Add Sunset header with planned removal date\"\n```\n\n## Continuous Monitoring Dashboard Metrics\n\n| Metric | Description | Target |\n|--------|------------|--------|\n| API Discovery Coverage | % of APIs with documentation | > 95% |\n| Average Risk Score | Mean risk score across all APIs | \u003C 25 |\n| Critical Findings | Number of critical-risk APIs | 0 |\n| Shadow API Count | Undocumented\u002Funmanaged APIs | 0 |\n| Authentication Coverage | % of APIs with auth controls | 100% |\n| TLS Coverage | % of APIs using HTTPS | 100% |\n| Policy Compliance | % of APIs meeting all policies | > 90% |\n| Mean Time to Remediate | Average days to fix findings | \u003C 7 days |\n\n## References\n\n- OX Security ASPM Guide 2025: https:\u002F\u002Fwww.ox.security\u002Fblog\u002Fapplication-security-posture-management-aspm\u002F\n- IBM ASPM Overview: https:\u002F\u002Fwww.ibm.com\u002Fthink\u002Ftopics\u002Faspm\n- StackHawk Best ASPM Tools: https:\u002F\u002Fwww.stackhawk.com\u002Fblog\u002Fbest-aspm-tools\u002F\n- AppSentinels API Security Posture Management: https:\u002F\u002Fappsentinels.ai\u002Fblog\u002Fapi-security-posture-management-from-reactive-protection-to-continuous-governance\u002F\n- Palo Alto Networks ASPM: https:\u002F\u002Fwww.paloaltonetworks.com\u002Fcyberpedia\u002Faspm-application-security-posture-management\n",{"hide":54,"name":5,"source":55,"license":15,"description":7,"authorized_lab":50,"origin_frontmatter":56},true,"mukul975\u002FAnthropic-Cybersecurity-Skills","name: implementing-api-security-posture-management | description: Implement API Security Posture Management to continuously discover, classify, |   and score APIs based on risk while enforcing security policies across the API lifecycle. | domain: cybersecurity | subdomain: api-security | tags: | - api-security | - aspm | - api-posture-management | - api-discovery | - risk-scoring | - api-governance | - continuous-monitoring | - api-inventory | version: '1.0' | author: mahipal | license: Apache-2","main","4c6d8d65f3d6096e2fc25b0845e481dda73c2794",".claude\u002Fskills\u002Fcyber-implementing-api-security-posture-management",0,"https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions","Building deterministic AI governance and continuity systems. Workflow architect + visual storyteller","2026-11-11 16:42:59",{"source":8,"skillName":5,"commands":66,"prompt":76,"zipAvailable":54},[67,70,73],{"tool":68,"command":69},"npx","npx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-implementing-api-security-posture-management",{"tool":71,"command":72},"bunx","bunx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-implementing-api-security-posture-management",{"tool":74,"command":75},"pnpm","pnpm dlx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-implementing-api-security-posture-management","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-implementing-api-security-posture-management\u002FSKILL.md",[],[79,103,127,155,180,199],{"skillNo":80,"name":81,"nameZh":6,"description":82,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":49},"01M71CG1AME5WC0A79AE65WT0X","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","MIT","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102],"zoom out","zoom","with","harness","how","section","re","true","understand","use","perspective","when","you","code","it","context",{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":49},"01M71CFY9ATD0BAXV6B14HFG7C","yuri-shura","6-perspective adversarial review for high-stakes turns (architecture decisions, refactor planning, deployment review) — fans out architect, adversary (7-vector attack), maintainer, ops, product, and security perspectives in parallel, then consolidates. Use when user says 'review this decision', '\u002Fshura', 'adversarial review', 'what could go wrong', 'architecture review', or 'deployment review'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-shura\u002FSKILL.md",[],[110,111,90,112,113,114,115,116,117,118,119,96,120,98,121,122,123,124,125,126],"yuri shura","parallel","architecture review","planning","for","deployment","vector","strategic review","decision","strategic","ops","workflow","decisions","architecture","review","perspectives","adversarial",{"skillNo":128,"name":129,"nameZh":6,"description":130,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":131,"categories":132,"keywords":136,"publishedAt":49},"01M71CFTTYW1HA2MNX38EV1GJ5","yuri-sales-intelligence","Unified sales and outreach skill generating cold outreach openers, social selling sequences, objection rebuttals, and ad creative for any paid platform — multi-persona aware, adapting tone and offer frame to buyer type. Use when user says 'write a cold email', 'outreach sequence', 'objection handling', 'ad copy', or 'sales pitch'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-sales-intelligence\u002FSKILL.md",[133],{"categoryNo":134,"categoryName":135,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000005","邮件与沟通",[137,138,139,140,141,142,143,144,145,98,146,147,148,149,150,151,152,114,153,154],"intelligence","sales intelligence","yuri sales intelligence","sales","cold","paid","social","persona","pitch","cold email","ad creative","write","sequences","sequence","platform","email","cold outreach","frame",{"skillNo":156,"name":157,"nameZh":6,"description":158,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":159,"categories":160,"keywords":165,"publishedAt":49},"01M71CFQMBFTFADJNGP0Z2WCYK","yuri-code-intelligence","Unified code quality intelligence layer that diagnoses code smells (Long Method, Feature Envy, design pattern issues), prescribes targeted Fowler refactoring techniques, and reviews code for security, performance, and clarity. Use when user says 'review this code', 'refactor this', 'what's wrong with this method', 'code smells', or 'clean this up'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-code-intelligence\u002FSKILL.md",[161,164],{"categoryNo":162,"categoryName":163,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},[166,100,167,137,90,168,169,170,114,171,172,173,174,175,176,177,178,179,96,98],"yuri code intelligence","code intelligence","reviews","code quality","feature","performance","code review","long","up","issues","clean","techniques","improve","design",{"skillNo":181,"name":182,"nameZh":6,"description":183,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":184,"categories":185,"keywords":186,"publishedAt":49},"01M71CFP32RT6GD3GKNHCJP8VP","yuri-adw","Invoke when user asks to run the ADW loop \u002F agentic engineering loop \u002F software factory workflow.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-adw\u002FSKILL.md",[],[187,188,189,190,191,192,193,194,195,98,196,121,197,198],"yuri adw","run","engineering loop","software factory","software","agentic engineering","factory","loop","invoke","engineering","agentic","user",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":83,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":217,"publishedAt":49},"01M71CFK4VPEKY6A73237P7RSN","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[205,208,211,214],{"categoryNo":206,"categoryName":207,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":209,"categoryName":210,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":212,"categoryName":213,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":215,"categoryName":216,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000036","内容创作者",[218,219,220,98,121,221,90,222,115,96,223],"writing","writing skills","new","work","editing","Existing"]