Merge pull request #8137 from turbo124/v5-develop

Fix for data leak on products route when using the ?with filter
This commit is contained in:
David Bomba 2023-01-12 13:42:13 +11:00 committed by GitHub
commit c4058c502e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 10 additions and 12 deletions

View File

@ -1 +1 @@
5.5.53
5.5.54

View File

@ -306,7 +306,7 @@ class CreateSingleAccount extends Command
$webhook_config = [
'post_purchase_url' => 'http://ninja.test:8000/api/admin/plan',
'post_purchase_rest_method' => 'POST',
'post_purchase_rest_method' => 'post',
'post_purchase_headers' => [config('ninja.ninja_hosted_header') => config('ninja.ninja_hosted_secret')],
];

View File

@ -251,6 +251,7 @@ abstract class QueryFilters
{
return $this->builder
->orWhere($this->with_property, $value)
->orderByRaw("{$this->with_property} = ? DESC", [$value]);
->orderByRaw("{$this->with_property} = ? DESC", [$value])
->company();
}
}

View File

@ -239,11 +239,6 @@ class SubscriptionService
->where('status_id', Invoice::STATUS_PAID)
->first();
if($last_invoice)
nlog($last_invoice->toArray());
else
nlog("no invoice found");
$refund = $this->calculateProRataRefundForSubscription($last_invoice);
if($use_credit_setting != 'off')
@ -340,7 +335,7 @@ else
*/
private function calculateProRataRefundForSubscription($invoice) :float
{
if(!$invoice || !$invoice->date)
if(!$invoice || !$invoice->date || $invoice->status_id != Invoice::STATUS_PAID)
return 0;
$start_date = Carbon::parse($invoice->date);
@ -486,7 +481,7 @@ else
->where('client_id', $recurring_invoice->client_id)
->where('is_proforma',0)
->where('is_deleted', 0)
->where('status_id', Invoice::STATUS_PAID)
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID])
->withTrashed()
->orderBy('id', 'desc')
->first();
@ -626,6 +621,7 @@ else
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
->where('client_id', $recurring_invoice->client_id)
->where('is_proforma',0)
->where('is_deleted', 0)
->withTrashed()
->orderBy('id', 'desc')
@ -673,6 +669,7 @@ else
$last_invoice = Invoice::where('subscription_id', $recurring_invoice->subscription_id)
->where('client_id', $recurring_invoice->client_id)
->where('is_deleted', 0)
->where('is_proforma',0)
->withTrashed()
->orderBy('id', 'desc')
->first();

View File

@ -14,8 +14,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => '5.5.53',
'app_tag' => '5.5.53',
'app_version' => '5.5.54',
'app_tag' => '5.5.54',
'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', ''),