File tree Expand file tree Collapse file tree 8 files changed +44
-8
lines changed
Expand file tree Collapse file tree 8 files changed +44
-8
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ Release notes
22=============
33
44
5+ Version v33.6.3
6+ ----------------
7+
8+ - We updated RTD build configuration.
9+ - We added importer for OSS-Fuzz.
10+ - We removed vulnerabilities with empty aliases.
11+ - We fixed search encoding issue https://github.com/nexB/vulnerablecode/issues/1336.
12+ - We added middleware to ban "bytedance" user-agent.
13+
14+
515Version v33.6.2
616----------------
717
Original file line number Diff line number Diff line change 11[metadata]
22name = vulnerablecode
3- version = 33.6.2
3+ version = 33.6.3
44license = Apache-2.0 AND CC-BY-SA-4.0
55
66# description must be on ONE line https://github.com/pypa/setuptools/issues/1390
Original file line number Diff line number Diff line change 88#
99
1010from vulnerabilities .improvers import valid_versions
11- from vulnerabilities .improvers import vulnerability_status
11+
12+ # from vulnerabilities.improvers import vulnerability_status
1213
1314IMPROVERS_REGISTRY = [
1415 valid_versions .GitHubBasicImprover ,
2425 valid_versions .DebianOvalImprover ,
2526 valid_versions .UbuntuOvalImprover ,
2627 valid_versions .OSSFuzzImprover ,
27- vulnerability_status .VulnerabilityStatusImprover ,
28+ # vulnerability_status.VulnerabilityStatusImprover,
2829]
2930
3031IMPROVERS_REGISTRY = {x .qualified_name : x for x in IMPROVERS_REGISTRY }
Original file line number Diff line number Diff line change 1+ #
2+ # Copyright (c) nexB Inc. and others. All rights reserved.
3+ # VulnerableCode is a trademark of nexB Inc.
4+ # SPDX-License-Identifier: Apache-2.0
5+ # See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6+ # See https://github.com/nexB/vulnerablecode for support or download.
7+ # See https://aboutcode.org for more information about nexB OSS projects.
8+ #
9+
10+ from django .http import HttpResponseNotFound
11+ from django .utils .deprecation import MiddlewareMixin
12+
13+
14+ class BanUserAgent (MiddlewareMixin ):
15+ def process_request (self , request ):
16+ user_agent = request .META .get ("HTTP_USER_AGENT" , None )
17+ if user_agent and "bytedance" in user_agent :
18+ return HttpResponseNotFound (404 )
Original file line number Diff line number Diff line change 11< nav class ="pagination is-centered is-small " aria-label ="pagination ">
22 {% if page_obj.has_previous %}
3- < a href ="?page={{ page_obj.previous_page_number }}&search={{ search }} " class ="pagination-previous "> Previous</ a >
3+ < a href ="?page={{ page_obj.previous_page_number }}&search={{ search|urlencode }} " class ="pagination-previous "> Previous</ a >
44 {% else %}
55 < a class ="pagination-previous " disabled > Previous</ a >
66 {% endif %}
77
88 {% if page_obj.has_next %}
9- < a href ="?page={{ page_obj.next_page_number }}&search={{ search }} " class ="pagination-next "> Next</ a >
9+ < a href ="?page={{ page_obj.next_page_number }}&search={{ search|urlencode }} " class ="pagination-next "> Next</ a >
1010 {% else %}
1111 < a class ="pagination-next " disabled > Next</ a >
1212 {% endif %}
1313
1414 < ul class ="pagination-list ">
1515 {% if page_obj.number != 1%}
1616 < li >
17- < a href ="?page=1&search={{ search }} " class ="pagination-link " aria-label ="Goto page 1 "> 1</ a >
17+ < a href ="?page=1&search={{ search|urlencode }} " class ="pagination-link " aria-label ="Goto page 1 "> 1</ a >
1818 </ li >
1919 {% if page_obj.number > 2 %}
2020 < li >
3232 </ li >
3333 {% endif %}
3434 < li >
35- < a href ="?page={{ page_obj.paginator.num_pages }}&search={{ search }} " class ="pagination-link " aria-label ="Goto page {{ page_obj.paginator.num_pages }} "> {{ page_obj.paginator.num_pages }}</ a >
35+ < a href ="?page={{ page_obj.paginator.num_pages }}&search={{ search|urlencode }} " class ="pagination-link " aria-label ="Goto page {{ page_obj.paginator.num_pages }} "> {{ page_obj.paginator.num_pages }}</ a >
3636 </ li >
3737 {% endif %}
3838 </ ul >
Original file line number Diff line number Diff line change @@ -743,3 +743,9 @@ def test_with_invalid_cpes(self):
743743 content_type = "application/json" ,
744744 ).json ()
745745 assert response == {"Error" : "Invalid CPE: CVE-2022-2022" }
746+
747+
748+ class TesBanUserAgent (TestCase ):
749+ def test_ban_request_with_bytedance_user_agent (self ):
750+ response = self .client .get (f"/api/packages" , format = "json" , HTTP_USER_AGENT = "bytedance" )
751+ assert 404 == response .status_code
Original file line number Diff line number Diff line change 1212import warnings
1313from pathlib import Path
1414
15- __version__ = "33.6.2 "
15+ __version__ = "33.6.3 "
1616
1717
1818def command_line ():
Original file line number Diff line number Diff line change 8989 "django.contrib.auth.middleware.AuthenticationMiddleware" ,
9090 "django.contrib.messages.middleware.MessageMiddleware" ,
9191 "django.middleware.clickjacking.XFrameOptionsMiddleware" ,
92+ "vulnerabilities.middleware.ban_user_agent.BanUserAgent" ,
9293)
9394
9495ROOT_URLCONF = "vulnerablecode.urls"
You can’t perform that action at this time.
0 commit comments