Update safe params and billboard cache config (#20530)

This commit is contained in:
Ben Halpern 2024-01-16 12:13:29 -05:00 committed by GitHub
parent 5c69c9fa2b
commit 5c2723a04e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -1,7 +1,7 @@
class BillboardsController < ApplicationController
before_action :set_cache_control_headers, only: %i[show], unless: -> { current_user }
include BillboardHelper
CACHE_EXPIRY_FOR_BILLBOARDS = 15.minutes.to_i.freeze
CACHE_EXPIRY_FOR_BILLBOARDS = 3.minutes.to_i.freeze
RANDOM_USER_TAG_RANGE_MIN = 5
RANDOM_USER_TAG_RANGE_MAX = 32

View file

@ -2,6 +2,6 @@ import querystring;
sub vcl_recv {
# return this URL with only the parameters that match this regular expression
if (req.url !~ "/admin/" && req.url !~ "/search/" && req.url !~ "/bulk_show") {
set req.url = querystring.regfilter_except(req.url, "^(a_id|args|article_id|article_ids|articles|asc|callback_url|category|client_id|code|collection_id|commentable_id|commentable_type|confirmation_token|created_at|end|email|filter|followable_id|followable_type|forem_owner_secret|fork_id|i|key|message_offset|name|oauth_token|oauth_verifier|offset|onboarding|org_id|organization_id|p|page|per_page|p_id|placement_area|prefill|preview|purchaser|q|reactable_ids|redirect_uri|reported_url|reporter_username|response_type|scope|search|signature|sort|source_id|source_type|start|state|status|tag|tag_list|top|type_of|url|username|invitation_token|reset_password_token|ut|verb|invitation_slug|period|comments_sort|billboard|controller_action|bb_test_placement_area|bb_test_id)$");
set req.url = querystring.regfilter_except(req.url, "^(a_id|args|article_id|article_ids|articles|asc|callback_url|category|client_id|code|collection_id|commentable_id|commentable_type|confirmation_token|created_at|end|email|filter|followable_id|followable_type|forem_owner_secret|fork_id|i|key|message_offset|name|oauth_token|oauth_verifier|offset|onboarding|org_id|organization_id|p|page|per_page|p_id|placement_area|prefill|preview|purchaser|q|reactable_ids|redirect_uri|reported_url|reporter_username|response_type|scope|search|signature|sort|source_id|source_type|start|state|status|tag|tag_list|top|type_of|url|username|invitation_token|reset_password_token|ut|verb|invitation_slug|period|comments_sort|billboard|controller_action|bb_test_placement_area|cookies_allowed|bb_test_id)$");
}
}

View file

@ -4,7 +4,7 @@ RSpec.describe "Billboards" do
let(:user) { create(:user) }
let(:article) { create(:article, user: user) }
let(:max_age) { 15.minutes.to_i }
let(:max_age) { 3.minutes.to_i }
let(:stale_if_error) { 26_400 }
def create_billboard(**options)