Skip to content

Commit

Permalink
Fix audit-argument-checks error after login
Browse files Browse the repository at this point in the history
If you successfully subscribed to a publisher, changed user ID, and the
second time running the publisher it failed the audit-argument-checks
test, the error would say "Did not check() all arguments during
publisher 'undefined'" instead of including the correct publisher name.

That's because the "recreate Subscription on setUserId" code forgot to
include the sub's name in the new Subscription (the name field is
literally only used for this error message).

Alluded to in #2092
  • Loading branch information
glasser committed May 24, 2014
1 parent 2c7e71b commit 875274d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/livedata/livedata_server.js
Expand Up @@ -913,6 +913,9 @@ _.extend(Subscription.prototype, {
try {
var res = maybeAuditArgumentChecks(
self._handler, self, EJSON.clone(self._params),
// It's OK that this would look weird for universal subscriptions,
// because they have no arguments so there can never be an
// audit-argument-checks failure.
"publisher '" + self._name + "'");
} catch (e) {
self.error(e);
Expand Down Expand Up @@ -1028,7 +1031,8 @@ _.extend(Subscription.prototype, {
_recreate: function () {
var self = this;
return new Subscription(
self._session, self._handler, self._subscriptionId, self._params);
self._session, self._handler, self._subscriptionId, self._params,
self._name);
},

error: function (error) {
Expand Down

2 comments on commit 875274d

@yuwiggin
Copy link

Choose a reason for hiding this comment

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

I integrated email verification in the sign up process. When the verification url was opened in browser, an exception occurred in the server-side as following:

I20141205-00:13:18.274(8)? Exception from sub moRyCX49pYKjcivYH Error: Did not check() all arguments during publisher 'filteredUsers'
I20141205-00:13:18.274(8)?     at _.extend.throwUnlessAllArgumentsHaveBeenChecked (packages/check/match.js:352)
I20141205-00:13:18.275(8)?     at Object.Match._failIfArgumentsAreNotAllChecked (packages/check/match.js:108)
I20141205-00:13:18.275(8)?     at maybeAuditArgumentChecks (packages/ddp/livedata_server.js:1596)
I20141205-00:13:18.275(8)?     at _.extend._runHandler (packages/ddp/livedata_server.js:943)
I20141205-00:13:18.276(8)?     at _.extend._startSubscription (packages/ddp/livedata_server.js:769)
I20141205-00:13:18.276(8)?     at _.extend.protocol_handlers.sub (packages/ddp/livedata_server.js:582)
I20141205-00:13:18.277(8)?     at packages/ddp/livedata_server.js:546

The following packages was added in my app.

accounts-password                  1.0.4 
alanning:roles                     1.2.13
audit-argument-checks              1.0.1 
email                              1.0.4 
ian:accounts-ui-bootstrap-3        1.1.26
iron:router                        1.0.3 
meteor-platform                    1.2.0 
mizzao:bootstrap-3                 3.3.1 
mrt:accounts-admin-ui-bootstrap-3  0.2.7 
sacha:spin                         2.0.4 
underscore                         1.0.1 

Is it an issue? how to fix it? Thank you for your advice.

@glasser
Copy link
Contributor Author

@glasser glasser commented on 875274d Dec 9, 2014

Choose a reason for hiding this comment

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

This means that the Meteor.publish('filteredUsers') call does not check all its arguments and is thus incompatible with the audit-argument-checks package. You should change it to check all its arguments!

Please sign in to comment.