Skip to content

Release v1.15.8 #6064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ workflows:
branches:
only:
- develop
- fix/regsource
- fix/infected-submission
# This is alternate dev env for parallel testing
- "build-test":
context : org-global
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,7 @@ exports[`Snapshot match 1`] = `
<button
onClick={[Function]}
type="button"
>
<DownloadIcon
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
</button>
/>
<button
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
disabled={true}
Expand Down Expand Up @@ -87,14 +80,7 @@ exports[`Snapshot match 2`] = `
<button
onClick={[Function]}
type="button"
>
<DownloadIcon
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
/>
</button>
/>
<button
className="src-shared-components-SubmissionManagement-Submission-___styles__delete-icon___2M67z"
disabled={true}
Expand Down Expand Up @@ -123,4 +109,4 @@ exports[`Snapshot match 2`] = `
</div>
</td>
</tr>
`;
`;
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,5 +232,8 @@
"webpack-pwa-manifest": "^3.7.1",
"webpack-stats-plugin": "^0.2.1",
"workbox-webpack-plugin": "^3.6.2"
},
"volta": {
"node": "8.11.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import _ from 'lodash';
import moment from 'moment';
import React from 'react';
import { COMPETITION_TRACKS, CHALLENGE_STATUS } from 'utils/tc';
import { COMPETITION_TRACKS, CHALLENGE_STATUS, safeForDownload } from 'utils/tc';

import PT from 'prop-types';

Expand All @@ -38,6 +38,7 @@ export default function Submission(props) {
} = props;
const formatDate = date => moment(+new Date(date)).format('MMM DD, YYYY hh:mm A');
const onDownloadSubmission = onDownload.bind(1, submissionObject.id);
const safeForDownloadCheck = safeForDownload(submissionObject.url);

return (
<tr styleName="submission-row">
Expand All @@ -54,7 +55,7 @@ export default function Submission(props) {
{
track === COMPETITION_TRACKS.DES && (
<td styleName="status-col">
{submissionObject.screening
{safeForDownloadCheck !== true ? safeForDownloadCheck : submissionObject.screening
&& (
<ScreeningStatus
screeningObject={submissionObject.screening}
Expand All @@ -71,7 +72,7 @@ export default function Submission(props) {
onClick={() => onDownloadSubmission(submissionObject.id)}
type="button"
>
<DownloadIcon />
{ safeForDownloadCheck === true && <DownloadIcon /> }
</button>
{ /*
TODO: At the moment we just fetch downloads from the legacy
Expand Down Expand Up @@ -127,6 +128,7 @@ Submission.propTypes = {
type: PT.string,
created: PT.any,
download: PT.any,
url: PT.string,
}),
showScreeningDetails: PT.bool,
track: PT.string.isRequired,
Expand Down
22 changes: 22 additions & 0 deletions src/shared/utils/tc.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,26 @@ export function isValidEmail(email) {
return pattern.test(email);
}

/**
* Test if the file is safe for download. This patch currently checks the location of the submission
* to determine if the file is infected or not. This is an immedaite patch, and should be updated to
* check the review scan score for review type virus scan.
*
* @returns {String|Boolean} true if submission is safe for download,
* otherwise string describing reason for not being safe for download
*/
export function safeForDownload(url) {
if (url == null) return 'Download link unavailable';

if (url.toLowerCase().indexOf('submissions-quarantine/') !== -1) {
return 'Malware found in submission';
}

if (url.toLowerCase().indexOf('submissions-dmz/') !== -1) {
return 'AV Scan in progress';
}

return true;
}

export default undefined;