সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
Firebase Security Rules
plat_iosplat_androidplat_webplat_flutterplat_node
Cloud Firestore , Firebase Realtime Database এবং Cloud Storage আপনার ডেটা সুরক্ষিত করতে আমাদের নমনীয়, এক্সটেনসিবল ফায়ারবেস সুরক্ষা নিয়মগুলি ব্যবহার করুন৷
Firebase Security Rules আপনার ডেটা এবং ক্ষতিকারক ব্যবহারকারীদের মধ্যে অবস্থান করে। আপনি সহজ বা জটিল নিয়ম লিখতে পারেন যা আপনার অ্যাপের ডেটাকে আপনার নির্দিষ্ট অ্যাপের প্রয়োজনীয় গ্রানুলারিটির স্তরে রক্ষা করে।
আপনার ব্যবহারকারীরা Realtime Database , Cloud Firestore এবং Cloud Storage জন্য কোন ডেটা অ্যাক্সেস করতে পারে তা নির্ধারণ করতে Firebase Security Rules এক্সটেনসিবল, নমনীয় কনফিগারেশন ভাষাগুলিকে লিভারেজ করে৷ Firebase Realtime Database Security Rules নিয়মের সংজ্ঞায় JSON লিভারেজ করে, যখন Cloud Firestore Security Rules এবং Cloud Storage জন্য Firebase Security Rules আরও জটিল নিয়ম-নির্দিষ্ট স্ট্রাকচারগুলিকে মিটমাট করার জন্য নির্মিত একটি অনন্য ভাষা লিভার করে।
আপনি আপনার অ্যাপে যে নির্দিষ্ট ফায়ারবেস পণ্যগুলি ব্যবহার করেন তার জন্য কীভাবে Rules সেট আপ করবেন এবং Firebase পণ্যগুলিতে Rules আচরণ কীভাবে আলাদা হয় সে সম্পর্কে আরও জানুন।
কাস্টম নিয়ম লিখুন যা আপনার অ্যাপের গঠন এবং আচরণের জন্য অর্থপূর্ণ। Rules এমন ভাষা ব্যবহার করে যা আপনাকে অ্যাক্সেসের অনুমোদনের জন্য আপনার নিজস্ব ডেটা ব্যবহার করতে দেয়।
গ্রানুলারিটি
আপনার নিয়মগুলি আপনার প্রয়োজন অনুসারে বিস্তৃত বা সংকীর্ণ হতে পারে।
স্বাধীন নিরাপত্তা
যেহেতু Rules আপনার অ্যাপের বাইরে সংজ্ঞায়িত করা হয়েছে ( Firebase কনসোল বা Firebase CLI-তে), ক্লায়েন্টরা নিরাপত্তা প্রয়োগের জন্য দায়ী নয়, বাগগুলি ডেটার সাথে আপস করে না এবং আপনার ডেটা সর্বদা সুরক্ষিত থাকে৷
তারা কিভাবে কাজ করে?
Firebase Security Rules ডাটাবেস পাথগুলির সাথে একটি প্যাটার্ন মেলে এবং তারপর সেই পাথে ডেটা অ্যাক্সেসের অনুমতি দেওয়ার জন্য কাস্টম শর্ত প্রয়োগ করে কাজ করে৷ ফায়ারবেস পণ্য জুড়ে সমস্ত Rules একটি পাথ-ম্যাচিং উপাদান এবং একটি শর্তসাপেক্ষ বিবৃতি রয়েছে যা পড়ার বা লেখার অ্যাক্সেসের অনুমতি দেয়। আপনি আপনার অ্যাপে ব্যবহার করেন এমন প্রতিটি Firebase পণ্যের জন্য আপনাকে অবশ্যই Rules নির্ধারণ করতে হবে।
Cloud Firestore এবং Cloud Storage জন্য, Rules নিম্নলিখিত সিনট্যাক্স ব্যবহার করে:
service <<name>> {
// Match the resource path.
match <<path>> {
// Allow the request if the following conditions are true.
allow <<methods>> : if <<condition>>
}
}
Realtime Database জন্য, JSON-ভিত্তিক Rules নিম্নলিখিত সিনট্যাক্স ব্যবহার করে:
{
"rules": {
"<<path>>": {
// Allow the request if the condition for each method is true.
".read": <<condition>>,
".write": <<condition>>
}
}
}
RulesOR বিবৃতি হিসাবে প্রয়োগ করা হয়, AND বিবৃতি নয়। ফলস্বরূপ, যদি একাধিক নিয়ম একটি পাথের সাথে মেলে, এবং মিলিত শর্তগুলির মধ্যে যেকোনটি অ্যাক্সেস মঞ্জুর করে, Rules সেই পথের ডেটাতে অ্যাক্সেস মঞ্জুর করে৷ অতএব, যদি একটি বিস্তৃত নিয়ম ডেটাতে অ্যাক্সেস দেয়, আপনি আরও নির্দিষ্ট নিয়মের সাথে সীমাবদ্ধ করতে পারবেন না। যাইহোক, আপনার Rules খুব বেশি ওভারল্যাপ না করে তা নিশ্চিত করে আপনি এই সমস্যাটি এড়াতে পারেন। কম্পাইলার সতর্কতা হিসাবে আপনার মিলিত পাথগুলিতে Firebase Security Rules ফ্ল্যাগ ওভারল্যাপ করে।
Firebase Security Rules ব্যবহারকারী-ভিত্তিক অনুমতি প্রদানের জন্য Authentication সুবিধাও দিতে পারে এবং আপনার সেট করা শর্তগুলি খুব মৌলিক বা অবিশ্বাস্যভাবে জটিল হতে পারে। আপনি Rules লিখতে শুরু করার আগে Rulesভাষা এবং আচরণ সম্পর্কে আরও জানুন।
আপনার অ্যাপের আচরণ পরীক্ষা করতে Realtime Database এবং Cloud Firestore এমুলেটরগুলি ব্যবহার করুন এবং আপনি সেগুলি উৎপাদনে স্থাপন করার আগে আপনার নিয়মগুলি যাচাই করুন৷
আপনার Firebase Security Rules স্থাপন করুন
উত্পাদনে আপনার নিয়মগুলি স্থাপন করতে Firebase কনসোল বা Firebase CLI ব্যবহার করুন৷
[[["সহজে বোঝা যায়","easyToUnderstand","thumb-up"],["আমার সমস্যার সমাধান হয়েছে","solvedMyProblem","thumb-up"],["অন্যান্য","otherUp","thumb-up"]],[["এতে আমার প্রয়োজনীয় তথ্য নেই","missingTheInformationINeed","thumb-down"],["খুব জটিল / অনেক ধাপ","tooComplicatedTooManySteps","thumb-down"],["পুরনো","outOfDate","thumb-down"],["অনুবাদ সংক্রান্ত সমস্যা","translationIssue","thumb-down"],["নমুনা / কোড সংক্রান্ত সমস্যা","samplesCodeIssue","thumb-down"],["অন্যান্য","otherDown","thumb-down"]],["2025-07-25 UTC-তে শেষবার আপডেট করা হয়েছে।"],[],[],null,["Firebase Security Rules \nplat_ios plat_android plat_web plat_flutter plat_node \nUse our flexible, extensible Firebase Security Rules to\nsecure your data in Cloud Firestore, Firebase Realtime Database, and\nCloud Storage.\n\nFirebase Security Rules stand between your data and malicious users. You can write simple or\ncomplex rules that protect your app's data to the level of granularity that\nyour specific app requires.\n\nFirebase Security Rules leverage\nextensible, flexible configuration languages to define what data your users\ncan access for Realtime Database, Cloud Firestore, and Cloud Storage.\nFirebase Realtime Database Security Rules leverage JSON in rule definitions, while\nCloud Firestore Security Rules and Firebase Security Rules for Cloud Storage leverage a unique\nlanguage built to accommodate more complex rules-specific structures.\n\nLearn more about how to set up Rules for the specific Firebase products\nyou use in your app, and how Rules behavior differs across Firebase\nproducts.\n\n[Get started](/docs/rules/get-started)\n\nKey capabilities\n\n|----------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Flexibility | Write custom rules that make sense for your app's structure and behavior. Rules use languages that allow you to leverage your own data to authorize access. |\n| Granularity | Your rules can be as broad or as narrow as you need. |\n| Independent security | Because Rules are defined outside of your app (in the Firebase console or Firebase CLI), clients aren't responsible for enforcing security, bugs don't compromise data, and your data is always protected. |\n\nHow do they work?\n\nFirebase Security Rules work by matching a pattern against database paths, and then applying\ncustom conditions to allow access to data at those paths. All Rules\nacross Firebase products have a path-matching component and a conditional\nstatement allowing read or write access. You must define Rules for\neach Firebase product you use in your app.\n\nFor Cloud Firestore and Cloud Storage, Rules use the following\nsyntax: \n\n service \u003c\u003cname\u003e\u003e {\n // Match the resource path.\n match \u003c\u003cpath\u003e\u003e {\n // Allow the request if the following conditions are true.\n allow \u003c\u003cmethods\u003e\u003e : if \u003c\u003ccondition\u003e\u003e\n }\n }\n\nFor Realtime Database, JSON-based Rules use the following syntax: \n\n {\n \"rules\": {\n \"\u003c\u003cpath\u003e\u003e\": {\n // Allow the request if the condition for each method is true.\n \".read\": \u003c\u003ccondition\u003e\u003e,\n \".write\": \u003c\u003ccondition\u003e\u003e\n }\n }\n }\n\nRules are applied as `OR` statements, not `AND` statements.\nConsequently, if multiple rules match a path, and any of the matched\nconditions grants access, Rules grant access to the data at that\npath. Therefore, if a broad rule grants access to data, you can't restrict with\na more specific rule. You can, however, avoid this problem by making sure your\nRules don't overlap too much. Firebase Security Rules flag overlaps in your\nmatched paths as compiler warnings.\n\nFirebase Security Rules can also leverage Authentication to grant user-based permissions, and the\nconditions you set can be very basic or incredibly complex. Learn more\nabout Rules [language](/docs/rules/rules-language) and [behavior](/docs/rules/rules-behavior)\nbefore you start writing Rules.\n\nImplementation path\n\n|---|-------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| | Integrate the product SDKs | Set up [Cloud Firestore](/docs/firestore), [Cloud Storage](/docs/storage), or [Realtime Database](/docs/database) for your app. |\n| | Write your Firebase Security Rules | Learn more about [how Rules work](/docs/rules/rules-behavior) and [set up some basic Rules](/docs/rules/basics) |\n| | Test your Firebase Security Rules | Use the Realtime Database and Cloud Firestore emulators to test your app's behavior and validate your rules before you deploy them to production. |\n| | Deploy your Firebase Security Rules | Use the Firebase console or the Firebase CLI to deploy your rules to production. |\n\nNext steps\n\n- [Understand the Firebase Security Rules language](/docs/rules/rules-language).\n- Learn more about [how Firebase Security Rules work](/docs/rules/rules-behavior).\n- Explore the [common mistakes you should avoid](/docs/rules/insecure-rules)."]]