{"id":17912736,"url":"https://github.com/dergoegge/firebase-security-testing","last_synced_at":"2026-03-01T03:34:10.009Z","repository":{"id":34298787,"uuid":"175700641","full_name":"dergoegge/firebase-security-testing","owner":"dergoegge","description":"Testing framework for firestore and firebase storage security rules.","archived":false,"fork":false,"pushed_at":"2022-12-10T16:57:10.000Z","size":202,"stargazers_count":5,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-25T08:24:48.299Z","etag":null,"topics":["firebase","security-rules","security-testing","testing-framework"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dergoegge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-14T21:14:13.000Z","updated_at":"2021-06-12T12:44:49.000Z","dependencies_parsed_at":"2023-01-15T06:03:56.597Z","dependency_job_id":null,"html_url":"https://github.com/dergoegge/firebase-security-testing","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dergoegge/firebase-security-testing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dergoegge%2Ffirebase-security-testing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dergoegge%2Ffirebase-security-testing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dergoegge%2Ffirebase-security-testing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dergoegge%2Ffirebase-security-testing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dergoegge","download_url":"https://codeload.github.com/dergoegge/firebase-security-testing/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dergoegge%2Ffirebase-security-testing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29959394,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-01T01:47:18.291Z","status":"online","status_checked_at":"2026-03-01T02:00:07.437Z","response_time":124,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["firebase","security-rules","security-testing","testing-framework"],"created_at":"2024-10-28T19:46:46.019Z","updated_at":"2026-03-01T03:34:09.984Z","avatar_url":"https://github.com/dergoegge.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Firebase security rules testing\n\nThere is currently no official testing framework for firebase storage security rules.\n\nThere is how ever the [Firebase Rules API](https://developers.google.com/apis-explorer/?hl=en_US#search/firebaserules/firebaserules/v1/) which does provide unit testing functionality.\nThe simulator in the firebase console makes use of this api.\n\nThis repository is an attempt at a client for this api and since the api works for both **Firestore** and **Firebase Storage** you will be able to test both types of security rules with this client.\n\nI also opened a feature request with firebase, so maybe they will realease something like this pretty soon with official support.\n\n## Install\n```sh\nnpm i firebase-security-testing\n```\n\n## Setup\nIn order for this package to work you will have to set the `FIREBASE_TOKEN` environment variable.\nYou can obtain the token with:\n```sh\nfirebase login:ci\n```\n\n## Examples\n\n## \n```javascript\nconst { RuleTestSuite, validateRuleSuite } = require('firebase-security-testing');\n\n// Initialise the rule test suite\nvar storageRules = new RuleTestSuite({\n\trulePath: 'storage.rules', // path to your rules file\n\tproject: '\u003cproject-name\u003e', // your project name\n\tdescription: 'storage rules' // optional for logging of results\n});\n\n// add a test case\nstorageRules.test('\u003cdescription\u003e'/* description for logging */, {\n\tpath: '/b/\u003cbucket-name\u003e/o/path/to/resource',\n\tmethod: 'get',\n\tauth: {\n\t\tuid: '...',\n\t\ttoken: {\n\t\t\t'...': '...'\n\t\t}\n\t}\n}).shouldSucceed(); // this test case should succeed\n\n// ad another test case\nstorageRules.test('\u003cdescription\u003e'/* description for logging */, {\n\tpath: '/b/\u003cbucket-name\u003e/o/path/to/resource',\n\tmethod: 'create'\n}).shouldFail(); // this test case should fail\n\n// validate the tests\nvalidateRuleSuite(storageRules, { logging: true, exitOnFailure: true });\n\n```\n\n*The `exitOnFailure` option defaults to true.*\n\n## Test case options\n\nThe options for the test cases (\"as far as i can tell\") are the ones listed in the documentation for [firestore request](https://firebase.google.com/docs/reference/rules/rules.firestore.Request), [firestore resource](https://firebase.google.com/docs/reference/rules/rules.firestore.Resource), [storage request](https://firebase.google.com/docs/reference/security/storage/#request), [storage resource](https://firebase.google.com/docs/reference/security/storage/#resource)\n\n## Contributing\nEvery contribution welcome just open a issue or pr...","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdergoegge%2Ffirebase-security-testing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdergoegge%2Ffirebase-security-testing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdergoegge%2Ffirebase-security-testing/lists"}