Skip to content

Handle null auth events from the iframe #3818

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 2 commits into from
Sep 25, 2020
Merged

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Sep 21, 2020

b/166286937

@changeset-bot
Copy link

changeset-bot bot commented Sep 21, 2020

⚠️ No Changeset found

Latest commit: 22dafc1

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Sep 21, 2020

Size Analysis Report

Affected Products

@firebase/auth-exp

  • browserPopupRedirectResolver

    Size

    Type Base (93fa5ff) Head (bc04cf1) Diff
    size 54.8 kB 54.8 kB +77 B (+0.1%)
    size_with_ext_deps 65.5 kB 65.6 kB +78 B (+0.1%)
  • getAuth

    Size

    Type Base (93fa5ff) Head (bc04cf1) Diff
    size 60.5 kB 60.6 kB +77 B (+0.1%)
    size_with_ext_deps 72.8 kB 72.8 kB +78 B (+0.1%)

Test Logs

it('errors with invalid event if everything is null', async () => {
const manager = (await resolver._initialize(auth)) as AuthEventManager;
sinon.stub(manager, 'onEvent').returns(true);
expect(() => onIframeMessage(null as unknown as GapiAuthEvent)).to.throw(FirebaseError, 'auth/invalid-auth-event');
Copy link
Contributor

Choose a reason for hiding this comment

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

your line length runneth over

@avolkovi avolkovi assigned sam-gc and unassigned avolkovi Sep 24, 2020
@sam-gc sam-gc merged commit deb2f7b into auth-next Sep 25, 2020
@sam-gc sam-gc deleted the samgho/null-events branch September 25, 2020 17:41
sam-gc added a commit that referenced this pull request Sep 29, 2020
* Add handling of null auth events

* Formatting
avolkovi pushed a commit that referenced this pull request Sep 30, 2020
* Add handling of null auth events

* Formatting
sam-gc added a commit that referenced this pull request Oct 1, 2020
* Initial submit of auth-next framework (#2851)

Initial package structure--copied from packages/template, but with tests working

* Add mock fetch helper (#2878)

Add mock fetch library for tests

* Add core types & error map to auth-exp (#2890)

* Add core types & error map

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* User should be an interface for now

we can make an implementation class later

* Add signUp API method for auth-next (#2892)

* User should be an interface for now

we can make an implementation class later

* Add API call to signUp

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* Update tests to test a little more

* [AUTOMATED]: Prettier Code Styling

* Add initial user object implementation (#2896)

* Initial user object implementation

* Consolidate mock auth object, add user object (#2906)

* Consolidate mock auth / add user test helper

* [AUTOMATED]: Prettier Code Styling

* Fix tests

* Add remaining API methods to auth-next (#2901)

* User should be an interface for now

we can make an implementation class later

* Add API call to signUp

* [AUTOMATED]: Prettier Code Styling

* Update tests to test a little more

* Add remaining API methods to auth-next

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* Add more tests to account API methods

* Pass in SDK version & correctly send GET request params

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: Prettier Code Styling

* Fix import ordering

* Minor formatting change

* [AUTOMATED]: Prettier Code Styling

* Add support for API timeouts to auth-next (#2915)

* Add support for API timeouts to auth-next

* PR feedback

* [AUTOMATED]: Prettier Code Styling

* Add version helpers to auth-next (#2910)

* Add version helper to auth-next

* [AUTOMATED]: Prettier Code Styling

* PR feedback

* Add persistence layer: index db, in memory, and browser{local, session} (#2908)

* Add fetchSignInMethodsForEmail to auth-next (#2924)

* Add fetchSignInMethodsForEmail to auth-next

* [AUTOMATED]: Prettier Code Styling

* PR Feedback

* [AUTOMATED]: Prettier Code Styling

* Add sendEmailVerification to auth-next (#2926)

* Add sendEmailVerification to auth-next

* [AUTOMATED]: Prettier Code Styling

* Add missing test

* Remove GetOobCodeRequestType in favor of Operation

* Add a persistence manager class (#2925)

* Added react native build target (#2947)

* Add password reset methods to auth-next (#2928)

* Add sendEmailVerification to auth-next

* [AUTOMATED]: Prettier Code Styling

* Remove GetOobCodeRequestType in favor of Operation

* Add password reset methods to auth-next

* [AUTOMATED]: Prettier Code Styling

* PR Feedback

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: Prettier Code Styling

* Resolve merge conflicts

* [AUTOMATED]: Prettier Code Styling

* use queryString helper in auth-next (#2936)

* Use queryString from firebase/util instead of homebrew one

* [AUTOMATED]: Prettier Code Styling

* PR Feedback

* [AUTOMATED]: Prettier Code Styling

* Initial auth object implementation + initializeAuth() (#2932)

* use app-exp in the build:deps script

* Add conditional delays to auth-next (#2934)

* Add conditional delays to auth-next

* [AUTOMATED]: Prettier Code Styling

* Use typescript asserts keyword for typesafe assertions

* [AUTOMATED]: Prettier Code Styling

* Rebase conflicts & PR feedback

* More PR Feedback

* Strip debug asserts from prod builds

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: API Reports

* Fix logic in assertion

* Revert merge artifacts

* PR Feedback

* Add sendSignInWithEmail to auth-next (#2960)

* Add sendSignInWithEmail links

* [AUTOMATED]: Prettier Code Styling

* PR Feedback

* PR Feedback

* Add auth listener implementation, add user.reload() (#2961)

* Standardize auth-next style (#2983)

* Standardize auth-next style

- prefix directory for test blocks
- use kebab style for test values to make them visually distinct from
keys
- use '#' to prefix instance methods and '.' for class methods
- prefix all private exported methods with '_'

* [AUTOMATED]: Prettier Code Styling

* Two more cases I missed

* Add refresh token endpoint + implementation to token manager (#2975)

* Add react native persistence class (#2955)

Added React Native persistence class

* Add getIdTokenResult implementation (#3014)

* Update internal types to work with external types (#3075)

* Update internal types to work with external types

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* PR feedback

* [AUTOMATED]: Prettier Code Styling

* Further refactoring of auth types. Add public exports to src/index.ts (#3078)

* Further refactoring of auth types. Add public exports to src/index.ts

* Add app-exp to devDependencies

* PR feedback

* user.delete() implementation (#3072)

* user.delete() implementation

* [AUTOMATED]: Prettier Code Styling

* PR feedback

* PR feedback

* Use auth impl object instead of mock auth object (#3098)

* Add signInWithCredential to auth-next (#2963)

* Add signInWithCredential to auth-next

* [AUTOMATED]: Prettier Code Styling

* Add conditional delays to auth-next (#2934)

* Add conditional delays to auth-next

* [AUTOMATED]: Prettier Code Styling

* Use typescript asserts keyword for typesafe assertions

* [AUTOMATED]: Prettier Code Styling

* Rebase conflicts & PR feedback

* More PR Feedback

* Strip debug asserts from prod builds

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: API Reports

* Fix logic in assertion

* Revert merge artifacts

* PR Feedback

* Cleanup & PR Feedback

* [AUTOMATED]: Prettier Code Styling

* [AUTOMATED]: License Headers

* Add more tests

* [AUTOMATED]: Prettier Code Styling

* Rebase conflicts

* Cleanup type exports

* PR feedback

* Declare abstract class abstractly

* Refactor so every unit test gets its own Auth object (#3129)

* Refactor so every unit test gets its own Auth object

* PR feedback

* Formatting

* Add updateProfile, updateEmail, updatePassword (#3122)

* Profile management

* Add updateProfile, updateEmail, updatePassword

* Fixing up tests

* Update tests further

* Add re-exports for public functions

* Fix up authCredential types to use public versions

* Formatting

* Code cleanup

* Formatting

* PR feedback

* Formatting

* Add recaptcha implementation (#3166)

* Add recaptcha

* Formatting

* Export in index.ts

* Address PR feedback, add a test helper for stubbing timeouts

* Formatting

* Add signInWithPhoneNumber implementation (#3191)

* Add signInWithPhoneNumber flow

* Formatting

* PR feedback

* Formatting

* Add signInAnonymously to auth-next (#2986)

* Add signInWithCredential to auth-next

* Add signInAnonymously to auth-next

* [AUTOMATED]: Prettier Code Styling

* Add more tests

* Move these back into providers

* One more rebase

* Add signInWithCustomToken implementation (#3136)

* Add signInWithCustomToken

* Add re-export in index.ts

* Formatting

* Formatting

* add signInWithEmailAndPassword & signInWithEmailLink to auth-next (#3209)

* Cleanup credential inheritance tree

* Add signInWithEmailAndPassword and signInWithEmailLink to auth-next

* j/k phone credential/provider are actually public

* Add tests

* PR feedback

* Add linkWithCredential(), linkWithPhoneNumber(), unlink() (#3213)

* Add unlink(), linkWithCredential(), linkWithPhoneNumber()

* Formatting

* Formatting

* PR feedback

* Formatting

* Add export to index.ts

* Formatting

* Add createUserWithEmailAndPassword to auth-next (#3212)

* Add createUserWithEmailAndPassword to auth-next

* PR feedback

* Cleanup public types in auth-next (#3217)

* Cleanup public types in auth-next

* PR feedback

* Add a demo page to auth-exp using the new modular methods (#3197)

* Add basic demo for new SDK

* Formatting

* Add anonymous auth and custom token

* Formatting

* Update to include newly-implemented pieces

* Formatting

* Add custom email flow methods to auth-next (#3223)

* Add reauthenticateWithCredential, reauthenticateWithPhoneNumber (#3225)

* Add link and reauth implementation to email credential (#3226)

* Add linking and reauth to email credential

* Formatting

* Add tests for new api method

* Formatting

* Add AdditionalUserInfo class to auth-exp (#2979)

Add AdditionalUserInfo

* Big refactor of reauth / link + basic idp tasks (#3242)

* Big refactor of reauth / link + basic idp tasks

* PR feedback

* Formatting

* Add useDeviceLanguage to auth-next (#3273)

* Fix broken build (#3275)

* Fix some stuff

* Formatting

* fixed scott's broken test cases. Stupid scott

Co-authored-by: Scott Crossen <[email protected]>

* Address (some) of the tree shaking issues w/ ReCaptcha (#3277)

* Address (some) of the recaptcha tree-shaking issues

* Formatting

* Add gapi and iframe loading libraries (#3334)

* Add popup util and bare-bones OAuthProvider (#3335)

* First pass at adding MFA support to auth-next (#3292)

* First pass at adding MFA support to auth-next

* Refactor IDP & reauth interfaces a bit to play nicer with MFA

* PR feedback

* More tests & interface cleanup

* One last test

* More PR Feedbakc

* Tree shakeable persistence (#3288)

* Make the persistence objects tree-shakeable

* Formatting

* Updated to stop using casts everywhere

* Formatting

* Make the browser impls tree shakeable

* Formatting

* Fix the react native implementation in auth-compat-exp

* Formatting

* Make the react native class wrapped in a closure, to avoid the prototype nonsense

* Formatting

* Fix index.rn.ts

* Formatting

* PR feedback

* Fix ordering in index.ts

* Formatting

* Fix test

* Formatting

* Make the _getInstance() instantiator a util for the whole SDK (#3369)

* Make the _getInstance() instantiator a util for the whole SDK

* PR feedback, added some debugAsserts

* Formatting

* Add browser popup resolver class, some utils (#3336)

* Add auth event manager and popup_redirect browser implementation

* Add browser popup implementation, some utils

* Formatting

* PR feedback

* Formatting

* Fix failing tests

* formatting

* Merge conflict

* Cleanup demo code & get it working with MFA flows (#3380)

- lint the demo
- fix some error handling code
- fix verifyPhoneNumber when called with MFA context
- add to/fromJSON to EmailAuthCredential

* Add updatePhoneNumber to auth-next (#3392)

* Add verifyBeforeUpdate to auth-next (#3391)

* Add verifyBeforeUpdate to auth-next

Also add a couple edge cases that I missed first pass around

* Export verifyBeforeUpdateEmail

* Add popup strategy implementation, (sign in, link, reauth) (#3363)

* Popup strategy implementation

* Popup strategy + tests

* Formatting

* Updated comment

* Fix IdpTask types

* Refactor popup code to have abstract base

* WIP

* Early feedback

* Feedback, tests

* Formatting

* Formatting

* Formatting

* Update the auth event manager to handle redirects. Add redirect logic to popupredirectresolver (#3409)

* Update event manager and abstract popup redirect operation to handle redirect events

* Missing popup_redirect update

* Tests

* Formatting

* PR feedback

* Formatting

* Populate enrolled factors on reload() (#3406)

* Add persistence for redirect users (#3410)

* Updates to auth for persistence redirect user

* Add tests for persistence

* Formatting

* Removing erroneous console.logs

* Formatting

* Updates to the auth init flow

* Formatting

* Fix typo

* Formatting

* Rogue console.logwq

* Formatting

* PR feedback

* Formatting

* Web worker support for auth-next (#3413)

* Web worker support for auth-next

* PR feedback

* Cleanup build tree a bit

* Add redirect strategy (#3416)

* Redirect strategy

* Redirect strategy updates & test

* Formatting

* Moving the ts files in demo/ to 'broken' since they cause 'yarn test' to break and Alex is unavailable this week

* Add auth isolation for oauth flows (#3420)

* Add auth isolation for oauth flows

* Formatting

* Fix bug

* Formatting

* PR feedback

* Formatting

* Move all of our helper files in test/ to a new directory test/helpers/ (#3452)

* Move all of our helper files in test/ to a new directory test/helpers/

* Formatting

* Foundation for integration tests for auth-exp (#3453)

* Add integration test foundation

* Formatting

* Update to use a describe wrapper instead

* Formatting

* PR feedback

* Removed custom describe

* Formatting

* Add integration tests for anonymous auth (#3455)

* added a suite of anonymous auth integration tests

* Updated to use new structure

* Formatting

* PR feedback

* Formatting

* Update the integration testing structure to have a new auth every test (#3457)

* Fix integration tests to not be so clever

* Formatting

* Add integration tests for email flow (#3462)

* Add email integration tests

* Formatting

* PR feedback

* Formatting

* Add integration tests for phone, plus address some issues caught by them (#3478)

* Phone integration tests (plus some bugs that it caught)

* Formatting

* PR feedback

* Formatting

* Refactor the way UserCredentials work in anticipation of mudularization (#3489)

* Refactor the way UserCredentials work in anticipation of mudularization

* Formatting

* PR feedback

* Linter fixes

* Formatting

* First pass at service workers for auth-next (#3434)

* Fix broken integration tests (#3503)

* Add a standard OAuthCredential and a GoogleAuthProvider (#3498)

* Add a standard OAuthCredential and a GoogleAuthProvider

* Formatting

* Signature updates

* Formatting

* Update w/ demo

* PR feedback plus a bugfix

* Formatting

* Add the remaining oauth providers (#3500)

* Add the rest of the OAuth providers

* Formatting

* Add to demo

* Handle some edge cases in responses from the server (#3509)

* Add error handling for account-exists-with-different-credentials edgecase

* Tests

* Formatting

* First pass at polyfill (#3517)

* First pass at polyfill

* PR Feedback

* Copy demo code over to auth-compat-layer, fix our build scripts (#3563)

* Copy demo code over to auth-compat-layer, fix our build scripts

* Add more functionality to compat layer

* PR Feedback

* PR Feedback

* Fix more edge cases around auth-compat-exp polyfill (auth-next) (#3567)

* Further refactoring of auth types. Add public exports to src/index.ts (#3078)

* Further refactoring of auth types. Add public exports to src/index.ts

* Add app-exp to devDependencies

* PR feedback

* Fix more edge cases around auth-compat-exp polyfill

* Add uglified polyfill build for size comparison

* PR feedback

* Set ClientPlatform correctily in auth-exp and auth-compat-exp

Co-authored-by: Sam Horlbeck Olsen <[email protected]>

* Add platform specific persistence validation to auth-compat-exp (#3593)

* Add an assertTypes utility (#3578)

* Add assertTypes util

* Add assertTypes function

* Refactor project structure to support node (#3579)

* Expose additionalUserInfo in auth-exp and auth-compat-exp (#3595)

* Clean up our to/from JSON implementations (#3606)

* Clean up our to/from JSON implementations

- Remove anonymous credential/provider since they're not exposed and
don't do anything
- rename toPlainObject on User to toJSON per API spec
- relax restrictions around ProviderId & SignInMethod typing since they
 can sometimes have values outside of our enum

* PR feedback and more cleanup

* Rejigger our error type checking to allow app-less errors

* PR feedback

* Register auth with the app component. Add the getAuth() methods for each platform (#3637)

* Register auth with the app component. Add the getAuth() methods for each platform

* Add getAuth for webworker build

* Formatting

* Make firebase auth implement _FirebaseService interface

* Formatting

* Fix tests

* Formatting

* PR feedback

* Formatting

* PR feedback

* Formatting

* Add the internal auth interface including proactive refresh (#3655)

* Proactive refresh and internal SDK

* Fix tests for node

* Formatting

* Remove unused file

* PR feedback

* Formatting

* Implement cross-window browser events for auth-next (#3631)

* Implement cross-window browser events for auth-next

* Split out local & session storage

* Add persistence events to indexed DB

* Add some tests & fix a couple issues with local storage events

* Add tests for AuthImpl._onStorageEvent and fix getIdToken to trigger
correctly

* Merge conflicts

* PR feedback

* Auth next build  (#3654)

* update package.json

* make internal and main share code

* remove unused deps and files

* point to the right typing file for internal

* cast internal Auth to public Auth to make TS happy

* yarn.lock

* Fix the broken build. (#3717)

* Fix the broken build

* Formatting

* Fix compat build

* Re-add demo

* Fix build errors

* Formatting

* Fix linting for auth-compat-exp

* Add hooks into auth-next for emulator config (#3716)

* Add hooks into emulator for auth-next

* Formatting

* PR feedback

* Fix broken tests

* Formatting

* Add assertions for type of OAuthProvider in popup/redirect (#3720)

* Add assertion for the oauthprovider type in popup/redirect

* Formatting

* Remove circular dependency issue with AuthCredential (#3718)

* Fix circular dependency issue

* Formatting

* Add origin validation to popup/redirect flows (#3730)

* Add origin validation to the popup/redirect flows

* Formatting

* Cache the origin validation promise

* Formatting

* PR feedback

* Formatting

* Put some guardrails around the recaptcha host language param (#3734)

* Add some guardrails for recaptcha host language param

* Formatting

* Prepare auth-next for merging to master (#3740)

* suppress eslint error

* fix type error

* make auth-compat depend on app-compat

* add release build for auth-exp

* revert auth-compat to depend on app

* test

* don't abort on error for release builds

* apply release build to web worker build

* Revert "test"

This reverts commit 8be511c.

* fix lint error

* Finish off the emulator hooks (#3732)

* Finish emulator implementation

* Formatting

* Add appVerificationDisabledForTesting setting and the type to auth-types-exp

* Formatting

* Add network timeout cancellation to the core network code (#3771)

* Add network timeout cancellation to core network code

* Formatting

* Fix broken test on CI

* Formatting

* Fix failing auth compat tests (#3783)

* Fix the auth compat 'tests'

* Formatting

* Fix integration test

* Formatting

* Fix the phone integration test

* Clear the redirect user on signout (#3784)

* Clear redirect user upon signOut

* Formatting

* Fix issue in node

* Formatting

* Add user invalidation handling (#3804)

* Add user invalidation handling

* Formatting

* Add a cache layer to the event manager (#3808)

* Add caching of events to event manager

* Formatting

* Fix tests

* Formatting

* Handle null auth events from the iframe (#3818)

* Add handling of null auth events

* Formatting

* Add web storage support check to popup actions (#3823)

* Add web storage check to popup actions

* Formatting

* Update package.json

* Fix gapi linter issue

* Update auth-next deps before merging to master (#3809)

* update dep version

* update yarn lock

* Ignore phone integration test in catch-all yarn:test

Co-authored-by: Alex Volkovitsky <[email protected]>
Co-authored-by: Feiyang1 <[email protected]>
Co-authored-by: Scott Crossen <[email protected]>
Co-authored-by: Feiyang <[email protected]>
@firebase firebase locked and limited conversation to collaborators Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants