Skip to content

Support verification of AppCheck token in Callable Functions #885

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
May 12, 2021

Conversation

taeold
Copy link
Contributor

@taeold taeold commented May 10, 2021

Callable Functions will now verify the AppCheck token included in the X-Firebase-AppCheck request header. Similar to auth, Callable Function will return 401 Unauthorized if the AppCheck token is invalid.

New Logging Behavior

In addition, all requests to Callable Functions will emit a log that contains status of the token verifications. E.g. If auth token isn't included in the request while the appCheck token is included but invalid, following log is emitted:

{
  "severity": "WARNING",
  "logging.googleapis.com/labels": {"firebase-log-type": "callable-request-verification"},
  "jsonPayload": {
    "message": "Callable header verifications failed: AppCheck token was rejected.",
    "verifications": {
      "auth": "MISSING",
      "app": "INVALID",
    }
  }
}

Log will be used by customers that plans on setting up log-based metric on status of appCheck/auth enforcement on their Callable Functions (Note that other products, like storage, natively supports such metric via Cloud Monitoring).

tsconfig target update es2017->es2018

This change was necessary to run npm run build:release command now that we've bumped the admin sdk version from 8 to 9. I'm unsure why this is necessary to make the release tarball, but don't think this is a dangerous change as es2018 is supported from Nodev8 and beyond.

taeold and others added 2 commits April 7, 2021 13:04

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@google-cla google-cla bot added the cla: yes label May 10, 2021
@taeold taeold requested review from inlined and joehan May 11, 2021 00:09
@taeold taeold marked this pull request as ready for review May 11, 2021 17:43
taeold and others added 2 commits May 11, 2021 11:50
Co-authored-by: Michael Bleigh <bleigh@google.com>
Co-authored-by: Michael Bleigh <bleigh@google.com>
Copy link
Member

@inlined inlined left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. My only concern is that we're dropping support for 9.0.0 to ~9.7

@taeold taeold merged commit c29a8a5 into master May 12, 2021
@inlined inlined deleted the cf3-appcheck branch May 12, 2021 18:19
@diegofun
Copy link

I got an issue implementing AppChek, when use a callable funciton the system says:

W/StorageUtil: Error getting App Check token; using placeholder token instead...

what you think sholud I do?

@taeold
Copy link
Contributor Author

taeold commented Jun 1, 2021

@diegofun Can you try writing up an issue at https://github.com/firebase/firebase-functions/issues instead? It would help if you included a reproducible example (e.g. code samples, full stacktrace of error you are getting) so I can help debug the issue more easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants