discourse/spec/lib/onebox/engine/coub_onebox_spec.rb
Blake Erickson 2ddb27cf9c
SECURITY: Restrict allowed URL patterns
Restrict allowed URL patterns for oneboxes.
2025-02-04 13:35:02 -03:00

16 lines
496 B
Ruby

# frozen_string_literal: true
RSpec.describe Onebox::Engine::CoubOnebox do
describe ".matches_regexp" do
it "matches valid coub URL" do
valid_url = URI("https://coub.com/view/12345")
expect(described_class === valid_url).to eq(true)
end
it "does not match malicious URL with valid domain as part of another domain" do
malicious_url = URI("https://coub.com.malicious.com/view/12345")
expect(described_class === malicious_url).to eq(false)
end
end
end