{"id":36743750,"url":"https://github.com/gunnargrosch/failure-cloudfunctions","last_synced_at":"2026-01-12T12:30:55.462Z","repository":{"id":38765950,"uuid":"242233285","full_name":"gunnargrosch/failure-cloudfunctions","owner":"gunnargrosch","description":"Module for failure injection into Cloud Functions","archived":false,"fork":false,"pushed_at":"2023-01-07T20:58:36.000Z","size":398,"stargazers_count":1,"open_issues_count":12,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-25T23:41:10.495Z","etag":null,"topics":["chaos","chaos-engineering","cloudfunctions","failure","failure-injection","gcp","google"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gunnargrosch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-21T21:24:16.000Z","updated_at":"2020-08-24T19:22:16.000Z","dependencies_parsed_at":"2023-02-08T01:47:17.989Z","dependency_job_id":null,"html_url":"https://github.com/gunnargrosch/failure-cloudfunctions","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/gunnargrosch/failure-cloudfunctions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-cloudfunctions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-cloudfunctions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-cloudfunctions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-cloudfunctions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gunnargrosch","download_url":"https://codeload.github.com/gunnargrosch/failure-cloudfunctions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gunnargrosch%2Ffailure-cloudfunctions/sbom","scorecard":{"id":449462,"data":{"date":"2025-08-11","repo":{"name":"github.com/gunnargrosch/failure-cloudfunctions","commit":"1f69074c58d3938ffacf28548d606dac3e7f6e83"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"30 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-pp75-xfpw-37g9","Warn: Project is vulnerable to: GHSA-7v5v-9h63-cj86","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-gxpj-cx7g-858c","Warn: Project is vulnerable to: GHSA-ww39-953v-wcq6","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-w7rc-rwvf-8q5r","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-92xj-mqp7-vmcj","Warn: Project is vulnerable to: GHSA-wxgw-qj99-44c2","Warn: Project is vulnerable to: GHSA-5rrq-pxf6-6jx5","Warn: Project is vulnerable to: GHSA-8fr3-hfg3-gpgp","Warn: Project is vulnerable to: GHSA-gf8q-jrpm-jvxq","Warn: Project is vulnerable to: GHSA-2r2c-g63r-vccr","Warn: Project is vulnerable to: GHSA-cfm4-qjh2-4765","Warn: Project is vulnerable to: GHSA-x4jg-mjrx-434g","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-g954-5hwp-pp24","Warn: Project is vulnerable to: GHSA-h755-8qp9-cq85","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-cf4h-3jhx-xvhq","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T07:47:47.566Z","repository_id":38765950,"created_at":"2025-08-19T07:47:47.566Z","updated_at":"2025-08-19T07:47:47.566Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338977,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chaos","chaos-engineering","cloudfunctions","failure","failure-injection","gcp","google"],"created_at":"2026-01-12T12:30:54.899Z","updated_at":"2026-01-12T12:30:55.454Z","avatar_url":"https://github.com/gunnargrosch.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Failure injection for Google Cloud Functions - failure-cloudfunctions\n\n## Description\n\n`failure-cloudfunctions` is a small Node module for injecting failure into Google Cloud Functions (https://cloud.google.com/functions/). It offers a simple failure injection wrapper for your Cloud Functions handler where you then can choose to inject failure by setting the `failureMode` to `latency`, `exception`, `denylist`, `diskspace` or `statuscode`. You control your failure injection using a secret in Secret Manager.\n\n## How to install\n\n1. Install `failure-cloudfunctions` module using NPM.\n```bash\nnpm install failure-cloudfunctions\n```\n2. Add the module to your Cloud Functions function code.\n```js\nconst failureCloudFunctions = require('failure-cloudfunctions')\n```\n3. Wrap your handler.\n```js\nexports.handler = failureCloudFunctions(async (req, res) =\u003e {\n  ...\n})\n```\n4. Create a secret in Secret Manager.\n```json\n{\"isEnabled\": false, \"failureMode\": \"latency\", \"rate\": 1, \"minLatency\": 100, \"maxLatency\": 400, \"exceptionMsg\": \"Exception message!\", \"statusCode\": 404, \"diskSpace\": 100, \"denylist\": [\"storage.googleapis.com\"]}\n```\n```bash\ngcloud beta secrets create \u003cyour-secret-name\u003e --replication-policy=\"automatic\"\necho -n \"{\\\"isEnabled\\\": false, \\\"failureMode\\\": \\\"latency\\\", \\\"rate\\\": 1, \\\"minLatency\\\": 100, \\\"maxLatency\\\": 400, \\\"exceptionMsg\\\": \\\"Exception message!\\\", \\\"statusCode\\\": 404, \\\"diskSpace\\\": 100, \\\"denylist\\\": [\\\"storage.googleapis.com\\\"]}\" | gcloud beta secrets versions add \u003cyour-secret-name\u003e --data-file=-\n```\n5. Add environment variables to your Cloud Function with values from above.\n```bash\nGCP_PROJECT=\u003cyour-gcp-project-id\u003e\nFAILURE_INJECTION_PARAM=\u003cyour-secret-name\u003e\n```\n6. Give your Cloud Function access to your secret in Secret Manager.\n```bash\ngcloud beta secrets add-iam-policy-binding \u003cyour-secret-name\u003e --role roles/secretmanager.secretAccessor --member serviceAccount:\u003cyour-gcp-project-id\u003e@appspot.gserviceaccount.com\n```\n7. Try it out!\n\n## Usage\n\nEdit the values of your parameter in Secret Manager to use the failure injection module.\n\n* `isEnabled: true` means that failure is injected into your Cloud Function.\n* `isEnabled: false` means that the failure injection module is disabled and no failure is injected.\n* `failureMode` selects which failure you want to inject. The options are `latency`, `exception`, `denylist`, `diskspace` or `statuscode` as explained below.\n* `rate` controls the rate of failure. 1 means that failure is injected on all invocations and 0.5 that failure is injected on about half of all invocations.\n* `minLatency` and `maxLatency` is the span of latency in milliseconds injected into your function when `failureMode` is set to `latency`.\n* `exceptionMsg` is the message thrown with the exception created when `failureMode` is set to `exception`.\n* `statusCode` is the status code returned by your function when `failureMode` is set to `statuscode`.\n* `diskSpace` is size in MB of the file created in tmp when `failureMode` is set to `diskspace`.\n* `denylist` is an array of regular expressions, if a connection is made to a host matching one of the regular expressions it will be blocked.\n\n## Example\n\nIn the subfolder `example` is a simple function which can be installed in Google Cloud and used for test.\n\n## Notes\n\nInspired by Yan Cui's articles on latency injection for Google Cloud Functions (https://hackernoon.com/chaos-engineering-and-aws-lambda-latency-injection-ddeb4ff8d983) and Adrian Hornsby's chaos injection library for Python (https://github.com/adhorn/aws-lambda-chaos-injection/).\n\n## Changelog\n\n### 2020-08-24 v0.3.0\n\n* Changed mitm mode from connect to connection for quicker enable/disable of failure injection.\n* Renamed block list failure injection to denylist (breaking change for that failure mode).\n* Updated dependencies.\n\n### 2020-03-01 v0.2.1\n\n* Added permission info to documentation.\n* Fixed tmp path in library and example.\n\n### 2020-03-01 v0.2.0\n\n* Fixed Secret Manager integration.\n* Added simple example.\n* Updated documentation.\n\n### 2020-02-28 v0.0.1\n\n* Initial release\n\n## Contributors\n\n**Gunnar Grosch** - [GitHub](https://github.com/gunnargrosch) | [Twitter](https://twitter.com/gunnargrosch) | [LinkedIn](https://www.linkedin.com/in/gunnargrosch/)\n\n**Jason Barto** - [GitHub](https://github.com/jpbarto) | [Twitter](https://twitter.com/Jason_Barto) | [LinkedIn](https://www.linkedin.com/in/jasonbarto)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunnargrosch%2Ffailure-cloudfunctions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgunnargrosch%2Ffailure-cloudfunctions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgunnargrosch%2Ffailure-cloudfunctions/lists"}