شعار Api Key Least Privilege Audit Tool

Api Key Least Privilege Audit Tool

المجتمع
HimanshuJ16
api-key-least-privilege-audit-tool

استخدم هذه المهارة قبل نشر بوت للتداول الفعلي، لتدقيق مفاتيح API الحالية لدى الوسيط والتحقق من عدم امتلاكها نطاقات صلاحيات لا تحتاج إليها. ترصد صلاحيات السحب والتحويل والإدارة التي قد تحوّل مفتاح تنفيذ مسرّبًا إلى وسيلة للسرقة.

Add to TypingMind

نظرة عامة

الناشرHimanshuJ16
المستودعAlgo-Trading-Skills
اسم المهارةapi-key-least-privilege-audit-tool
النجوم
50
التفريعات
7
الملفات المرفقة
5
الترخيصApache-2.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 5

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها HimanshuJ16 على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Api Key Least Privilege Audit Tool في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/api-key-least-privilege-audit-tool
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HimanshuJ16/Algo-Trading-Skills.git /tmp/Algo-Trading-Skills
mkdir -p .claude/skills
cp -r /tmp/Algo-Trading-Skills/skills/api-key-least-privilege-audit-tool .claude/skills/api-key-least-privilege-audit-tool
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Api Key Least Privilege Audit Tool في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Api Key Least Privilege Audit Tool تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Api Key Least Privilege Audit Tool بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

When to Use

Invoke this skill prior to deploying any live trading bot or data pipeline to verify that API credentials strictly adhere to the principle of least privilege. Granting unnecessary permissions (such as account withdrawal, funds transfer, or administrative management) to an execution or data-ingestion bot creates catastrophic security vulnerabilities. If a key is leaked or compromised, excess privileges enable external theft.

When NOT to Use

  • Brokers without granular permission scopes: If the broker exposes only a single all-or-nothing API key with no scope metadata to audit, this tool cannot perform meaningful analysis. Use network-level isolation (IP allowlisting, VPN) instead.
  • Pre-deployment key creation: This skill audits existing keys, it does not create or modify broker API key scopes. Use broker-specific key creation tooling.
  • Secrets storage or rotation: This skill does not handle credential storage, encryption, or rotation. See secrets-rotation-without-bot-downtime and crypto-wallet-key-custody-security.
  • OAuth or session-based auth: The auditor checks static API key scopes, not OAuth token scopes or session permissions. OAuth flows require their own scope validation.
  • As an enforcement control: This is a client-side gate. It cannot revoke, downgrade or constrain a key, and an attacker holding a withdrawal-capable key calls the broker directly without ever running it. It catches misconfiguration before deployment; the broker's own scope selection and IP restriction are what actually constrain the key.

Prerequisites

  • Broker API key metadata or active permissions response, from either the venue's key-permission endpoint (probed) or an operator-maintained record of how the key was configured (declared). Not every venue offers the former — see references/standards.md for which do.
  • Target bot role definition (MARKET_DATA_ONLY, EXECUTION_BOT, PORTFOLIO_MONITOR, or ADMIN_SUPERVISOR).
  • A mapping from the venue's native scope names onto the canonical scope names used by the policy matrix.

Workflow

  1. Define Role Security Policy:

    • Establish required, allowed and forbidden permissions per bot role (e.g. EXECUTION_BOT requires ["read_market_data", "place_orders", "cancel_orders"] and forbids ["withdraw_funds", "account_admin", "transfer"]).
    • The check is deny-by-default: any scope absent from the role's allowed set is a violation even when it is not explicitly forbidden. This is what makes an unmapped broker-native scope name fail closed.
    • ADMIN_SUPERVISOR is the only role permitted administrative scopes (account_admin, api_key_manage), and still forbids withdrawal/transfer permissions.
  2. Establish the Granted Scope Set — and read the key's permissions, not the account's:

    • Binance Spot: GET /sapi/v1/account/apiRestrictions (returns enableWithdrawals, enableInternalTransfer, permitsUniversalTransfer, ipRestrict, …).
    • Coinbase Advanced Trade: GET /api/v3/brokerage/key_permissions (returns can_view, can_trade, can_transfer).
    • Kraken and Zerodha Kite document no endpoint returning the calling key's own permissions. Take the scope set from an operator-maintained record instead, and mark the audit as declared — it proves the record is compliant, not that the live key is.
    • Map native scope names onto the canonical names before auditing. Both venues above return boolean flags, not a scope list — pass only the flags whose value is true. Handing the raw response (or its keys) to the auditor audits the field names, so a key with enableWithdrawals: false is flagged as holding withdrawal rights.
  3. Audit Excess Privileges:

    • Compare granted key scopes against the role policy.
    • All comparisons are case-insensitive; blank entries are discarded.
    • A wildcard * permission is always flagged as a critical violation regardless of role — unrestricted access must never be granted to an automated bot.
    • Malformed input is rejected, not audited: a bare string is iterable, and auditing "read_market_data" character by character would yield a confident report about scopes that do not exist.
  4. Branch on Severity, Not on Warning Text:

    • CRITICAL_VIOLATION (report.has_critical_violation) — the key holds scopes it must not have. Block deployment and revoke the key; it is dangerous whether or not it ships.
    • INSUFFICIENT_PERMISSIONS — the key lacks scopes the role needs. Block deployment and re-issue. Not a revocation event.
    • COMPLIANT — scope policy satisfied. Verify IP binding separately before treating this as a clean bill of health.

Full procedure: see references/workflows.md. Standards reference: see references/standards.md. Printable pre-flight checklist: see assets/checklist.md.

Common Pitfalls

  • Auditing the account instead of the key: Binance GET /api/v3/account returns canTrade / canWithdraw / canDeposit, which describe the account, not the API key's granted scopes — Binance does not document them as key-permission flags. Coinbase GET /api/v3/brokerage/accounts likewise lists accounts, not permissions. Auditing either reads a payload that cannot contain a violation, so every key passes.
  • Treating an empty scope set as a safe key: a failed or partially-authenticated probe returns nothing, and an empty set contains no forbidden scope. A gate that inspects only excess_violations sees an empty list and deploys. The auditor never reports an empty set as compliant and says so explicitly in the warning.
  • Wildcard Permission Defaults: Using default broker "Full Access" or * permission settings during key creation. The auditor always flags * as a critical violation.
  • Ignoring IP Whitelisting: Treating scope reduction as sufficient while failing to bind keys to specific static IP addresses. Binance makes IPv4 access restriction mandatory to enable withdrawal permission — but that coupling is venue product policy, not a general rule, so verify IP binding on every venue independently.
  • Unmonitored Sub-Account Keys: Overlooking API keys created on master accounts that inherit master withdrawal rights.
  • Case-Sensitive Scope Mismatch: Broker APIs may return scopes in varying case (e.g., Read_Market_Data vs read_market_data). The auditor normalizes all scopes to lowercase before comparison.
  • Admin Keys with Withdrawal Rights: Even ADMIN_SUPERVISOR roles must not possess withdrawal or transfer permissions — admin access is for oversight, not capital movement.
  • String-matching the warning message: security_warning is human-readable prose and its wording changes. Gate on report.severity / report.has_critical_violation.

Verification

  • Submit over-privileged key metadata (possessing withdraw_funds on an execution bot) and verify security violation detection with severity == "CRITICAL_VIOLATION".
  • Submit a key with wildcard * permission and verify it is flagged as a critical violation for every role.
  • Verify a properly scoped execution key passes with severity == "COMPLIANT".
  • Verify an under-privileged key reports INSUFFICIENT_PERMISSIONS and not a critical violation.
  • Verify an empty scope set is non-compliant and its warning names the failed-probe possibility.
  • Verify an unmapped broker-native scope (enableWithdrawals, can_transfer) is flagged rather than ignored.
  • Verify case-insensitive matching (Read_Market_Data is accepted for read_market_data).
  • Verify a bare string or None passed as granted_permissions raises TypeError.
  • Verify report list ordering is identical across PYTHONHASHSEED values.
  • Run python -m unittest discover -s skills/api-key-least-privilege-audit-tool/scripts and confirm 100% pass rate.

Related Skills

  • crypto-wallet-key-custody-security
  • secrets-rotation-without-bot-downtime
  • token-lifecycle-live-probing
  • sandbox-credential-leakage-prevention
  • exchange-withdrawal-whitelist-enforcement

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي Api Key Least Privilege Audit Tool؟

استخدم هذه المهارة قبل نشر بوت للتداول الفعلي، لتدقيق مفاتيح API الحالية لدى الوسيط والتحقق من عدم امتلاكها نطاقات صلاحيات لا تحتاج إليها. ترصد صلاحيات السحب والتحويل والإدارة التي قد تحوّل مفتاح تنفيذ مسرّبًا إلى وسيلة للسرقة.

لماذا تستخدم Api Key Least Privilege Audit Tool على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Api Key Least Privilege Audit Tool عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Api Key Least Privilege Audit Tool في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/HimanshuJ16/Algo-Trading-Skills/tree/main/skills/api-key-least-privilege-audit-tool. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Api Key Least Privilege Audit Tool؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Api Key Least Privilege Audit Tool؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Api Key Least Privilege Audit Tool معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Api Key Least Privilege Audit Tool مجانية؟

نعم. نشرها HimanshuJ16 على GitHub بموجب ترخيص Apache-2.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇