From 27649d9919fa612b644529cb0eee12c12075cab2 Mon Sep 17 00:00:00 2001 From: Nico Cross Date: Tue, 30 Jul 2019 16:16:58 +0700 Subject: [PATCH] Crash example app on user creation Add accounts-password and bcrypt (native) Add feature to call Accounts#createUser on click --- .gitignore | 1 + README.md | 31 + .../app-with-native-dependencies.dockerfile | 2 +- example/app/.meteor/packages | 3 +- example/app/.meteor/versions | 21 +- example/app/client/main.html | 5 +- example/app/client/main.js | 23 +- example/app/package-lock.json | 796 ++++++++++++++---- example/app/package.json | 1 + example/app/server/main.js | 19 +- example/default.dockerfile | 2 +- example/docker-compose.yml | 3 +- img/snapshot.png | Bin 0 -> 189491 bytes 13 files changed, 724 insertions(+), 183 deletions(-) create mode 100644 .gitignore create mode 100644 img/snapshot.png diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9f11b75 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ diff --git a/README.md b/README.md index 0aa884d..846e7d6 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,34 @@ +# DEMO ONLY + +This is a fork for bug demonstration only. + +Application silently crashes when Accounts#createUser is called. + +Manual debugging shows that Meteor's Future fails to resolve result from previously called `bcrypt.hash` function. See line 90 at [debugger snapshot](img/snapshot.png). + +![Debugger snapshot](img/snapshot.png) + +Steps to reproduce: + +1. Run `docker-compose up --build -d` from `/example` directory. Note that app can start too early to connect to MongoDB with success, so just restart its container if app hangs up. +2. Open [app root](http://localhost) in the browser. +3. Click on the "Recreate user" button. + +That's it. App successfully crashed. 😊 + +Crashed container log does not contain line: +``` +---> user created with id: +``` + +You can debug this app's server code by adding `debugger` word where you need a breakpoint. +Also see [breakpoint](example/app/server/main.js) at line 12 used to make [snapshot](img/snapshot.png). + +You can patch this bug by `meteor npm uninstall bcrypt` command. +Thus Meteor will use pure JS bcrypt instead of native C++ version. + +It seems that the build pipeline of the base Docker image was broken somewhere. + # Base Docker Image for Meteor Apps This repo contains a base Docker image for use by [Meteor](https://www.meteor.com/) apps built using a [multistage Dockerfile](https://docs.docker.com/develop/develop-images/multistage-build/). You might want to use this base because: diff --git a/example/app-with-native-dependencies.dockerfile b/example/app-with-native-dependencies.dockerfile index f111c6d..dc2c723 100644 --- a/example/app-with-native-dependencies.dockerfile +++ b/example/app-with-native-dependencies.dockerfile @@ -40,4 +40,4 @@ RUN bash $SCRIPTS_FOLDER/build-meteor-npm-dependencies.sh \ # Start app ENTRYPOINT ["/docker/entrypoint.sh"] -CMD ["node", "main.js"] +CMD ["node", "--inspect=0.0.0.0:9229", "main.js"] diff --git a/example/app/.meteor/packages b/example/app/.meteor/packages index 81ab866..d8f3d5d 100644 --- a/example/app/.meteor/packages +++ b/example/app/.meteor/packages @@ -19,4 +19,5 @@ shell-server@0.4.0 # Server-side component of the `meteor shell` comm autopublish@1.0.7 # Publish all data to the clients (for prototyping) insecure@1.0.7 # Allow all DB writes from clients (for prototyping) -underscore@1.0.10 +accounts-password@1.5.1 +accounts-ui@1.3.1 diff --git a/example/app/.meteor/versions b/example/app/.meteor/versions index e8551c5..a007be9 100644 --- a/example/app/.meteor/versions +++ b/example/app/.meteor/versions @@ -1,9 +1,13 @@ +accounts-base@1.4.4 +accounts-password@1.5.1 +accounts-ui@1.3.1 +accounts-ui-unstyled@1.4.2 allow-deny@1.1.0 autopublish@1.0.7 autoupdate@1.6.0 babel-compiler@7.3.4 babel-runtime@1.3.0 -base64@1.0.11 +base64@1.0.12 binary-heap@1.0.11 blaze@2.3.3 blaze-html-templates@1.1.2 @@ -16,6 +20,7 @@ check@1.3.1 ddp@1.4.0 ddp-client@2.3.3 ddp-common@1.4.0 +ddp-rate-limiter@1.0.7 ddp-server@2.3.0 deps@1.0.12 diff-sequence@1.1.1 @@ -25,6 +30,7 @@ ecmascript-runtime@0.7.0 ecmascript-runtime-client@0.8.0 ecmascript-runtime-server@0.7.1 ejson@1.1.0 +email@1.2.3 es5-shim@4.8.0 fetch@0.1.1 geojson-utils@1.0.10 @@ -36,7 +42,9 @@ insecure@1.0.7 inter-process-messaging@0.1.0 jquery@1.11.11 launch-screen@1.1.1 +less@2.8.0 livedata@1.0.18 +localstorage@1.2.0 logging@1.1.20 meteor@1.9.3 meteor-base@1.4.0 @@ -48,23 +56,30 @@ mobile-status-bar@1.0.14 modern-browsers@0.1.4 modules@0.13.0 modules-runtime@0.10.3 -mongo@1.6.2 +mongo@1.6.3 mongo-decimal@0.1.1 mongo-dev-server@1.1.0 mongo-id@1.0.7 +npm-bcrypt@0.9.3 npm-mongo@3.1.2 observe-sequence@1.0.16 ordered-dict@1.1.0 promise@0.11.2 random@1.1.0 +rate-limit@1.0.9 +reactive-dict@1.3.0 reactive-var@1.0.11 reload@1.3.0 retry@1.1.0 routepolicy@1.1.0 +service-configuration@1.0.11 +session@1.2.0 +sha@1.0.9 shell-server@0.4.0 socket-stream-client@0.2.2 spacebars@1.0.15 spacebars-compiler@1.1.3 +srp@1.0.12 standard-minifier-css@1.5.3 standard-minifier-js@2.4.1 templating@1.3.2 @@ -74,5 +89,5 @@ templating-tools@1.1.2 tracker@1.2.0 ui@1.0.13 underscore@1.0.10 -webapp@1.7.3 +webapp@1.7.4 webapp-hashing@1.0.9 diff --git a/example/app/client/main.html b/example/app/client/main.html index 01ba6bf..79dcfe6 100644 --- a/example/app/client/main.html +++ b/example/app/client/main.html @@ -3,6 +3,8 @@ +{{> loginButtons}} +

Welcome to Meteor!

{{> hello}} @@ -10,8 +12,7 @@

Welcome to Meteor!