Skip to content
This repository was archived by the owner on Jun 13, 2025. It is now read-only.

Commit a9526b8

Browse files
authored
sec: remove open redirect to codecov (#799)
1 parent ab61f47 commit a9526b8

File tree

5 files changed

+4
-26
lines changed

5 files changed

+4
-26
lines changed

codecov/tests/test_urls.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,6 @@
33

44

55
class ViewTest(TestCase):
6-
def test_redirect_app(self):
7-
client = Client()
8-
response = client.get(
9-
"/redirect_app/gh/codecov/codecov.io/settings", follow=False
10-
)
11-
self.assertRedirects(
12-
response,
13-
"http://localhost:3000/gh/codecov/codecov.io/settings",
14-
302,
15-
fetch_redirect_response=False,
16-
)
17-
186
def test_health(self):
197
client = Client()
208
response = client.get("")

codecov/urls.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
views.OwnerAutoCompleteSearch.as_view(),
3535
name="admin-owner-autocomplete",
3636
),
37-
re_path(r"^redirect_app", views.redirect_app),
3837
# /monitoring/metrics will be a public route unless you take steps at a
3938
# higher level to null-route or redirect it.
4039
path("monitoring/", include("django_prometheus.urls")),

codecov/views.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from dal import autocomplete
2-
from django.conf import settings
32
from django.db import connection
4-
from django.http import HttpResponse, HttpResponseRedirect
3+
from django.http import HttpResponse
54

65
from codecov_auth.models import Owner, Service
76
from core.models import Constants, Repository
@@ -17,21 +16,13 @@ def _get_version():
1716

1817

1918
def health(request):
20-
# will raise if connection cannot be estabilished
19+
# will raise if connection cannot be established
2120
connection.ensure_connection()
2221

2322
version = _get_version()
2423
return HttpResponse("%s is live!" % version.value)
2524

2625

27-
def redirect_app(request):
28-
"""
29-
This view is intended to be used as part of the frontend migration to redirect traffic from legacy urls to urls
30-
"""
31-
app_domain = settings.CODECOV_DASHBOARD_URL
32-
return HttpResponseRedirect(app_domain + request.path.replace("/redirect_app", ""))
33-
34-
3526
SERVICE_CHOICES = dict(Service.choices)
3627

3728

graphs/helpers/badge.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from graphs.badges.badges import large_badge, medium_badge, small_badge, unknown_badge
44

55

6-
def get_badge(coverage, coverage_range, precision):
6+
def get_badge(coverage: str | None, coverage_range: list[int], precision: str):
77
"""
88
Returns and SVG string containing coverage badge
99

graphs/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def get_coverage(self):
121121

122122
def flag_coverage(self, flag_name, commit):
123123
"""
124-
Looks into a commit's report sessions and returns the coverage for a perticular flag
124+
Looks into a commit's report sessions and returns the coverage for a particular flag
125125
126126
Parameters
127127
flag_name (string): name of flag

0 commit comments

Comments
 (0)