@digital-agora/friday-google-cloud 0.1.3 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,17 @@
1
+ id: firebase-emulators
2
+ stack: firebase
3
+ refines: [testing]
4
+ description: Testing against the Firebase Local Emulator Suite, at the integration level only.
5
+ appliesTo:
6
+ paths: ["firebase.json", "**/*.rules", "**/*.test.*", "**/test_*.py"]
7
+ emit: [rule]
8
+ rules:
9
+ - id: demo-project
10
+ rule: "Emulator tests use a `demo-` project id, so no call can reach a real project."
11
+ source: https://firebase.google.com/docs/emulator-suite/connect_and_prototype#choose_a_firebase_project
12
+ - id: integration-only
13
+ rule: "Emulator suites run at the integration level (`firebase emulators:exec`), never in a task loop."
14
+ source: https://firebase.google.com/docs/emulator-suite/install_and_configure
15
+ - id: own-data
16
+ rule: "Each suite seeds its own data and clears it after (`clearFirestore`), and loads the same rules file that is deployed."
17
+ source: https://firebase.google.com/docs/rules/unit-tests
@@ -0,0 +1,23 @@
1
+ id: firebase-functions
2
+ stack: firebase-functions
3
+ refines: [entry-points]
4
+ description: Cloud Functions for Firebase (2nd gen) as entry points onto the core.
5
+ appliesTo:
6
+ paths: ["functions/**", "firebase.json"]
7
+ emit: [rule, skill]
8
+ rules:
9
+ - id: v2-region
10
+ rule: "Functions use the 2nd-generation APIs (`firebase-functions/v2/*`), with the region set per function or once with `setGlobalOptions`, next to the data they read."
11
+ source: https://firebase.google.com/docs/functions/locations
12
+ - id: entry-point
13
+ rule: "A function is an entry point: it parses its input, builds the Caller from `request.auth`, calls a use case and maps the Result; it holds no logic."
14
+ source: https://alistair.cockburn.us/hexagonal-architecture/
15
+ - id: callable-errors
16
+ rule: "A callable maps each domain error to an `HttpsError` code (`invalid-argument`, `permission-denied`, `not-found`, ...) with a message that carries no internal detail."
17
+ source: https://firebase.google.com/docs/functions/callable#handle_errors
18
+ - id: secrets
19
+ rule: "Secrets are `defineSecret` parameters bound to the functions that use them (`secrets: [...]`), never environment literals or committed config."
20
+ source: https://firebase.google.com/docs/functions/config-env#secret-manager
21
+ - id: retries
22
+ rule: "An event-triggered function is idempotent by its event id, and retries are turned on explicitly (`retry: true`) for the handlers that are."
23
+ source: https://firebase.google.com/docs/functions/retries
@@ -1,5 +1,6 @@
1
1
  id: firestore-data
2
2
  stack: firestore
3
+ topics: [pii]
3
4
  description: Where protected fields live in Firestore, and what client rules do not protect.
4
5
  emit: [rule, skill]
5
6
  rules:
@@ -0,0 +1,21 @@
1
+ id: firestore-pii
2
+ stack: firestore
3
+ topics: [pii]
4
+ refines: [special-category-data, pii-exposure]
5
+ description: Personal data in Firestore, separated by reader into private subdocuments the rules let only their owner read.
6
+ appliesTo:
7
+ paths: ["**/*.rules", "firebase.json", "**/firestore.indexes.json"]
8
+ emit: [rule, skill]
9
+ rules:
10
+ - id: split-by-reader
11
+ rule: "One document per set of readers: a document keeps only the fields every one of its readers may see; a field only some readers may see moves to a subdocument with a fixed id per reader set (`private/owner`, `private/staff`) under the same parent."
12
+ source: https://firebase.google.com/docs/firestore/security/rules-fields
13
+ - id: owner-rule
14
+ rule: "A subdocument with special category or other owner-only data has `allow read: if request.auth != null && request.auth.uid == <the owner id in the path>` and `allow write: if false`: never a custom claim, never `get()` or `exists()` on another document, never a collection-group match."
15
+ source: https://firebase.google.com/docs/rules/rules-and-auth
16
+ - id: static-check
17
+ rule: "A static test over the rules file fails when an owner-only path's rule uses `request.auth.token`, `get(`, `exists(` or a recursive wildcard, and an emulator test proves that the owner reads it and every other caller kind is refused."
18
+ source: https://firebase.google.com/docs/rules/unit-tests
19
+ - id: erase-subdocuments
20
+ rule: "Erasure deletes each fixed-id private subdocument by its path: deleting a parent document does not delete its subcollections."
21
+ source: https://firebase.google.com/docs/firestore/manage-data/delete-data#collections
@@ -1,5 +1,6 @@
1
1
  id: firestore-rules
2
2
  stack: firestore
3
+ topics: [pii]
3
4
  description: Firestore and Cloud Storage security rules, and the private documents they keep from clients.
4
5
  appliesTo:
5
6
  paths: ["**/*.rules", "firebase.json"]
@@ -0,0 +1,3 @@
1
+ name: Firebase
2
+ kind: platform
3
+ description: Firestore data and rules, personal data in Firestore, Functions and the emulators, each rule citing Firebase's documentation.
@@ -0,0 +1,3 @@
1
+ name: Google Cloud
2
+ kind: platform
3
+ description: Cloud Run, IAM and other Google Cloud services, each rule citing Google's documentation.
@@ -0,0 +1,22 @@
1
+ id: regions
2
+ stack: gcp
3
+ description: Where each runtime and store runs, chosen once inside the project's data residency scope and kept the same in every file.
4
+ appliesTo:
5
+ paths: ["firebase.json", "cloudbuild/**", "infra/**", "apphosting*.yaml", "services/**/Dockerfile", "**/*.tf"]
6
+ emit: [rule, skill]
7
+ rules:
8
+ - id: residency-scope
9
+ rule: "Each project records, as a decision, its residency scope (the jurisdiction its data must stay in, such as the EU) and its base region inside that scope; every region it uses is inside the scope."
10
+ source: https://cloud.google.com/docs/geography-and-regions
11
+ - id: one-base-region
12
+ rule: "Cloud Run, Functions, Cloud Build, Artifact Registry, Cloud Tasks and Scheduler run in the base region; a product the base region does not offer runs in the nearest region inside the scope that does, named in the decision."
13
+ source: https://cloud.google.com/about/locations
14
+ - id: data-location
15
+ rule: "Each store (Firestore, Cloud Storage, Cloud SQL) sits in the base region or a multi-region inside the scope; a store's location is chosen once, as a decision, before it is created."
16
+ source: https://firebase.google.com/docs/firestore/locations
17
+ - id: next-to-data
18
+ rule: "Compute runs in the region of the data it reads, so a request does not cross regions for each read."
19
+ source: https://firebase.google.com/docs/functions/locations
20
+ - id: one-setting
21
+ rule: "The region is one setting per project (a Terraform variable, `setGlobalOptions`, `firebase.json`), read wherever it is needed, never repeated as a literal across files."
22
+ source: https://firebase.google.com/docs/functions/locations#best_practices_for_changing_region
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digital-agora/friday-google-cloud",
3
- "version": "0.1.3",
3
+ "version": "0.2.1",
4
4
  "description": "Google Cloud's specialization of Friday: Firestore, Cloud Run, Cloud Functions, Secret Manager and IAM conventions on top of Friday's generic pack, each citing Google's documentation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -20,7 +20,7 @@
20
20
  "node": ">=20"
21
21
  },
22
22
  "dependencies": {
23
- "@digital-agora/friday": "^0.13.0"
23
+ "@digital-agora/friday": "^0.15.0"
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",