本文へスキップ
Skillpedia
分析とスプレッドシート35k · #8273

performing-oauth-scope-minimization-review

できること

このツールは、サードパーティのアプリケーションがあなたのデータにアクセスするために与えられた権限を確認します。アプリが必要以上のアクセス権を持っていないか、使われていない権限が残っていないか、リスクの高い同意の仕方がないかをチェックします。

使う場面

  • ✓年に1回アプリの権限を見直すとき。
  • ✓アクセストークンに関するセキュリティインシデントの後。
  • ✓GDPRなどのコンプライアンス監査のとき。

スキルのリンク

https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-oauth-scope-minimization-review/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/mukul975/Anthropic-Cybersecurity-Skills/blob/main/skills/performing-oauth-scope-minimization-review/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“サードパーティ製アプリケーションのすべてのアクセス権限を確認してください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

このツールは、付与されたすべてのアプリケーション権限に関する情報を収集します。その後、リスクに基づいて分類し、過剰または不要なアクセス権を特定して削除しやすくします。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

Performing OAuth Scope Minimization Review

When to Use

  • Annual or quarterly review of third-party application OAuth permissions
  • After a security incident involving compromised OAuth tokens or unauthorized data access
  • Compliance audit requiring documentation of third-party data access (GDPR Article 28, SOC 2)
  • Discovery of shadow IT applications accessing organizational data via OAuth grants
  • Migration or consolidation of SaaS applications requiring permission cleanup
  • Implementing least-privilege principle for API integrations

Do not use for reviewing first-party application permissions within the same trust boundary; OAuth scope minimization focuses on third-party and cross-boundary consent grants.

Prerequisites

  • Admin access to identity providers (Microsoft Entra ID, Okta, Google Workspace)
  • Microsoft Graph API permissions: Application.Read.All, OAuth2PermissionGrant.ReadWrite.All
  • Inventory of approved third-party integrations from procurement or IT governance
  • OAuth scope risk classification framework
  • Tools for token analysis (jwt.io for manual review, automated scripts for bulk analysis)

Workflow

Step 1: Inventory All OAuth Grants and Consent Permissions

Enumerate all OAuth application registrations and delegated permissions:

"""
OAuth Grant Inventory - Microsoft Entra ID
Enumerates all application registrations, service principals,
and delegated/application permission grants.
"""
import requests
import json
from collections import defaultdict

class EntraOAuthAuditor:
    def __init__(self, tenant_id, client_id, client_secret):
        self.tenant_id = tenant_id
        self.base_url = "https://graph.microsoft.com/v1.0"
        self.token = self._get_token(client_id, client_secret)
        self.headers = {"Authorization": f"Bearer {self.token}"}

    def _get_token(self, client_id, client_secret):
        url = f"https://login.microsoftonline.com/{self.tenant_id}/oauth2/v2.0/token"
        response = requests.post(url, data={
            "grant_type": "client_credentials",
            "client_id": client_id,
            "client_secret": client_secret,
            "scope": "https://graph.microsoft.com/.default"
        })
        return response.json()["access_token"]

    def get_all_service_principals(self):
        """Get all service principals (enterprise applications)."""
        apps = []
        url = f"{self.base_url}/servicePrincipals?$top=999&$select=id,appId,displayName,appOwnerOrganizationId,servicePrincipalType,accountEnabled,createdDateTime"

        while url:
            response = requests.get(url, headers=self.headers)
            data = response.json()
            apps.extend(data.get("value", []))
            url = data.get("@odata.nextLink")

        return apps

    def get_oauth2_permission_grants(self):
        """Get all delegated permission grants (user consent)."""
        grants = []
        url = f"{self.base_url}/oauth2PermissionGrants?$top=999"

        while url:
            response = requests.get(url, headers=self.headers)
            data = response.json()
            grants.extend(data.get("value", []))
            url = data.get("@odata.nextLink")

        return grants

    def get_app_role_assignments(self, sp_id):
        """Get application permission assignments for a service principal."""
        url = f"{self.base_url}/servicePrincipals/{sp_id}/appRoleAssignments"
        response = requests.get(url, headers=self.headers)
        return response.json().get("value", [])

    def build_permission_inventory(self):
        """Build comprehensive OAuth permission inventory."""
        service_principals = self.get_all_service_principals()
        delegated_grants = self.get_oauth2_permission_grants()

        # Map service principal IDs to names
        sp_map = {sp["id"]: sp for sp in service_principals}

        inventory = []

        # Process delegated permissions
        for grant in delegated_grants:
            sp = sp_map.get(grant["clientId"], {})
            scopes = grant.get("scope", "").split()

            for scope in scopes:
                if not scope:
                    continue
                inventory.append({
                    "app_name": sp.get("displayName", "Unknown"),
                    "app_id": grant.get("clientId"),
                    "publisher_tenant": sp.get("appOwnerOrganizationId"),
                    "is_third_party": sp.get("appOwnerOrganizationId") != self.tenant_id,

…
よくある質問

OAuthの「スコープ」(権限)とは何ですか?

スコープは、アプリケーションがあなたに代わって何をできるか、どのデータにアクセスできるかを定める「鍵」のようなものです(例:メールの読み取り、連絡先へのアクセスなど)。

なぜこれらの権限を見直すことが重要なのですか?

見直すことで、必要なアプリだけがデータにアクセスできるようにし、過剰な権限によるセキュリティリスクを防げるからです。

このツールは権限を自動で削除しますか?

いいえ。ツールはリスクや過剰な権限を特定するだけです。権限の削除や変更は、通常管理者が手動で行う必要があります。

詳細

作者による元の説明

Performs OAuth 2.0 scope minimization review to identify over-permissioned third-party application integrations, excessive API scopes, unused token grants, and risky OAuth consent patterns across identity providers and SaaS platforms. Activates for requests involving OAuth scope audit, API permission review, third-party app risk assessment, or consent grant minimization. '

repo: mukul975/Anthropic-Cybersecurity-Skills

人気

GitHubのスター
35k
ランキング
#8273
ライセンス
Apache-2.0
更新日
2026/8/31

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル