نظرة عامة
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
ما هي واجهات برمجة التطبيقات الخاصة بميزة "التصفّح الآمن"؟
تتوفّر واجهات برمجة التطبيقات التالية من ميزة "التصفّح الآمن" للاستخدام غير التجاري فقط. إذا كنت بحاجة إلى استخدام واجهات برمجة التطبيقات لرصد عناوين URL ضارة لأغراض تجارية، أي "لأغراض البيع أو تحقيق الأرباح"، يُرجى الرجوع إلى Web Risk API.
تتيح واجهات Safe Browsing API (الإصدار 4) لتطبيقات العميل التحقّق من عناوين URL من خلال مقارنتها بقوائم تُحدِّثها Google باستمرار وتضم موارد الويب غير الآمنة. ومن أمثلة موارد الويب غير الآمنة مواقع الهندسة الاجتماعية (مواقع التصيّد الاحتيالي والمواقع الخادعة) والمواقع التي تستضيف برامج ضارة أو غير مرغوب فيها.
يُعدّ أي عنوان URL مُدرَج في قائمة "التصفّح الآمن" غير آمن.
لتحديد ما إذا كان عنوان URL مدرَجًا في أي من قوائم "التصفّح الآمن"، يمكن للعملاء استخدام واجهة برمجة التطبيقات Lookup API (الإصدار 4) أو واجهة برمجة التطبيقات Update API (الإصدار 4).
Lookup API (الإصدار 4)
تتيح واجهة Lookup API لتطبيقات العميل إرسال عناوين URL إلى خادم "التصفّح الآمن" من Google للتحقّق من حالتها. تتسم واجهة برمجة التطبيقات بالبساطة وسهولة الاستخدام، إذ تتجنّب تعقيدات واجهة برمجة التطبيقات Update API.
المزايا:
- عمليات التحقّق البسيطة من عناوين URL: يمكنك إرسال طلب HTTP
POST
مع عناوين URL الفعلية، وسيردّ الخادم بحالة عناوين URL (آمنة أو غير آمنة).
العيوب:
- الخصوصية: لا يتم تشفير عناوين URL، لذا يعرف الخادم عناوين URL التي تبحث عنها.
- وقت الاستجابة: يعالج الخادم كل طلب بحث. ولا نقدّم أي ضمانات بشأن وقت الاستجابة لعمليات البحث.
إذا لم تكن مهتمًا كثيرًا بخصوصية عناوين URL التي يتم البحث عنها، وكان بإمكانك تحمّل التأخير الناتج عن طلب الشبكة، ننصحك باستخدام Lookup API لأنّها سهلة الاستخدام.
Update API (الإصدار 4)
تتيح واجهة برمجة التطبيقات Update API لتطبيقات العميل تنزيل إصدارات مشفّرة من قوائم "التصفّح الآمن" لإجراء عمليات تحقّق محلية من عناوين URL على جهاز العميل. تم تصميم واجهة برمجة التطبيقات Update API للعملاء الذين يحتاجون إلى نتائج متكررة وبزمن استجابة منخفض. تستخدم العديد من متصفّحات الويب ومنصّات البرامج واجهة برمجة التطبيقات هذه لحماية مجموعات كبيرة من المستخدمين.
المزايا:
- الخصوصية: يتم تبادل البيانات مع الخادم بشكل غير متكرّر (فقط بعد تطابق بادئة التجزئة المحلية)، وباستخدام عناوين URL مجزّأة، وبالتالي لا يعرف الخادم مطلقًا عناوين URL الفعلية التي طلبتها الأجهزة.
- وقت الاستجابة: يمكنك الاحتفاظ بقاعدة بيانات محلية تحتوي على نُسخ من قوائم "التصفّح الآمن"، وبالتالي لن تحتاج إلى إرسال طلب إلى الخادم في كل مرة تريد فيها التحقّق من عنوان URL.
العيوب:
- التنفيذ: عليك إعداد قاعدة بيانات محلية ثم تنزيل النُسخ المحلية من قوائم "التصفّح الآمن" وتعديلها بشكل دوري (يتم تخزينها كمجاميع اختبارية SHA256 متغيرة الطول).
- عمليات التحقّق المعقّدة من عناوين URL: يجب أن تعرف كيفية تحويل عناوين URL إلى عناوين أساسية، وإنشاء تعبيرات لاحقة/سابقة، واحتساب قيم التجزئة SHA256 (للمقارنة مع النُسخ المحلية من قوائم "التصفّح الآمن" بالإضافة إلى قوائم "التصفّح الآمن" المخزّنة على الخادم).
إذا كنت قلقًا بشأن خصوصية عناوين URL التي يتم البحث عنها أو بشأن وقت الاستجابة الناتج عن طلب الشبكة، استخدِم Update API.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-25 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThe Safe Browsing APIs (v4) enable client applications to check URLs against Google's lists of unsafe web resources, including phishing sites and those hosting malware.\u003c/p\u003e\n"],["\u003cp\u003eTwo APIs are available: Lookup API (v4) for simple URL checks and Update API (v4) for local, privacy-focused checks.\u003c/p\u003e\n"],["\u003cp\u003eLookup API (v4) offers ease of use but has privacy and response time limitations.\u003c/p\u003e\n"],["\u003cp\u003eUpdate API (v4) prioritizes privacy and speed but requires more complex implementation and URL handling.\u003c/p\u003e\n"],["\u003cp\u003eThese APIs are for non-commercial use only; commercial users should refer to the Web Risk API.\u003c/p\u003e\n"]]],["Safe Browsing APIs allow client applications to check URLs against Google's unsafe web resource lists, distinguishing between non-commercial and commercial use (Web Risk API). The Lookup API checks URL status via server requests, offering simplicity but compromising privacy and response time. The Update API downloads encrypted lists for local checks, prioritizing privacy and speed but requiring complex implementation, database setup, and hash management. Users can choose between these based on privacy needs and latency tolerance.\n"],null,["# Overview\n\nWhat are the Safe Browsing APIs?\n--------------------------------\n\nThe following Safe Browsing APIs are for non-commercial use only. If you need to use APIs\nto detect malicious URLs for commercial purposes -- meaning \"for sale or revenue-generating\npurposes\" -- please refer to the [Web Risk API](https://cloud.google.com/web-risk).\n\nThe Safe Browsing APIs (v4) let your client applications check URLs against Google's\nconstantly updated lists of unsafe web resources. Examples of unsafe web resources are social\nengineering sites (phishing and deceptive sites) and sites that host malware or unwanted software.\nAny URL found on a Safe Browsing list is considered unsafe.\n\nTo determine if a URL is on any of the Safe Browsing lists, clients can use either\nthe [Lookup API (v4)](/safe-browsing/v4/lookup-api)\nor the [Update API (v4)](/safe-browsing/v4/update-api).\n\nLookup API (v4)\n---------------\n\nThe Lookup API lets your client applications send URLs to the Google Safe Browsing server to\ncheck their status. The API is simple and easy to use, as it avoids the complexities of the\nUpdate API.\n\nAdvantages:\n\n- Simple URL checks: You send an HTTP `POST` request with the actual URLs, and the server responds with the state of the URLs (safe or unsafe).\n\nDrawbacks:\n\n- Privacy: URLs are not hashed, so the server knows which URLs you look up.\n- Response time: Every lookup request is processed by the server. We don't provide guarantees on lookup response time.\n\nIf you are not too concerned about the privacy of the queried URLs, and you can tolerate the\nlatency induced by a network request, consider using the Lookup API since it's fairly easy to\nuse.\n\nUpdate API (v4)\n---------------\n\nThe Update API lets your client applications download encrypted versions of the Safe Browsing\nlists for local, client-side checks of URLs. The Update API is designed for clients that require\nhigh frequency, low-latency verdicts. Several web browsers and software platforms use this\nAPI to protect large sets of users.\n\nAdvantages:\n\n- Privacy: You exchange data with the server infrequently (only after a local hash prefix match) and using hashed URLs, so the server never knows the actual URLs queried by the clients.\n- Response time: You maintain a local database that contains copies of the Safe Browsing lists; they do not need to query the server every time they want to check a URL.\n\nDrawbacks:\n\n- Implementation: You need to set up a local database and then download, and periodically update, the local copies of the Safe Browsing lists (stored as variable-length SHA256 hashes).\n- Complex URL checks: You need to know how to canonicalize URLs, create suffix/prefix expressions, and compute SHA256 hashes (for comparison with the local copies of the Safe Browsing lists as well as the Safe Browsing lists stored on the server).\n\nIf you are concerned about the privacy of the queried URLs or the latency induced by a\nnetwork request, use the Update API."]]