Skip to content
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

Support consumeAppCheckToken option for callable functions #1374

Merged
merged 13 commits into from May 5, 2023
Merged

Conversation

taeold
Copy link
Contributor

@taeold taeold commented Apr 13, 2023

No description provided.

src/common/providers/https.ts Outdated Show resolved Hide resolved
src/v2/options.ts Outdated Show resolved Hide resolved
src/v2/options.ts Outdated Show resolved Hide resolved
src/v2/options.ts Outdated Show resolved Hide resolved
src/v2/providers/https.ts Outdated Show resolved Hide resolved
src/v2/options.ts Outdated Show resolved Hide resolved
src/common/providers/https.ts Outdated Show resolved Hide resolved
@taeold taeold requested a review from weixifan April 27, 2023 21:41
@taeold taeold marked this pull request as ready for review April 28, 2023 21:20
appCheckData = await getAppCheck(getApp()).verifyToken(appCheck);
const appCheck = getAppCheck(getApp());
if (options.consumeAppCheckToken) {
if (appCheck.verifyToken.length === 1) {
Copy link
Member

Choose a reason for hiding this comment

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

I might be wrong here but if appCheck.verifyToken is undefined, accessing .length throws, doesn't it?
Would it be better to do the following instead?

if (typeof appCheck.verifyToken === "function") { 

Copy link
Member

Choose a reason for hiding this comment

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

I just realized that you are checking the number of parameters here. If we are confident that the Admin SDK used always has the appCheck API, please ignore my comment above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Think defensive coding is better here!

@taeold taeold changed the title App check improvement Support consumeAppCheckToken option for callable functions May 5, 2023
@taeold taeold merged commit ef4cdda into master May 5, 2023
15 checks passed
@taeold taeold deleted the dl-fac branch May 5, 2023 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants