You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to run Enlightn in a multitenancy setup. I'm using the laravel-multitenancy package from Spatie. Some checks just don't seem to work with this kind of setup.
Steps to Reproduce
Nothing special. Just set up a Laravel app with the multitenancy package as per documentation.
Expected behavior:
For all the checks to work I guess 😇 Although I don't really expect this to work out of the box. For example Invoker has a feature where you can define some preload code. So the expected behavior would probably be some way to configure this.
Actual behavior:
When I run Enlightn some checks just throw an exception with Target class [currentTenant] does not exist. In the OSS version of Enlightn the following checks don't work:
Session Driver Analyzer
CSRF Analyzer
Encrypted Cookies Analyzer
HTTP Only Cookie Analyzer
The text was updated successfully, but these errors were encountered:
Hi @RobertCordes, after reading through the docs of the Multitenancy package, I reckon you may be calling app('currentTenant') in some of the config files or middleware. So, you may need to set the current tenant before Enlightn runs its checks, so that the config is set accordingly.
Can you check if adding the following code to your AppServiceProvider's register method works?
useEnlightn\Enlightn\Inspection\Inspector;
$this->app->afterResolving(Inspector::class, function ($inspector) {
// Add preload code to set current tenant here
});
If this does work, then I can make a PR to provide a more elegant way of doing this using a callback like:
Enlightn::beforeRunning(function () {
// Preload code here
});
Versions
Description
Hi, I'm trying to run Enlightn in a multitenancy setup. I'm using the laravel-multitenancy package from Spatie. Some checks just don't seem to work with this kind of setup.
Steps to Reproduce
Nothing special. Just set up a Laravel app with the multitenancy package as per documentation.
Expected behavior:
For all the checks to work I guess 😇 Although I don't really expect this to work out of the box. For example Invoker has a feature where you can define some preload code. So the expected behavior would probably be some way to configure this.
Actual behavior:
When I run Enlightn some checks just throw an exception with
Target class [currentTenant] does not exist
. In the OSS version of Enlightn the following checks don't work:The text was updated successfully, but these errors were encountered: