vhs / nomos

Membership management system made VHS-centric
25 stars 7 forks source link

Expansion of arguments sometimes fails due to misalignment #258

Open TyIsI opened 6 years ago

TyIsI commented 6 years ago

During the Vagrant setup process, the webhook privilege gets created by call of services/web/PrivilegeService1.svc/CreatePrivilege. On line 85, in public function CreatePrivilege($name, $code, $description, $icon, $enabled), there's a call to Privilege::findByCode($code).

app/services/PrivilegeService.php:

84:    public function CreatePrivilege($name, $code, $description, $icon, $enabled) {
85:        $privs = Privilege::findByCode($code);

app/domain/Privilege.php:

35:    public static function findByCode($code) {
36:        if (!self::checkCodeAccess(...$code))

The checkCodeAccess call tries to unpack $code argument, which it can only successfully do if the argument is an array or otherwise a Traversable object. This results in the following error:

<b>Warning</b>:  Only arrays and Traversables can be unpacked in <b>/vagrant/app/domain/Privilege.php</b> on line <b>36</b><br />

There are other services that use the same call and might be susceptible to the same issue.

Note: this does not impact production.