Skip to content

Prod release - Security issues - Community App PHASE 2 #7075

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 18 commits into from
Feb 24, 2025
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import Renderer from 'react-test-renderer/shallow';
import Item from 'components/TopcoderHeader/desktop/SubMenu/Item';
import Item from 'components/SubMenu/Item';

test('Matches shallow shapshot', () => {
const renderer = new Renderer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`Matches shallow shapshot 1`] = `
<li
className="src-shared-components-TopcoderHeader-desktop-SubMenu-Item-___style__item___2Q-ud src-shared-components-TopcoderHeader-desktop-SubMenu-Item-___style__current___38PHh"
className="src-shared-components-SubMenu-Item-___style__item___2U0li src-shared-components-SubMenu-Item-___style__current___3WfNb"
role="button"
tabIndex={0}
>
Expand All @@ -21,7 +21,7 @@ exports[`Matches shallow shapshot 1`] = `

exports[`Matches shallow shapshot 2`] = `
<li
className="src-shared-components-TopcoderHeader-desktop-SubMenu-Item-___style__item___2Q-ud"
className="src-shared-components-SubMenu-Item-___style__item___2U0li"
role="button"
tabIndex={0}
>
Expand Down
2 changes: 1 addition & 1 deletion src/server/services/communities.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export async function getMetadata(communityId) {
communityId, 'metadata.json',
);
try {
metadata = JSON.parse(fs.readFileSync(uri, 'utf8'));
metadata = JSON.parse(await promisify(fs.readFile)(uri, 'utf8'));
} catch (error) {
const msg = `Failed to get metadata for ${communityId} community`;
logger.error(msg, error);
Expand Down
3 changes: 2 additions & 1 deletion src/shared/components/Contentful/Article/Article.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import IconFacebook from 'assets/images/icon-facebook.svg';
import IconTwitter from 'assets/images/icon-twitter.svg';
import IconLinkedIn from 'assets/images/icon-linkedIn.svg';
import DiscordIconWhite from 'assets/images/tc-edu/discord-icon-white.svg';
import getSecureRandomIndex from 'utils/secureRandom';

const htmlToText = require('html-to-text');

Expand All @@ -45,7 +46,7 @@ const LOCAL_STORAGE_KEY = 'VENBcnRpY2xlVm90ZXM=';
const DEFAULT_BANNER_IMAGE = 'https://images.ctfassets.net/piwi0eufbb2g/7v2hlDsVep7FWufHw0lXpQ/2505e61a880e68fab4e80cd0e8ec1814/0C37CB5E-B253-4804-8935-78E64E67589E.png?w=1200&h=630';
// random ads banner - left sidebar
const RANDOM_BANNERS = ['6G8mjiTC1mzeSQ2YoUG1gB', '1DnDD02xX1liHfSTf5Vsn8', 'HQZ3mN0rR92CbNTkKTHJ5', '1OLoX8ZsvjAnn4TdGbZESD', '77jn01UGoQe2gqA7x0coQD'];
const RANDOM_BANNER = RANDOM_BANNERS[_.random(0, 4)];
const RANDOM_BANNER = RANDOM_BANNERS[getSecureRandomIndex(RANDOM_BANNERS.length)];

class Article extends React.Component {
componentDidMount() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import PT from 'prop-types';
import React from 'react';
import { themr } from 'react-css-super-themr';
import { fixStyle } from 'utils/contentful';
import getSecureRandomIndex from 'utils/secureRandom';
import defaultTheme from './themes/default.scss';

const MAX_MARGIN_TOP = 0;
Expand All @@ -17,7 +18,7 @@ const MAX_MARGIN_LEFT = 30;

const getRandomTranslate = () => ({
y: MAX_MARGIN_TOP,
x: _.random(MIN_MARGIN_LEFT, MAX_MARGIN_LEFT, false),
x: getSecureRandomIndex(MIN_MARGIN_LEFT, MAX_MARGIN_LEFT),
});

export class MemberTalkCloud extends React.Component {
Expand Down Expand Up @@ -92,7 +93,7 @@ export class MemberTalkCloud extends React.Component {
<img
alt={activeBlob.handle}
src={activeBlob.imageURL}
key={Math.random()}
key={getSecureRandomIndex(0, 1000)}
/>
<span className={theme.activeHandle}>{activeBlob.handle}</span>
<div className={blob}>
Expand Down
52 changes: 0 additions & 52 deletions src/shared/components/MemberSearch/ListContainer/index.jsx

This file was deleted.

47 changes: 0 additions & 47 deletions src/shared/components/MemberSearch/ListContainer/style.scss

This file was deleted.

22 changes: 0 additions & 22 deletions src/shared/components/MemberSearch/LoadMoreButton/index.jsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/shared/components/MemberSearch/LoadMoreButton/style.scss

This file was deleted.

50 changes: 0 additions & 50 deletions src/shared/components/MemberSearch/LoadingListItem/index.jsx

This file was deleted.

Loading
Loading