
يقوم بمسح سير عمل CI/CD الخاصة بـ GitHub Actions بحثًا عن الثغرات الأمنية، ويفهرس النتائج في قاعدة بيانات رسومية Neo4j، ويوفر مكتبة استعلامات لاكتشاف الأخطاء التكوينية، والحقن، ومخاطر سلسلة التوريد.
RAVEN (تحليل المخاطر وتعداد الثغرات لأنظمة CI/CD) هي أداة أمان قوية مصممة لإجراء فحوصات ضخمة لسير عمل GitHub Actions CI وتحليل البيانات المكتشفة في قاعدة بيانات Neo4j. تم تطويرها وصيانتها من قبل فريق أبحاث Cycode.
باستخدام Raven، تمكنا من تحديد الثغرات الأمنية والإبلاغ عنها في بعض من أكثر المستودعات شهرة على GitHub، بما في ذلك:
لقد أدرجنا جميع الثغرات الأمنية التي تم اكتشافها باستخدام Raven في قسم قاعة الشرف الخاص بالأداة.
توفر الأداة الإمكانيات التالية لفحص وتحليل الثغرات المحتملة في CI/CD:
الاستخدامات المحتملة لـ Raven:
توفر هذه الأداة حلاً موثوقًا وقابلاً للتوسع لتحليل أمان CI/CD، مما يتيح للمستخدمين الاستعلام عن التكوينات السيئة والحصول على رؤى قيمة حول الوضع الأمني لقاعدة الأكواد الخاصة بهم.
في العام الماضي، أجرت Cycode Labs بحثًا مكثفًا حول المشكلات الأمنية الأساسية لأنظمة CI/CD. لقد فحصنا أعماق العديد من الأنظمة، وآلاف المشاريع، والعديد من التكوينات. الاستنتاج واضح – النموذج الذي يتم فيه تفويض الأمان إلى المطورين قد فشل. وقد تم إثبات ذلك عدة مرات في محتوانا السابق:
كل من الثغرات المذكورة أعلاه لها خصائص فريدة، مما يجعل من المستحيل تقريبًا على المطورين مواكبة أحدث اتجاهات الأمان. لسوء الحظ، تشترك كل ثغرة في شيء مشترك – كل استغلال يمكن أن يؤثر على ملايين الضحايا.
لهذه الأسباب تم إنشاء Raven، إطار عمل لتحليل أمان سير عمل CI/CD (وGitHub Actions كحالة استخدام أولى). في تركيزنا، فحصنا سيناريوهات معقدة حيث لا تشكل كل مشكلة تهديدًا بمفردها، ولكن عند دمجها، تشكل تهديدًا خطيرًا.
لبدء استخدام Raven، اتبع تعليمات التثبيت التالية:
الخطوة 1: قم بتثبيت حزمة Raven```bash pip3 install raven-cycode
**الخطوة 2**: إعداد خادم Redis محلي وقاعدة بيانات Neo4j```bash
docker run -d --name raven-neo4j -p7474:7474 -p7687:7687 --env NEO4J_AUTH=neo4j/123456789 --volume raven-neo4j:/data neo4j:5.12
docker run -d --name raven-redis -p6379:6379 --volume raven-redis:/data redis:7.2.1
طريقة أخرى لإعداد البيئة هي تشغيل ملف docker compose الذي قمنا بتوفيره:```bash git clone https://github.com/CycodeLabs/raven.git cd raven make setup
**الخطوة 3**: تشغيل Raven Downloader
وضع الحساب:```bash
raven download account --token $GITHUB_TOKEN --account-name RavenDemo
وضع الزحف:```bash raven download crawl --token $GITHUB_TOKEN --min-stars 1000
**الخطوة 4**: شغّل Raven Indexer```bash
raven index
الخطوة 5: افحص النتائج عبر reporter```bash raven report --format raw
في هذه المرحلة، يمكن فحص البيانات في قاعدة بيانات Neo4j من خلال الاتصال بـ http://localhost:7474/browser/.
### المتطلبات الأساسية
- Python 3.9+
- Docker Compose v2.1.0+
- Docker Engine v1.13.0+
## البنية التحتية
يستخدم Raven حاويتين أساسيتين من Docker: Redis و Neo4j.
سيقوم الأمر `make setup` بتشغيل أمر `docker compose` لتجهيز تلك البيئة.

## الاستخدام
تحتوي الأداة على ثلاث وظائف رئيسية: `download` و `index` و `report`.
### التنزيل
#### تنزيل مستودعات الحساب```bash
usage: raven download account [-h] --token TOKEN [--debug] [--redis-host REDIS_HOST] [--redis-port REDIS_PORT] [--clean-redis] (--account-name ACCOUNT_NAME | --personal)
options:
-h, --help show this help message and exit
--token TOKEN GITHUB_TOKEN to download data from Github API (Needed for effective rate-limiting)
--debug Whether to print debug statements, default: False
--redis-host REDIS_HOST
Redis host, default: localhost
--redis-port REDIS_PORT
Redis port, default: 6379
--clean-redis, -cr Whether to clean cache in the redis, default: False
--account-name ACCOUNT_NAME
Account name for downloading the workflows, can be used multiple times
--personal Download repositories owned by the authenticated user
usage: raven download crawl [-h] --token TOKEN [--debug] [--redis-host REDIS_HOST] [--redis-port REDIS_PORT] [--clean-redis] [--max-stars MAX_STARS] [--min-stars MIN_STARS]
options: -h, --help show this help message and exit --token TOKEN GITHUB_TOKEN to download data from Github API (Needed for effective rate-limiting) --debug Whether to print debug statements, default: False --redis-host REDIS_HOST Redis host, default: localhost --redis-port REDIS_PORT Redis port, default: 6379 --clean-redis, -cr Whether to clean cache in the redis, default: False --max-stars MAX_STARS Maximum number of stars for a repository --min-stars MIN_STARS Minimum number of stars for a repository, default: 1000
### فهرس```bash
usage: raven index [-h] [--redis-host REDIS_HOST] [--redis-port REDIS_PORT] [--clean-redis] [--neo4j-uri NEO4J_URI] [--neo4j-user NEO4J_USER] [--neo4j-pass NEO4J_PASS]
[--clean-neo4j] [--debug]
options:
-h, --help show this help message and exit
--redis-host REDIS_HOST
Redis host, default: localhost
--redis-port REDIS_PORT
Redis port, default: 6379
--clean-redis, -cr Whether to clean cache in the redis, default: False
--neo4j-uri NEO4J_URI
Neo4j URI endpoint, default: neo4j://localhost:7687
--neo4j-user NEO4J_USER
Neo4j username, default: neo4j
--neo4j-pass NEO4J_PASS
Neo4j password, default: 123456789
--clean-neo4j, -cn Whether to clean cache, and index from scratch, default: False
--debug Whether to print debug statements, default: False
usage: raven report [-h] [--redis-host REDIS_HOST] [--redis-port REDIS_PORT] [--clean-redis] [--neo4j-uri NEO4J_URI] [--neo4j-user NEO4J_USER] [--neo4j-pass NEO4J_PASS] [--clean-neo4j] [--tag {injection,unauthenticated,fixed,priv-esc,supply-chain,best-practice,endoflife,reconnaissance}] [--severity {info,low,medium,high,critical}] [--query_ids RQ-1,..,RQ-16] [--queries-path QUERIES_PATH] [--format {raw,json}] {slack} ...
positional arguments: {slack} slack Send report to slack channel
options: -h, --help show this help message and exit --redis-host REDIS_HOST Redis host, default: localhost --redis-port REDIS_PORT Redis port, default: 6379 --clean-redis, -cr Whether to clean cache in the redis, default: False --neo4j-uri NEO4J_URI Neo4j URI endpoint, default: neo4j://localhost:7687 --neo4j-user NEO4J_USER Neo4j username, default: neo4j --neo4j-pass NEO4J_PASS Neo4j password, default: 123456789 --clean-neo4j, -cn Whether to clean cache, and index from scratch, default: False --tag {injection,unauthenticated,fixed,priv-esc,supply-chain,best-practice,endoflife,reconnaissance}, -t {injection,unauthenticated,fixed,priv-esc,supply-chain,best-practice,endoflife,reconnaissance} Filter queries with specific tag --severity {info,low,medium,high,critical}, -s {info,low,medium,high,critical} Filter queries by severity level (default: info) --query_ids RQ-1,..,RQ-16, -id RQ-1,..,RQ-16 Filter queries by query ids (example: RQ-2,RQ-8) --queries-path QUERIES_PATH, -dp QUERIES_PATH Queries folder (default: library) --format {raw,json}, -f {raw,json} Report format (default: raw)
## أمثلة
استرجاع جميع سير العمل والإجراءات المرتبطة بأي حساب (مستخدم/مؤسسة).```bash
raven download account --token $GITHUB_TOKEN --account-name microsoft --account-name google --debug
جمع جميع مستودعات GitHub المتاحة للعامة.```bash raven download crawl --token $GITHUB_TOKEN --min-stars 100 --max-stars 1000 --debug
بعد الانتهاء من عملية التحميل أو إذا تمت المقاطعة باستخدام Ctrl+C، تابع فهرسة جميع سير العمل والإجراءات في قاعدة بيانات Neo4j.```bash
raven index --debug
الآن، يمكننا إنشاء تقرير باستخدام مكتبة الاستعلامات الخاصة بنا.```bash raven report --severity high --tag injection --tag unauthenticated
## تحديد المعدل
لتحديد المعدل بشكل فعال، يجب عليك توفير رمز Github.
للمستخدمين المصادق عليهم، ينطبق تحديد المعدل التالي:
- بحث الكود - 30 استعلام في الدقيقة
- أي واجهة برمجة تطبيقات أخرى - 5000 في الساعة
## قاعدة المعرفة البحثية
- [حقن المشكلات](https://github.com/CycodeLabs/raven/blob/main/docs/Issue%20Injections/README.md)
- [حقن طلبات السحب](https://github.com/CycodeLabs/raven/blob/main/docs/Pull%20Request%20Injections/README.md)
- [حقن تشغيل سير العمل](https://github.com/CycodeLabs/raven/blob/main/docs/Multi%20Prerequisite%20Exploits/README.md)
- [حقن CodeSee](https://github.com/CycodeLabs/raven/blob/main/docs/Codesee%20Injections/README.md)
## القيود الحالية
- من الممكن تشغيل إجراء خارجي عن طريق الإشارة إلى مجلد يحتوي على `Dockerfile` (بدون `action.yml`). حاليًا، هذا السلوك غير مدعوم.
- من الممكن تشغيل إجراء خارجي عن طريق الإشارة إلى حاوية docker عبر عنوان URL `docker://...`. حاليًا، هذا السلوك غير مدعوم.
- من الممكن تشغيل إجراء عن طريق الإشارة إليه محليًا. يؤدي ذلك إلى سلوك معقد، حيث قد يأتي من مستودع مختلف تم سحبه مسبقًا. السلوك الحالي يحاول العثور عليه في المستودع الموجود.
- نحن لا نقوم بنمذجة هيكل سير العمل بأكمله. إذا كانت هناك حاجة إلى حقول إضافية، يرجى تقديم طلب سحب وفقًا لإرشادات [المساهمة](https://github.com/CycodeLabs/raven/blob/main/CONTRIBUTING.md).
## العمل البحثي المستقبلي
- تنفيذ تحليل التلوث. حالة استخدام مثال - يمكن للمستخدم تمرير عنوان طلب سحب (وهو معلمة قابلة للتحكم) إلى معلمة إجراء تسمى `data`. قد يتم استخدام معلمة الإجراء هذه في أمر تشغيل: `- run: echo ${{ inputs.data }}`، مما ينشئ مسارًا لتنفيذ الكود.
- توسيع نطاق البحث عن نتائج سوء الاستخدام الضار لـ `GITHUB_ENV`. قد يستخدم هذا أيضًا تحليل التلوث السابق.
- البحث عما إذا كان `actions/github-script` لديه مشهد تهديد مثير للاهتمام. إذا كان الأمر كذلك، فيمكن نمذجته في الرسم البياني.
## الترخيص
[Apache License 2.0](https://github.com/CycodeLabs/raven/blob/main/LICENSE.md)
## قاعة الشهرة - الثغرات الأمنية التي تم اكتشافها والإفصاح عنها باستخدام Raven
| الاسم | النجوم | الإصلاح | مصادر إضافية |
| ------ | -------- | ---- | -------------------- |
| [freeCodeCamp/freeCodeCamp](https://github.com/freeCodeCamp/freeCodeCamp) |  | CodeSee package update, [0871341](https://github.com/freeCodeCamp/freeCodeCamp/commit/0871341c9cbf96ab455bc3e0bce636e2ef2a2be2) | [مدونة](https://cycode.com/blog/cycode-secures-thousands-of-open-source-projects/) |
| [Significant-Gravitas/AutoGPT](https://github.com/Significant-Gravitas/AutoGPT) |  | [cdae7f8](https://github.com/Significant-Gravitas/AutoGPT/pull/6313/commits/cdae7f84ce0b2879fdcc1fa04956cdaa42a07bfb) | | [storybookjs/storybook](https://github.com/storybookjs/storybook) |  | [ffb8558](https://github.com/storybookjs/storybook/commit/ffb8558b7e5df4644299e5ec7009ade6ca1a721c) | [مدونة](https://cycode.com/ci-story-how-we-found-critical-vulnerabilities-in-storybook-project/) |
| [tiangolo/fastapi](https://github.com/tiangolo/fastapi) |  | [9efab1b](https://github.com/tiangolo/fastapi/commit/9efab1bd96ef061edf1753626573a0a2be1eef09) | [لينكد إن](https://www.linkedin.com/feed/update/urn:li:activity:7011753940283203584/) |
| [withastro/astro](https://github.com/withastro/astro) |  | [650fb1a](https://github.com/withastro/astro/commit/650fb1aa51a1c843c10bc89a11732b45a6345b00) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [statelyai/xstate](https://github.com/statelyai/xstate) |  | CodeSee package update | [مدونة](https://cycode.com/blog/cycode-secures-thousands-of-open-source-projects/) |
| [bazelbuild/bazel](https://github.com/bazelbuild/bazel) |  | [3561f07](https://github.com/bazelbuild/continuous-integration/commit/3561f079e0414d31ebba923815695e1e714937cb) | [مدونة](https://cycode.com/blog/cycode-discovers-a-supply-chain-vulnerability-in-bazel/) |
| [docker-slim/docker-slim](https://github.com/docker-slim/docker-slim) |  | CodeSee package update | [مدونة](https://cycode.com/blog/cycode-secures-thousands-of-open-source-projects/) |
| [microsoft/fluentui](https://github.com/microsoft/fluentui) |  | [2ea6195](https://github.com/microsoft/fluentui/commit/2ea6195152131766641311ee5604e746b578d8e7) | [مدونة](https://cycode.com/blog/analyzing-the-vulnerability-that-could-have-compromised-microsoft-365-users/) |
| [tiangolo/sqlmodel](https://github.com/tiangolo/sqlmodel) |  | [cf36b2d](https://github.com/tiangolo/sqlmodel/commit/cf36b2d9baccf527bc61071850f102e2cd8bf6bf) | [لينكد إن](https://www.linkedin.com/feed/update/urn:li:activity:7011753940283203584/) |
| [tiangolo/typer](https://github.com/tiangolo/typer) |  | [0c106a1](https://github.com/tiangolo/typer/commit/0c106a169e5e3c7df6f98e32a6d8405c985b695a) | [لينكد إن](https://www.linkedin.com/feed/update/urn:li:activity:7011753940283203584/) |
| [juspay/hyperswitch](https://github.com/juspay/hyperswitch) |  | [a052f9a](https://github.com/juspay/hyperswitch/pull/2797/commits/a052f9a9c921ec0ff8c526097841be5777faf835) | |
| [autogluon/autogluon](https://github.com/autogluon/autogluon) |  | [ca18fa9](https://github.com/autogluon/autogluon/commit/ca18fa9fa2071f670125fd19700cf3570a6b5119) | |
| [apache/camel](https://github.com/apache/camel) |  | [02e512a](https://github.com/apache/camel/pull/11879/commits/02e512ae1ab0a471e80d86096ea79b45789aa105) | | [liquibase/liquibase](https://github.com/liquibase/liquibase) |  | [3278525](https://github.com/liquibase/liquibase/commit/3278525eaf974daea20808926f9a6816aecd01a7) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [ossf/scorecard](https://github.com/ossf/scorecard) |  | [c9f582b](https://github.com/ossf/scorecard/commit/c9f582b620a57a1a476f4e3add505ff50c51a774) | |
| [Ombi-app/Ombi](https://github.com/Ombi-app/Ombi) |  | [5cc0d77](https://github.com/Ombi-app/Ombi/commit/5cc0d7727d72fe1fee8a3f6c3874d44a5b785de4) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [wireapp/wire-ios](https://github.com/wireapp/wire-ios) |  | [9d39d6c](https://github.com/wireapp/wire-ios/commit/9d39d6c93b5a58a0bc8c1aba10e0d67756359630) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [cloudscape-design/components](https://github.com/cloudscape-design/components) |  | [2921d2d](https://github.com/cloudscape-design/.github/commit/2921d2d1420fef5b849d5aecbcfb9138ac6b9dcc) | |
| [DynamoDS/Dynamo](https://github.com/DynamoDS/Dynamo) |  | سير العمل معطل | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [fauna/faunadb-js](https://github.com/fauna/faunadb-js) |  | [ee6f53f](https://github.com/fauna/faunadb-js/commit/ee6f53f9c985bde41976743530e3846dee058587) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
| [apache/incubator-kie-kogito-runtimes](https://github.com/apache/incubator-kie-kogito-runtimes) |  | [53c18e5](https://github.com/apache/incubator-kie-kogito-runtimes/commit/53c18e5372e5306e0aa580f201f820b80359ad11) | [مدونة](https://cycode.com/github-actions-vulnerabilities/) |
## هل تريد المزيد من أمان CI/CD وأمان التطبيقات وASPM؟ تحقق من Cycode
إذا أعجبك Raven، فمن المحتمل أن تحب منصتنا [Cycode](https://cycode.com/?utm_source=github_website&utm_medium=referral&utm_campaign=raven_page) التي تقدم قدرات محسّنة للرؤية وتحديد الأولويات ومعالجة الثغرات الأمنية عبر تسليم البرمجيات.
إذا كنت مهتمًا بحل قوي لأمان خط الأنابيب أو أمان التطبيقات أو ASPM مدعوم بالأبحاث، فلا تتردد في الاتصال بنا أو طلب عرض توضيحي باستخدام النموذج [https://cycode.com/book-a-demo/](https://cycode.com/book-a-demo/?utm_source=github_website&utm_medium=referral&utm_campaign=raven_page).