Skip to content

Commit 5abafcc

Browse files
committed
fix: disable download of infected submissions
1 parent 74efa33 commit 5abafcc

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ workflows:
343343
branches:
344344
only:
345345
- develop
346-
- fix/regsource
346+
- fix/infected-submission
347347
# This is alternate dev env for parallel testing
348348
- "build-test":
349349
context : org-global

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,5 +232,8 @@
232232
"webpack-pwa-manifest": "^3.7.1",
233233
"webpack-stats-plugin": "^0.2.1",
234234
"workbox-webpack-plugin": "^3.6.2"
235+
},
236+
"volta": {
237+
"node": "8.11.2"
235238
}
236239
}

src/shared/components/SubmissionManagement/Submission/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import _ from 'lodash';
1515
import moment from 'moment';
1616
import React from 'react';
17-
import { COMPETITION_TRACKS, CHALLENGE_STATUS } from 'utils/tc';
17+
import { COMPETITION_TRACKS, CHALLENGE_STATUS, safeForDownload } from 'utils/tc';
1818

1919
import PT from 'prop-types';
2020

@@ -54,7 +54,7 @@ export default function Submission(props) {
5454
{
5555
track === COMPETITION_TRACKS.DES && (
5656
<td styleName="status-col">
57-
{submissionObject.screening
57+
{!safeForDownload(submissionObject.url) ? 'Malware found in submission' : submissionObject.screening
5858
&& (
5959
<ScreeningStatus
6060
screeningObject={submissionObject.screening}
@@ -71,7 +71,7 @@ export default function Submission(props) {
7171
onClick={() => onDownloadSubmission(submissionObject.id)}
7272
type="button"
7373
>
74-
<DownloadIcon />
74+
{ safeForDownload(submissionObject.url) && <DownloadIcon /> }
7575
</button>
7676
{ /*
7777
TODO: At the moment we just fetch downloads from the legacy
@@ -127,6 +127,7 @@ Submission.propTypes = {
127127
type: PT.string,
128128
created: PT.any,
129129
download: PT.any,
130+
url: PT.string,
130131
}),
131132
showScreeningDetails: PT.bool,
132133
track: PT.string.isRequired,

src/shared/utils/tc.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,4 +305,13 @@ export function isValidEmail(email) {
305305
return pattern.test(email);
306306
}
307307

308+
/**
309+
* Test if the file is safe for download. This patch currently checks the location of the submission
310+
* to determine if the file is infected or not. This is an immedaite patch, and should be updated to
311+
* check the review scan score for review type virus scan.
312+
*/
313+
export function safeForDownload(url) {
314+
return url != null && url.indexOf('submissions-quarantine/') === -1;
315+
}
316+
308317
export default undefined;

0 commit comments

Comments
 (0)