Skip to content

Commit ba49c3c

Browse files
Revert "PLAT-2614 Ampersand symbol getting converted "
1 parent dc230b0 commit ba49c3c

File tree

11 files changed

+10
-127
lines changed

11 files changed

+10
-127
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ workflows:
154154
- UnitTests
155155
filters:
156156
branches:
157-
only: ['develop', 'connect-performance-testing', 'feature/new-milestone-concept','feature/PLAT-2614']
157+
only: ['develop', 'connect-performance-testing', 'feature/new-milestone-concept']
158158
- deployProd:
159159
context : org-global
160160
requires:

config/default.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
"directProjectServiceEndpoint": "",
1515
"directProjectServiceTimeout": 5000,
1616
"attachmentsS3Bucket": "topcoder-prod-media",
17-
"attachmentsDMZS3Bucket": "topcoder-prod-media-dmz",
18-
"attachmentsQuarantineS3Bucket": "topcoder-prod-media-quarantine",
1917
"projectAttachmentPathPrefix": "projects",
2018
"projectAttachmentPathSuffix": "attachments",
2119
"elasticsearchConfig": {
@@ -89,4 +87,4 @@
8987
},
9088
"STRIPE_SECRET_KEY": "",
9189
"sfdcBillingAccountNameField": "Billing_Account_Name__c"
92-
}
90+
}

config/development.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"pubsubQueueName": "dev.project.service",
33
"pubsubExchangeName": "dev.projects",
44
"attachmentsS3Bucket": "topcoder-dev-media",
5-
"attachmentsDMZS3Bucket": "topcoder-dev-media-dmz",
6-
"attachmentsQuarantineS3Bucket": "topcoder-dev-media-quarantine",
75
"connectProjectsUrl": "https://connect.topcoder-dev.com/projects/",
86
"fileServiceEndpoint": "https://api.topcoder-dev.com/v3/files/",
97
"connectProjectsUrl": "https://connect.topcoder-dev.com/projects/",

package.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"express": "^4.13.4",
5858
"express-list-routes": "^0.1.4",
5959
"express-request-id": "^1.1.0",
60+
"express-sanitizer": "^1.0.2",
6061
"express-validation": "^1.0.3",
6162
"handlebars": "^4.5.3",
6263
"http-aws-es": "^4.0.0",
@@ -69,14 +70,13 @@
6970
"moment": "^2.22.2",
7071
"no-kafka": "^3.4.3",
7172
"pg": "^7.11.0",
72-
"pg-native": "^3.0.1",
73+
"pg-native": "^3.0.0",
7374
"sequelize": "^5.8.7",
7475
"stripe": "^8.195.0",
7576
"swagger-ui-express": "^4.0.6",
7677
"tc-core-library-js": "github:appirio-tech/tc-core-library-js#v2.6.6",
7778
"traverse": "^0.6.6",
7879
"urlencode": "^1.1.0",
79-
"xss": "^1.0.14",
8080
"yamljs": "^0.3.0"
8181
},
8282
"devDependencies": {
@@ -102,8 +102,5 @@
102102
"sinon": "^1.17.4",
103103
"sinon-chai": "^2.8.0",
104104
"supertest": "^4.0.2"
105-
},
106-
"volta": {
107-
"node": "12.22.12"
108105
}
109106
}

src/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import express from 'express';
22
import methodOverride from 'method-override';
33
import _ from 'lodash';
44
import bodyParser from 'body-parser';
5+
import expressSanitizer from 'express-sanitizer';
56
import config from 'config';
67
import cors from 'cors';
78
import coreLib from 'tc-core-library-js';
@@ -35,6 +36,7 @@ app.use(bodyParser.urlencoded({
3536
extended: false,
3637
}));
3738
app.use(bodyParser.json());
39+
app.use(expressSanitizer());
3840

3941
// add request Id
4042
const addRequestId = expressRequestId();

src/constants.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,6 @@ export const EVENT = {
139139
};
140140

141141
export const BUS_API_EVENT = {
142-
AV_SCAN_REQUEST: 'avscan.action.scan',
143-
144142
PROJECT_CREATED: 'project.action.create',
145143
PROJECT_UPDATED: 'project.action.update',
146144
PROJECT_DELETED: 'project.action.delete',
@@ -153,7 +151,6 @@ export const BUS_API_EVENT = {
153151
PROJECT_ATTACHMENT_ADDED: 'project.action.create',
154152
PROJECT_ATTACHMENT_REMOVED: 'project.action.delete',
155153
PROJECT_ATTACHMENT_UPDATED: 'project.action.update',
156-
PROJECT_ATTACHMENT_SCAN_RESULT: 'avscan.projects.assets.result',
157154

158155
// When phase is added/updated/deleted from the project,
159156
// When product is added/deleted from a phase

src/events/attachments/index.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

src/events/kafkaHandlers.js

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,6 @@ import {
1717
} from './projectPhases';
1818
import { timelineAdjustedKafkaHandler } from './timelines';
1919
import { milestoneUpdatedKafkaHandler } from './milestones';
20-
import {
21-
attachmentScanResultKafkaHandler,
22-
attachmentCreatedKafkaHandler,
23-
} from './attachments';
2420

2521
const kafkaHandlers = {
2622
/**
@@ -41,9 +37,6 @@ const kafkaHandlers = {
4137
// Events coming from timeline/milestones (considering it as a separate module/service in future)
4238
[CONNECT_NOTIFICATION_EVENT.MILESTONE_TRANSITION_COMPLETED]: milestoneUpdatedKafkaHandler,
4339
[CONNECT_NOTIFICATION_EVENT.TIMELINE_ADJUSTED]: timelineAdjustedKafkaHandler,
44-
45-
// Events coming from attachments
46-
[BUS_API_EVENT.PROJECT_ATTACHMENT_SCAN_RESULT]: attachmentScanResultKafkaHandler,
4740
};
4841

4942
/**
@@ -102,10 +95,6 @@ registerKafkaHandler(
10295
RESOURCES.PHASE,
10396
projectPhaseRemovedKafkaHandler,
10497
);
105-
registerKafkaHandler(
106-
BUS_API_EVENT.PROJECT_ATTACHMENT_ADDED,
107-
RESOURCES.ATTACHMENT,
108-
attachmentCreatedKafkaHandler,
109-
);
98+
11099

111100
export default kafkaHandlers;

src/routes/attachments/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ module.exports = [
7070

7171
const sourceBucket = data.s3Bucket;
7272
const sourceKey = data.path;
73-
const destBucket = config.get('attachmentsDMZS3Bucket');
73+
const destBucket = config.get('attachmentsS3Bucket');
7474
const destKey = path;
7575

7676
if (data.type === ATTACHMENT_TYPES.LINK) {

src/routes/projects/create.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import util from '../../util';
1414
import { PERMISSION } from '../../permissions/constants';
1515

1616
const traverse = require('traverse');
17-
const xss = require('xss');
1817

1918
/**
2019
* API to handle creating a new project.
@@ -419,11 +418,7 @@ module.exports = [
419418
// keep the raw '&&' string in conditions string in estimation
420419
const isEstimationCondition =
421420
(this.path.length === 3) && (this.path[0] === 'estimation') && (this.key === 'conditions');
422-
// if (this.isLeaf && typeof x === 'string' && (!isEstimationCondition)) this.update(req.sanitize(x));
423-
if (this.isLeaf && typeof x === 'string' && !isEstimationCondition) {
424-
const sanitizedData = xss(x);
425-
this.update(sanitizedData);
426-
}
421+
if (this.isLeaf && typeof x === 'string' && (!isEstimationCondition)) this.update(req.sanitize(x));
427422
});
428423
// override values
429424
_.assign(project, {

src/routes/projects/update.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import util from '../../util';
1515
import { PERMISSION } from '../../permissions/constants';
1616

1717
const traverse = require('traverse');
18-
const xss = require('xss');
1918

2019
/**
2120
* API to handle updating a project.
@@ -191,11 +190,7 @@ module.exports = [
191190
// prune any fields that cannot be updated directly
192191
updatedProps = _.omit(updatedProps, ['createdBy', 'createdAt', 'updatedBy', 'updatedAt', 'id']);
193192
traverse(updatedProps).forEach(function (x) { // eslint-disable-line func-names
194-
// if (x && this.isLeaf && typeof x === 'string') this.update(req.sanitize(x));
195-
if (x && this.isLeaf && typeof x === 'string') {
196-
const sanitizedData = xss(x);
197-
this.update(sanitizedData);
198-
}
193+
if (x && this.isLeaf && typeof x === 'string') this.update(req.sanitize(x));
199194
});
200195
let previousValue;
201196
models.sequelize.transaction(() => models.Project.findOne({

0 commit comments

Comments
 (0)