App Check: Functions auf enforceAppCheck=true vorbereitet (noch nicht deployt)

Zweiter Schritt aus firebase-einrichtung.md Schritt 9 — alle sieben
onCall-Functions (identifyPlant, diagnosePlant, analyzeLocation,
assessPlantFit, joinHousehold, leaveHousehold, removeMember) lehnen
nach dem Deploy Aufrufe ohne gültiges App-Check-Token ab. Bewusst noch
nicht deployt: Chris muss vorher in der Firebase-Console bestätigen,
dass "Verified requests" für beide Apps ankommen.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
cschlaefke 2026-08-20 12:30:46 +02:00
parent d4b72637ba
commit 49b7f4496c
3 changed files with 20 additions and 7 deletions

View file

@ -84,7 +84,7 @@ async function removeUidFromHousehold(
* Der Besitzer kann seinen eigenen Haushalt nicht verlassen. * Der Besitzer kann seinen eigenen Haushalt nicht verlassen.
*/ */
export const leaveHousehold = onCall( export const leaveHousehold = onCall(
{region: "europe-west3"}, {region: "europe-west3", enforceAppCheck: true},
async (request) => { async (request) => {
if (!request.auth) { if (!request.auth) {
throw new HttpsError("unauthenticated", "Anmeldung erforderlich."); throw new HttpsError("unauthenticated", "Anmeldung erforderlich.");
@ -134,7 +134,7 @@ export const leaveHousehold = onCall(
* Ein Mitglied aus dem eigenen Haushalt entfernen (nur der Besitzer). * Ein Mitglied aus dem eigenen Haushalt entfernen (nur der Besitzer).
*/ */
export const removeMember = onCall( export const removeMember = onCall(
{region: "europe-west3"}, {region: "europe-west3", enforceAppCheck: true},
async (request) => { async (request) => {
if (!request.auth) { if (!request.auth) {
throw new HttpsError("unauthenticated", "Anmeldung erforderlich."); throw new HttpsError("unauthenticated", "Anmeldung erforderlich.");
@ -203,7 +203,7 @@ export const removeMember = onCall(
* ändern dürfte. Codes sind einmalig verwendbar und 7 Tage gültig. * ändern dürfte. Codes sind einmalig verwendbar und 7 Tage gültig.
*/ */
export const joinHousehold = onCall( export const joinHousehold = onCall(
{region: "europe-west3"}, {region: "europe-west3", enforceAppCheck: true},
async (request) => { async (request) => {
if (!request.auth) { if (!request.auth) {
throw new HttpsError("unauthenticated", "Anmeldung erforderlich."); throw new HttpsError("unauthenticated", "Anmeldung erforderlich.");

View file

@ -159,6 +159,7 @@ interface DiagnosisResult {
export const diagnosePlant = onCall( export const diagnosePlant = onCall(
{ {
region: "europe-west3", region: "europe-west3",
enforceAppCheck: true,
secrets: [anthropicApiKey], secrets: [anthropicApiKey],
memory: "512MiB", memory: "512MiB",
timeoutSeconds: 120, timeoutSeconds: 120,
@ -228,6 +229,7 @@ export const diagnosePlant = onCall(
export const identifyPlant = onCall( export const identifyPlant = onCall(
{ {
region: "europe-west3", region: "europe-west3",
enforceAppCheck: true,
secrets: [plantNetApiKey, anthropicApiKey], secrets: [plantNetApiKey, anthropicApiKey],
memory: "512MiB", memory: "512MiB",
timeoutSeconds: 120, timeoutSeconds: 120,
@ -329,6 +331,7 @@ interface LocationAnalysis {
export const analyzeLocation = onCall( export const analyzeLocation = onCall(
{ {
region: "europe-west3", region: "europe-west3",
enforceAppCheck: true,
secrets: [anthropicApiKey], secrets: [anthropicApiKey],
memory: "512MiB", memory: "512MiB",
timeoutSeconds: 120, timeoutSeconds: 120,
@ -379,6 +382,7 @@ interface PlantFitAssessment {
export const assessPlantFit = onCall( export const assessPlantFit = onCall(
{ {
region: "europe-west3", region: "europe-west3",
enforceAppCheck: true,
secrets: [anthropicApiKey], secrets: [anthropicApiKey],
memory: "512MiB", memory: "512MiB",
timeoutSeconds: 120, timeoutSeconds: 120,

View file

@ -23,8 +23,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/firebase/firebase-ios-sdk", "location" : "https://github.com/firebase/firebase-ios-sdk",
"state" : { "state" : {
"revision" : "42e81d245e30e49ea6a5830cf2842d44a1591270", "revision" : "33a468adfdb75b53f05a37e7c886ca7c962b5c17",
"version" : "12.15.0" "version" : "12.17.0"
} }
}, },
{ {
@ -41,8 +41,8 @@
"kind" : "remoteSourceControl", "kind" : "remoteSourceControl",
"location" : "https://github.com/google/GoogleAppMeasurement.git", "location" : "https://github.com/google/GoogleAppMeasurement.git",
"state" : { "state" : {
"revision" : "144855f40d8668927f256a3045f7fdc4c3f4338b", "revision" : "fceaffa07d22dcd5624d3639fd970351a4a5ad8c",
"version" : "12.15.0" "version" : "12.17.0"
} }
}, },
{ {
@ -116,6 +116,15 @@
"revision" : "f4a19a3c313dc2616c70bb49d29a799fb16be837", "revision" : "f4a19a3c313dc2616c70bb49d29a799fb16be837",
"version" : "2.4.1" "version" : "2.4.1"
} }
},
{
"identity" : "recaptcha-enterprise-mobile-sdk",
"kind" : "remoteSourceControl",
"location" : "https://github.com/GoogleCloudPlatform/recaptcha-enterprise-mobile-sdk.git",
"state" : {
"revision" : "85588690041e63784be7bcb4b631c32565127ba2",
"version" : "18.9.1"
}
} }
], ],
"version" : 2 "version" : 2