Skip to content

Add video export functionality for route replay videos#2275

Open
Freika wants to merge 9 commits intodevfrom
spec/route-replay-video
Open

Add video export functionality for route replay videos#2275
Freika wants to merge 9 commits intodevfrom
spec/route-replay-video

Conversation

@Freika
Copy link
Copy Markdown
Owner

@Freika Freika commented Feb 18, 2026

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 33cf076c-4354-4914-af4c-46e24163eef2

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch spec/route-replay-video
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

body = JSON.parse(req.body)
urls = body['callback_urls']
urls.length == 2 &&
urls[0].start_with?('https://app.example.com') &&

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

'
https://app.example.com
' may be followed by an arbitrary host name.

Copilot Autofix

AI about 1 month ago

In general, this kind of issue is fixed by avoiding substring or prefix checks on raw URL strings when what you care about is the hostname. Instead, parse the URL and compare the host (and optionally scheme) against an explicit allowlist, or otherwise assert exact values rather than prefixes that could be extended with arbitrary content.

In this spec, we want to preserve the intent (ensuring that callback URLs use the expected hosts) without relying on start_with?('https://app.example.com'). The safest and clearest approach is: parse each URL with URI.parse, then assert that its scheme and host match the expected values. This keeps the test independent of the rest of the URL (path, query, etc.) but removes the substring-style check on the full URL string. Concretely, in spec/services/video_exports/request_render_spec.rb, lines 134–137 should be updated so that instead of urls[0].start_with?('https://app.example.com') and urls[1].start_with?('https://192.168.1.10'), we parse each URL and check uri.host. To keep requirements minimal, we can rely on Ruby’s standard URI library, adding a require 'uri' at the top of the file if it is not already present in the snippet, and use URI.parse(urls[0]).host == 'app.example.com' and URI.parse(urls[1]).host == '192.168.1.10'. Optionally, we can also assert uri.scheme == 'https' to match the intended protocol.

Suggested changeset 1
spec/services/video_exports/request_render_spec.rb

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/spec/services/video_exports/request_render_spec.rb b/spec/services/video_exports/request_render_spec.rb
--- a/spec/services/video_exports/request_render_spec.rb
+++ b/spec/services/video_exports/request_render_spec.rb
@@ -1,6 +1,7 @@
 # frozen_string_literal: true
 
 require 'rails_helper'
+require 'uri'
 
 RSpec.describe VideoExports::RequestRender do
   let(:user) { create(:user) }
@@ -131,9 +132,11 @@
           .with do |req|
             body = JSON.parse(req.body)
             urls = body['callback_urls']
+            first_uri = URI.parse(urls[0])
+            second_uri = URI.parse(urls[1])
             urls.length == 2 &&
-              urls[0].start_with?('https://app.example.com') &&
-              urls[1].start_with?('https://192.168.1.10')
+              first_uri.scheme == 'https' && first_uri.host == 'app.example.com' &&
+              second_uri.scheme == 'https' && second_uri.host == '192.168.1.10'
           end)
       end
 
EOF
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'rails_helper'
require 'uri'

RSpec.describe VideoExports::RequestRender do
let(:user) { create(:user) }
@@ -131,9 +132,11 @@
.with do |req|
body = JSON.parse(req.body)
urls = body['callback_urls']
first_uri = URI.parse(urls[0])
second_uri = URI.parse(urls[1])
urls.length == 2 &&
urls[0].start_with?('https://app.example.com') &&
urls[1].start_with?('https://192.168.1.10')
first_uri.scheme == 'https' && first_uri.host == 'app.example.com' &&
second_uri.scheme == 'https' && second_uri.host == '192.168.1.10'
end)
end

Copilot is powered by AI and may make mistakes. Always verify output.
expect(WebMock).to(have_requested(:post, "#{video_service_url}/api/render")
.with do |req|
body = JSON.parse(req.body)
body['callback_url'].start_with?('https://app.example.com')

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High test

'
https://app.example.com
' may be followed by an arbitrary host name.

Copilot Autofix

AI about 1 month ago

Copilot could not generate an autofix suggestion

Copilot could not generate an autofix suggestion for this alert. Try pushing a new commit or if the problem persists contact support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants