Merge commit from fork
* Fix GHSA-7jvv-fhmg-wpfw * Fix GHSA-hx34-2pfw-2qfj * Fix GHSA-vwhj-3g83-v276 * Bump version to v4.6.4
This commit is contained in:
1 parent
90553a2f33
commit
5d7e3bbd17
11 files changed
+67
-19
No files matched your search
@@ -14,7 +14,7 @@ module Admin
|
||||
end
|
||||
|
||||
def show
|
||||
authorize @collection, :show?
|
||||
authorize [:admin, @collection], :show?
|
||||
end
|
||||
|
||||
def batch
|
||||
|
||||
@@ -17,9 +17,9 @@ class Api::V1::Admin::MeasuresController < Api::BaseController
|
||||
|
||||
def set_measures
|
||||
@measures = Admin::Metrics::Measure.retrieve(
|
||||
params[:keys],
|
||||
params[:start_at],
|
||||
params[:end_at],
|
||||
params.require(:keys),
|
||||
params.require(:start_at),
|
||||
params.require(:end_at),
|
||||
params
|
||||
)
|
||||
end
|
||||
|
||||
@@ -4,22 +4,22 @@ class Api::V1::Admin::RetentionController < Api::BaseController
|
||||
include Authorization
|
||||
|
||||
before_action -> { authorize_if_got_token! :'admin:read' }
|
||||
before_action :set_cohorts
|
||||
before_action :set_retention
|
||||
|
||||
after_action :verify_authorized
|
||||
|
||||
def create
|
||||
authorize :dashboard, :index?
|
||||
render json: @cohorts, each_serializer: REST::Admin::CohortSerializer
|
||||
render json: @retention.cohorts, each_serializer: REST::Admin::CohortSerializer
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def set_cohorts
|
||||
@cohorts = Admin::Metrics::Retention.new(
|
||||
params[:start_at],
|
||||
params[:end_at],
|
||||
def set_retention
|
||||
@retention = Admin::Metrics::Retention.new(
|
||||
params.require(:start_at),
|
||||
params.require(:end_at),
|
||||
params[:frequency]
|
||||
).cohorts
|
||||
)
|
||||
end
|
||||
end
|
||||
@@ -17,6 +17,8 @@ class Admin::Metrics::Dimension::BaseDimension
|
||||
@limit = limit&.to_i
|
||||
@params = params
|
||||
@loaded = false
|
||||
|
||||
@start_at = [@start_at, @end_at - 2.years].max if @start_at.present? && @end_at.present?
|
||||
end
|
||||
|
||||
def key
|
||||
|
||||
@@ -12,10 +12,12 @@ class Admin::Metrics::Measure::BaseMeasure
|
||||
alias loaded? loaded
|
||||
|
||||
def initialize(start_at, end_at, params)
|
||||
@start_at = start_at&.to_datetime
|
||||
@end_at = end_at&.to_datetime
|
||||
@start_at = start_at.to_datetime
|
||||
@end_at = end_at.to_datetime
|
||||
@params = params
|
||||
@loaded = false
|
||||
|
||||
@start_at = [@start_at, @end_at - 2.years].max
|
||||
end
|
||||
|
||||
def cache_key
|
||||
|
||||
@@ -16,10 +16,13 @@ class Admin::Metrics::Retention
|
||||
alias loaded? loaded
|
||||
|
||||
def initialize(start_at, end_at, frequency)
|
||||
@start_at = start_at&.to_date
|
||||
@end_at = end_at&.to_date
|
||||
@start_at = start_at.to_date
|
||||
@end_at = end_at.to_date
|
||||
|
||||
@frequency = %w(day month).include?(frequency) ? frequency : 'day'
|
||||
@loaded = false
|
||||
|
||||
@start_at = [@start_at, @end_at - (@frequency == 'day' ? 31.days : 12.months)].max
|
||||
end
|
||||
|
||||
def cache_key
|
||||
|
||||
@@ -34,7 +34,7 @@ module PrivateAddressCheck
|
||||
module_function
|
||||
|
||||
def private_address?(address)
|
||||
address = address.native if address.ipv6? && address.ipv4_mapped?
|
||||
address = address.native if address.ipv6? && (address.ipv4_mapped? || address.ipv4_compat?)
|
||||
address.private? || address.loopback? || address.link_local? || CIDR_LIST.any? { |cidr| cidr.include?(address) }
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user