Skip to content
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
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ ARG GAMIFICATION_ORG_ID
# Universal Nav
ARG UNIVERSAL_NAV_URL

# Topgear submissions allowed domains
ARG TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS

################################################################################
# Setting of environment variables in the Docker image.

Expand Down Expand Up @@ -154,6 +157,9 @@ ENV GAMIFICATION_ORG_ID=$GAMIFICATION_ORG_ID
# Universal nav
ENV UNIVERSAL_NAV_URL=$UNIVERSAL_NAV_URL

# Topgear submissions allowed domains
ENV TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS=$TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS

################################################################################
# Testing and build of the application inside the container.

Expand Down
1 change: 1 addition & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ docker build -t $TAG \
--build-arg CONTENTFUL_EDU_CDN_API_KEY=$CONTENTFUL_EDU_CDN_API_KEY \
--build-arg CONTENTFUL_EDU_PREVIEW_API_KEY=$CONTENTFUL_EDU_PREVIEW_API_KEY \
--build-arg FILESTACK_API_KEY=$FILESTACK_API_KEY \
--build-arg TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS=$TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS \
--build-arg FILESTACK_SUBMISSION_CONTAINER=$FILESTACK_SUBMISSION_CONTAINER \
--build-arg MAILCHIMP_API_KEY=$MAILCHIMP_API_KEY \
--build-arg MAILCHIMP_BASE_URL=$MAILCHIMP_BASE_URL \
Expand Down
1 change: 1 addition & 0 deletions config/custom-environment-variables.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,5 @@ module.exports = {
ORG_ID: 'GAMIFICATION_ORG_ID',
ENABLE_BADGE_UI: 'GAMIFICATION_ENABLE_BADGE_UI',
},
TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS: 'TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS',
};
2 changes: 1 addition & 1 deletion config/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,5 +472,5 @@ module.exports = {
ACCOUNT_SETTINGS_REDIRECT_URL: 'https://account-settings.topcoder-dev.com',
INNOVATION_CHALLENGES_TAG: 'Innovation Challenge',
PLATFORM_SITE_URL: 'https://platform.topcoder-dev.com',
TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS: ['wipro365.sharepoint.com', 'wipro365-my.sharepoint.com', 'wipro365-my.sharepoint.com.mcas.ms'],
TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS: 'wipro365.sharepoint.com|wipro365-my.sharepoint.com|wipro365-my.sharepoint.com.mcas.ms',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from an array to a string for TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS may affect how this configuration is used in the application. If the application logic expects an array, this change could lead to errors. Consider verifying that the application can handle a string with domains separated by | or update the logic accordingly.

};
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class FilestackFilePicker extends React.Component {
}

isDomainAllowed(url) {
const domainReg = new RegExp(`^https?://(${config.TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS.join('|')})/.+`);
const domainReg = new RegExp(`^https?://(${config.TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS})/.+`);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change from join('|') to directly using config.TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS might cause issues if TOPGEAR_ALLOWED_SUBMISSIONS_DOMAINS is an array. If it is intended to be a single string, ensure that it is formatted correctly as a regex pattern. Otherwise, if it is an array, the previous implementation using join('|') is necessary to construct a valid regex pattern that matches any of the allowed domains.

return !!url.match(domainReg);
}

Expand Down