From d89f6d15a4e1a2fec5767ea065781fdfbe09f549 Mon Sep 17 00:00:00 2001 From: Vasilica Olariu Date: Wed, 18 Dec 2024 17:24:14 +0200 Subject: [PATCH] PM-197 - XSS poor validation error handling --- src/shared/components/Contentful/Article/Article.jsx | 2 +- src/shared/components/Gigs/GigApply/index.jsx | 6 +++--- src/shared/components/TopcoderHeader/Auth/index.jsx | 2 +- src/shared/components/tc-communities/AccessDenied/index.jsx | 2 +- src/shared/components/tc-communities/Footer/index.jsx | 4 ++-- src/shared/components/tc-communities/Header/index.jsx | 6 +++--- src/shared/containers/Dashboard/index.jsx | 2 +- src/shared/containers/challenge-detail/index.jsx | 2 +- src/shared/containers/tc-communities/Loader.jsx | 2 +- src/shared/utils/tc.js | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/shared/components/Contentful/Article/Article.jsx b/src/shared/components/Contentful/Article/Article.jsx index d15b08c260..772a0afb0a 100644 --- a/src/shared/components/Contentful/Article/Article.jsx +++ b/src/shared/components/Contentful/Article/Article.jsx @@ -139,7 +139,7 @@ class Article extends React.Component { } = this.state || {}; let shareUrl; if (isomorphy.isClientSide()) { - shareUrl = encodeURIComponent(window.location.href); + shareUrl = encodeURIComponent(`${window.location.origin}${window.location.pathname}`); } const description = htmlToText.fromString( ReactDOMServer.renderToString(markdown(fields.content)), diff --git a/src/shared/components/Gigs/GigApply/index.jsx b/src/shared/components/Gigs/GigApply/index.jsx index a36919c2bf..53d6b557bc 100644 --- a/src/shared/components/Gigs/GigApply/index.jsx +++ b/src/shared/components/Gigs/GigApply/index.jsx @@ -36,7 +36,7 @@ export default function GigApply(props) { recruitProfile, auth, } = props; - const retUrl = window.location.href; + const retUrl = encodeURIComponent(`${window.location.origin}${window.location.pathname}`); const duration = getCustomField(job.custom_fields, 'Duration'); const isPlaced = _.find(_.isEmpty(recruitProfile) ? [] : recruitProfile.custom_fields, { field_id: 12 }); const fetchSkills = useMemo(() => _.debounce((inputValue, callback) => { @@ -353,9 +353,9 @@ export default function GigApply(props) {

You must be a Topcoder member to apply!

- Login + Login
-

Not a member? Register here.

+

Not a member? Register here.

diff --git a/src/shared/components/TopcoderHeader/Auth/index.jsx b/src/shared/components/TopcoderHeader/Auth/index.jsx index ab8c237b6a..eee206a735 100644 --- a/src/shared/components/TopcoderHeader/Auth/index.jsx +++ b/src/shared/components/TopcoderHeader/Auth/index.jsx @@ -28,7 +28,7 @@ export default function Auth({ column }) { className="tc-btn-sm tc-btn-default" href={`${config.URL.AUTH}/member?utm_source=community-app-main`} onClick={(event) => { - const retUrl = encodeURIComponent(window.location.href); + const retUrl = encodeURIComponent(`${window.location.origin}${window.location.pathname}`); window.location = `${config.URL.AUTH}/member?retUrl=${retUrl}&utm_source=community-app-main`; event.preventDefault(); }} diff --git a/src/shared/components/tc-communities/AccessDenied/index.jsx b/src/shared/components/tc-communities/AccessDenied/index.jsx index a5730d6d97..32952604e6 100644 --- a/src/shared/components/tc-communities/AccessDenied/index.jsx +++ b/src/shared/components/tc-communities/AccessDenied/index.jsx @@ -50,7 +50,7 @@ export default function AccessDenied(props) { className="tc-btn-md tc-btn-primary" href={`${config.URL.AUTH}/member?utm_source=${communityId}`} onClick={(event) => { - const retUrl = encodeURIComponent(window.location.href); + const retUrl = encodeURIComponent(`${window.location.origin}${window.location.pathname}`); window.location = `${config.URL.AUTH}/member?retUrl=${retUrl}&utm_source=${communityId}`; event.preventDefault(); }} diff --git a/src/shared/components/tc-communities/Footer/index.jsx b/src/shared/components/tc-communities/Footer/index.jsx index 8f0809a158..4299238d27 100644 --- a/src/shared/components/tc-communities/Footer/index.jsx +++ b/src/shared/components/tc-communities/Footer/index.jsx @@ -56,7 +56,7 @@ function Footer({