Skip to content

Commit 71c73e6

Browse files
authored
Merge branch 'main' into fedcode-docs
2 parents b5ecb86 + c006e6c commit 71c73e6

11 files changed

Lines changed: 76 additions & 41 deletions

File tree

vulnerabilities/middleware/altcha_protection.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from django.shortcuts import redirect
1414
from django.utils.deprecation import MiddlewareMixin
1515

16-
from vulnerablecode.settings import ALTCHA_SESSION_TIMEOUT
16+
from vulnerablecode.settings import VULNERABLECODE_ALTCHA_SESSION_TIMEOUT
1717

1818
ALTCHA_PROTECTED_PREFIXES = (
1919
"/packages/",
@@ -26,7 +26,7 @@
2626

2727
class AltchaProtectionMiddleware(MiddlewareMixin):
2828
def __call__(self, request):
29-
if not ALTCHA_SESSION_TIMEOUT:
29+
if not VULNERABLECODE_ALTCHA_SESSION_TIMEOUT:
3030
return self.get_response(request)
3131

3232
protected = any(request.path.startswith(prefix) for prefix in ALTCHA_PROTECTED_PREFIXES)
@@ -40,7 +40,7 @@ def __call__(self, request):
4040
if not verified_at:
4141
return redirect(f"/altcha/?{urlencode({'next': next_url})}")
4242

43-
if time.time() - verified_at > ALTCHA_SESSION_TIMEOUT:
43+
if time.time() - verified_at > VULNERABLECODE_ALTCHA_SESSION_TIMEOUT:
4444
request.session.pop("altcha_verified_at", None)
4545
return redirect(f"/altcha/?{urlencode({'next': next_url})}")
4646

vulnerabilities/templates/mitigation_curation.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@
1616
}
1717

1818
#table-header th {
19-
height: 100px;
20-
padding: 0.75rem 0.5rem !important;
19+
vertical-align: top !important;
20+
position: relative !important;
21+
padding: 0.75rem 0.5rem 3rem 0.5rem !important;
22+
border: none !important;
23+
box-shadow: inset 0 -1px 0 0 #dbdbdb !important;
2124
}
2225

23-
#table-header th>div {
24-
display: inline-flex !important;
25-
flex-direction: column !important;
26-
justify-content: space-between !important;
27-
height: 100% !important;
28-
width: 100%;
26+
#table-header th:not(:first-child) {
27+
box-shadow: inset 1px 0 0 0 #dbdbdb, inset 0 -1px 0 0 #dbdbdb !important;
2928
}
3029

3130
#table-header th:first-child {

vulnerabilities/templates/severity_curation.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,31 @@
1616
}
1717

1818
#table-header th {
19-
height: 130px;
2019
vertical-align: top !important;
21-
padding: 0.75rem 0.5rem !important;
20+
position: relative !important;
21+
padding: 0.75rem 0.5rem 3rem 0.5rem !important;
22+
border: none !important;
23+
box-shadow: inset 0 -1px 0 0 #dbdbdb !important;
24+
}
25+
26+
#table-header th:not(:first-child) {
27+
box-shadow: inset 1px 0 0 0 #dbdbdb, inset 0 -1px 0 0 #dbdbdb !important;
2228
}
2329

2430
#table-header th>div {
25-
display: inline-flex !important;
31+
display: flex !important;
2632
flex-direction: column !important;
27-
justify-content: space-between !important;
28-
height: 100% !important;
2933
width: 100%;
3034
}
3135

36+
#table-header th > div > button {
37+
position: absolute !important;
38+
bottom: 0.75rem !important;
39+
left: 0.5rem !important;
40+
right: 0.5rem !important;
41+
width: calc(100% - 1rem) !important;
42+
}
43+
3244
#table-header th:first-child {
3345
width: 300px !important;
3446
}

vulnerabilities/templates/weakness_curation.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,31 @@
3232
}
3333

3434
#table-header th {
35-
height: 140px;
3635
vertical-align: top !important;
37-
padding: 0.75rem 0.5rem !important;
36+
position: relative !important;
37+
padding: 0.75rem 0.5rem 3rem 0.5rem !important;
38+
border: none !important;
39+
box-shadow: inset 0 -1px 0 0 #dbdbdb !important;
40+
}
41+
42+
#table-header th:not(:first-child) {
43+
box-shadow: inset 1px 0 0 0 #dbdbdb, inset 0 -1px 0 0 #dbdbdb !important;
3844
}
3945

4046
#table-header th>div {
41-
display: inline-flex !important;
47+
display: flex !important;
4248
flex-direction: column !important;
43-
justify-content: space-between !important;
44-
height: 100% !important;
4549
width: 100%;
4650
}
4751

52+
#table-header th > div > button {
53+
position: absolute !important;
54+
bottom: 0.75rem !important;
55+
left: 0.5rem !important;
56+
right: 0.5rem !important;
57+
width: calc(100% - 1rem) !important;
58+
}
59+
4860
#table-header th:first-child {
4961
width: 150px !important;
5062
}

vulnerabilities/views.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
from vulnerabilities.utils import get_advisories_from_groups
6666
from vulnerabilities.utils import safe_altcha_redirect
6767
from vulnerablecode import __version__ as VULNERABLECODE_VERSION
68-
from vulnerablecode.settings import ALTCHA_SESSION_TIMEOUT
68+
from vulnerablecode.settings import VULNERABLECODE_ALTCHA_SESSION_TIMEOUT
6969
from vulnerablecode.settings import env
7070

7171
PAGE_SIZE = 10
@@ -1166,7 +1166,7 @@ def dispatch(self, request, *args, **kwargs):
11661166
verified_at = request.session.get("altcha_verified_at")
11671167

11681168
if verified_at:
1169-
if time.time() - verified_at < ALTCHA_SESSION_TIMEOUT:
1169+
if time.time() - verified_at < VULNERABLECODE_ALTCHA_SESSION_TIMEOUT:
11701170
next_url = request.GET.get("next", "/")
11711171
return safe_altcha_redirect(next_url)
11721172

vulnerablecode/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
ALTCHA_HMAC_KEY = env.str("ALTCHA_HMAC_KEY")
4444

45-
ALTCHA_SESSION_TIMEOUT = env.int("ALTCHA_SESSION_TIMEOUT", None)
45+
VULNERABLECODE_ALTCHA_SESSION_TIMEOUT = env.int("VULNERABLECODE_ALTCHA_SESSION_TIMEOUT", None)
4646

4747
# SECURITY WARNING: do not run with debug turned on in production
4848
DEBUG = env.bool("VULNERABLECODE_DEBUG", default=False)
@@ -218,7 +218,7 @@
218218

219219
if IS_TESTS:
220220
VULNERABLECODEIO_REQUIRE_AUTHENTICATION = False
221-
ALTCHA_SESSION_TIMEOUT = 900
221+
VULNERABLECODE_ALTCHA_SESSION_TIMEOUT = 900
222222

223223
USE_L10N = True
224224

vulnerablecode/static/css/package_curation.css

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,31 @@
2626
}
2727

2828
#table-header th {
29-
height: 140px;
3029
vertical-align: top !important;
31-
padding: 0.75rem 0.5rem !important;
30+
position: relative !important;
31+
padding: 0.75rem 0.5rem 3rem 0.5rem !important;
32+
border: none !important;
33+
box-shadow: inset 0 -1px 0 0 #dbdbdb !important;
34+
}
35+
36+
#table-header th:not(:first-child) {
37+
box-shadow: inset 1px 0 0 0 #dbdbdb, inset 0 -1px 0 0 #dbdbdb !important;
3238
}
3339

3440
#table-header th>div {
35-
display: inline-flex !important;
41+
display: flex !important;
3642
flex-direction: column !important;
37-
justify-content: space-between !important;
38-
height: 100% !important;
3943
width: 100%;
4044
}
4145

46+
#table-header th > div > button {
47+
position: absolute !important;
48+
bottom: 0.75rem !important;
49+
left: 0.5rem !important;
50+
right: 0.5rem !important;
51+
width: calc(100% - 1rem) !important;
52+
}
53+
4254
#table-header th:first-child {
4355
width: 150px !important;
4456
}

vulnerablecode/static/js/package_curation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const app = {
6868
<div>
6969
<div class="has-text-weight-bold">Curation</div>
7070
</div>
71-
<button class="button is-small is-outlined is-info mt-auto" onclick="app.resetCurrentCuration()">Reset</button>
71+
<button class="button is-small is-outlined is-info" onclick="app.resetCurrentCuration()">Reset</button>
7272
</div>
7373
</th>`;
7474

@@ -108,7 +108,7 @@ const app = {
108108
${toggleHtml}
109109
${primaryUidHtml}
110110
</div>
111-
<button class="button is-small is-info mt-auto" onclick="app.pickAdvisory(${groupIdx}, 'primary')">Pick This</button>
111+
<button class="button is-small is-info" onclick="app.pickAdvisory(${groupIdx}, 'primary')">Pick This</button>
112112
</div>
113113
`;
114114
header.appendChild(primaryTh);
@@ -131,7 +131,7 @@ const app = {
131131
<span class="icon is-small" ><i class="fa fa-external-link"></i></span>
132132
</a>
133133
</div>
134-
<button class="button is-small is-info is-light mt-auto" onclick="app.pickAdvisory(${groupIdx}, 'secondary', ${secIdx})">Pick This</button>
134+
<button class="button is-small is-info is-light" onclick="app.pickAdvisory(${groupIdx}, 'secondary', ${secIdx})">Pick This</button>
135135
</div>
136136
`;
137137
header.appendChild(secTh);

vulnerablecode/static/js/severity_curation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const app = {
131131
<div>
132132
<div class="has-text-weight-bold is-size-6">Curation</div>
133133
</div>
134-
<button class="button is-small is-outlined is-info mt-auto" onclick="app.resetCurrentCuration()">Reset</button>
134+
<button class="button is-small is-outlined is-info" onclick="app.resetCurrentCuration()">Reset</button>
135135
</div>
136136
</th>
137137
`;
@@ -174,7 +174,7 @@ const app = {
174174
${primaryUidHtml}
175175
</div>
176176
<button
177-
class="button is-small is-info mt-auto"
177+
class="button is-small is-info"
178178
onclick="app.pickAdvisory(${groupIdx}, 'primary')"
179179
${advGroup.primary.vector_string ? '' : 'disabled'}>
180180
Pick This
@@ -204,7 +204,7 @@ const app = {
204204
</div>
205205
<span class="is-info is-light mb-1 is-size-6">Score: ${sec.score || 'NA'}</span><br>
206206
<button
207-
class="button is-small is-info is-light mt-auto"
207+
class="button is-small is-info is-light"
208208
onclick="app.pickAdvisory(${groupIdx}, 'secondary')"
209209
${sec.vector_string ? '' : 'disabled'}>
210210
Pick This

vulnerablecode/static/js/weakness_curation.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const app = {
4646
<div>
4747
<div class="has-text-weight-bold">Curation</div>
4848
</div>
49-
<button class="button is-small is-outlined is-info mt-auto" onclick="app.resetCurrentCuration()">Reset</button>
49+
<button class="button is-small is-outlined is-info" onclick="app.resetCurrentCuration()">Reset</button>
5050
</div>
5151
</th>`;
5252

@@ -86,7 +86,7 @@ const app = {
8686
${toggleHtml}
8787
${primaryUidHtml}
8888
</div>
89-
<button class="button is-small is-info mt-auto" onclick="app.pickAdvisory(${groupIdx}, 'primary')">Pick This</button>
89+
<button class="button is-small is-info" onclick="app.pickAdvisory(${groupIdx}, 'primary')">Pick This</button>
9090
</div>
9191
`;
9292
header.appendChild(primaryTh);
@@ -109,7 +109,7 @@ const app = {
109109
<span class="icon is-small" ><i class="fa fa-external-link"></i></span>
110110
</a>
111111
</div>
112-
<button class="button is-small is-info is-light mt-auto" onclick="app.pickAdvisory(${groupIdx}, 'secondary', ${secIdx})">Pick This</button>
112+
<button class="button is-small is-info is-light" onclick="app.pickAdvisory(${groupIdx}, 'secondary', ${secIdx})">Pick This</button>
113113
</div>
114114
`;
115115
header.appendChild(secTh);

0 commit comments

Comments
 (0)