Skip to content

Commit fa05570

Browse files
szsanyiSanyibognartomi
authored
Ema 145 security issues fix (#63)
Co-authored-by: Sanyi <[email protected]> Co-authored-by: bognar.tamas <[email protected]>
1 parent f5f5326 commit fa05570

29 files changed

+195
-156
lines changed

.github/workflows/tests.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
permissions:
1313
contents: "read"
1414
strategy:
15-
max-parallel: 2
15+
max-parallel: 1
1616
fail-fast: false
1717
matrix:
1818
magento-versions:
19-
["2.3.3ce", "2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
19+
["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
2020
steps:
2121
- name: Extract branch name
2222
shell: bash
@@ -48,24 +48,31 @@ jobs:
4848
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
4949
sudo apt-get update
5050
sudo apt-get install docker-compose-plugin -y
51+
- name: Build mage_node image
52+
shell: bash
53+
run: |
54+
cd magento2-extension/dev
55+
docker build -f testv2/tools/docker/Dockerfile-mage-node --build-arg NPM_TOKEN=$NPM_TOKEN -t "mage_node" .
56+
env:
57+
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}
5158
- name: Run unittest
5259
shell: bash
5360
run: |
5461
cd magento2-extension
5562
bash dev/testv2/tools/scripts/run-unit.sh
5663
env:
5764
VERSION: ${{ matrix.magento-versions }}
58-
NPM_TOKEN: ${{ secrets.NPM_DEPLOYER_TOKEN }}
65+
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}
5966
e2e-tests:
6067
runs-on: github-actions-runner-emarsys
6168
permissions:
6269
contents: "read"
6370
strategy:
64-
max-parallel: 2
71+
max-parallel: 1
6572
fail-fast: false
6673
matrix:
6774
magento-versions:
68-
["2.3.3ce", "2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
75+
["2.3.5ce", "2.4.0ce", "2.4.2ce", "2.4.4ce", "2.4.6ce"]
6976
steps:
7077
- name: Extract branch name
7178
shell: bash
@@ -97,11 +104,18 @@ jobs:
97104
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
98105
sudo apt-get update
99106
sudo apt-get install docker-compose-plugin -y
107+
- name: Build mage_node image
108+
shell: bash
109+
run: |
110+
cd magento2-extension/dev
111+
docker build -f testv2/tools/docker/Dockerfile-mage-node --build-arg NPM_TOKEN=$NPM_TOKEN -t "mage_node" .
112+
env:
113+
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}
100114
- name: Run e2stest
101115
shell: bash
102116
run: |
103117
cd magento2-extension
104118
bash dev/testv2/tools/scripts/run-e2e.sh
105119
env:
106120
VERSION: ${{ matrix.magento-versions }}
107-
NPM_TOKEN: ${{ secrets.NPM_DEPLOYER_TOKEN }}
121+
NPM_TOKEN: ${{ secrets.GITLAB_TOKEN }}

dev/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,3 +203,4 @@ git push -f --tags
203203
## Update Cypress
204204
* Update the version in `package.json`
205205
* Run `make build-cypress VERSION=new-version` from project root
206+

dev/testv2/.npmrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
always-auth=true
2+
@itg-commerce:registry=https://gitlab.itg.cloud/api/v4/projects/295/packages/npm/
3+
//gitlab.itg.cloud/api/v4/projects/295/packages/npm/:_authToken=${NPM_TOKEN}

dev/testv2/attributes/index.spec.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ const websiteId = 1;
66

77
const mapAttributes = attributes => attributes.map(attribute => ({ code: attribute.code, name: attribute.name }));
88

9-
describe('Attributes endpoint', function() {
10-
afterEach(async function() {});
9+
describe('Attributes endpoint', function () {
10+
afterEach(async function () {});
1111

12-
after(async function() {});
12+
after(async function () {});
1313

14-
describe('get', function() {
15-
it('should fetch attributes including extra fields for customer', async function() {
14+
describe('get', function () {
15+
it('should fetch attributes including extra fields for customer', async function () {
1616
const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'customer' });
1717
const mappedAttributes = mapAttributes(attributes);
1818

@@ -29,7 +29,7 @@ describe('Attributes endpoint', function() {
2929
}
3030
});
3131

32-
it('should fetch attributes including extra fields for customer_address', async function() {
32+
it('should fetch attributes including extra fields for customer_address', async function () {
3333
const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'customer_address' });
3434
const mappedAttributes = mapAttributes(attributes);
3535

@@ -40,7 +40,7 @@ describe('Attributes endpoint', function() {
4040
}
4141
});
4242

43-
it('should fetch attributes including extra fields for products', async function() {
43+
it('should fetch attributes including extra fields for products', async function () {
4444
const { attributes } = await this.magentoApi.execute('attributes', 'get', { type: 'product' });
4545
const mappedAttributes = attributes.map(attribute => {
4646
return { code: attribute.code, name: attribute.name };
@@ -58,8 +58,8 @@ describe('Attributes endpoint', function() {
5858
});
5959
});
6060

61-
describe('set', function() {
62-
it('should modify customer attribute config for website', async function() {
61+
describe('set', function () {
62+
it('should modify customer attribute config for website', async function () {
6363
await this.magentoApi.execute('attributes', 'set', {
6464
websiteId,
6565
type: 'customer',
@@ -76,7 +76,7 @@ describe('Attributes endpoint', function() {
7676
expect(config.value).to.equal(JSON.stringify(['hello_attribute']));
7777
});
7878

79-
it('should modify customer_address attribute config for website', async function() {
79+
it('should modify customer_address attribute config for website', async function () {
8080
await this.magentoApi.execute('attributes', 'set', {
8181
websiteId,
8282
type: 'customer_address',
@@ -93,7 +93,7 @@ describe('Attributes endpoint', function() {
9393
expect(config.value).to.equal(JSON.stringify(['hello_attribute']));
9494
});
9595

96-
it('should modify product attribute config for website', async function() {
96+
it('should modify product attribute config for website', async function () {
9797
await this.magentoApi.execute('attributes', 'set', {
9898
websiteId: 0,
9999
type: 'product',

dev/testv2/config/index.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,21 @@ const dbKeys = {
2121
};
2222

2323
const websiteId = 1;
24-
describe('Config endpoint', function() {
25-
before(async function() {
24+
describe('Config endpoint', function () {
25+
before(async function () {
2626
await this.turnOffEverySetting(1);
2727
});
2828

29-
afterEach(async function() {
29+
afterEach(async function () {
3030
await this.turnOffEverySetting(1);
3131
});
3232

33-
after(async function() {
33+
after(async function () {
3434
await this.setDefaultStoreSettings();
3535
});
3636

37-
describe('set', function() {
38-
it('should modify config values for website', async function() {
37+
describe('set', function () {
38+
it('should modify config values for website', async function () {
3939
await this.magentoApi.execute('config', 'set', {
4040
websiteId,
4141
config: fullConfig

dev/testv2/customers/list.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ const customers = [
2323
}
2424
];
2525

26-
describe('Customers endpoint', function() {
27-
before(async function() {
26+
describe('Customers endpoint', function () {
27+
before(async function () {
2828
await this.magentoApi.execute('attributes', 'set', {
2929
websiteId: 1,
3030
type: 'customer',
@@ -35,7 +35,7 @@ describe('Customers endpoint', function() {
3535
}
3636
});
3737

38-
after(async function() {
38+
after(async function () {
3939
await this.magentoApi.execute('attributes', 'set', {
4040
websiteId: 1,
4141
type: 'customer',
@@ -44,7 +44,7 @@ describe('Customers endpoint', function() {
4444
await this.db.raw(`DELETE FROM ${this.getTableName('customer_entity')} where email like "%@customer.net"`);
4545
});
4646

47-
it('returns customers according to page and page_size inlcuding last_page', async function() {
47+
it('returns customers according to page and page_size inlcuding last_page', async function () {
4848
const page = 1;
4949
const limit = 2;
5050

@@ -66,7 +66,7 @@ describe('Customers endpoint', function() {
6666
expect(customer).to.have.property('shipping_address');
6767
});
6868

69-
it('returns extra_fields for customers', async function() {
69+
it('returns extra_fields for customers', async function () {
7070
const page = 1;
7171
const limit = 1;
7272

dev/testv2/cypress.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ const { defineConfig } = require('cypress');
33
module.exports = defineConfig({
44
video: false,
55
trashAssetsBeforeRuns: false,
6-
requestTimeout: 30000,
7-
defaultCommandTimeout: 30000,
8-
pageLoadTimeout: 30000,
6+
requestTimeout: 120000,
7+
defaultCommandTimeout: 120000,
8+
pageLoadTimeout: 120000,
99
blockHosts: ['*snippet.url.com', '*scarabresearch.com'],
1010
env: {
1111
snippetUrl: 'http://snippet.url.com/main.js'

dev/testv2/cypress/integration/default-behaviour.spec.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
describe('Default behaviour with everything turned off', function() {
3+
describe('Default behaviour with everything turned off', function () {
44
before(() => {
55
cy.task('setConfig', {});
66
});
@@ -14,13 +14,13 @@ describe('Default behaviour with everything turned off', function() {
1414
cy.task('clearMails');
1515
});
1616

17-
context('MarketingEvents - Customer', function() {
17+
context('MarketingEvents - Customer', function () {
1818
afterEach(() => {
1919
cy.task('clearEvents');
2020
cy.logout();
2121
});
2222

23-
it('should not create customer_password_reset event', function() {
23+
it('should not create customer_password_reset event', function () {
2424
const newPassword = 'newPassword1';
2525

2626
cy.loginWithCustomer(this.defaultCustomer);
@@ -36,7 +36,7 @@ describe('Default behaviour with everything turned off', function() {
3636
});
3737
});
3838

39-
it('should not create customer_email_changed event', function() {
39+
it('should not create customer_email_changed event', function () {
4040
const oldEmail = this.defaultCustomer.email;
4141
const newEmail = '[email protected]';
4242

@@ -52,7 +52,7 @@ describe('Default behaviour with everything turned off', function() {
5252
});
5353
});
5454

55-
it('should not create customer_email_and_password_changed event', function() {
55+
it('should not create customer_email_and_password_changed event', function () {
5656
const newEmail = '[email protected]';
5757
const newPassword = 'newPassword4';
5858

@@ -70,7 +70,7 @@ describe('Default behaviour with everything turned off', function() {
7070
});
7171
});
7272

73-
context('MarketingEvents - Subscription', function() {
73+
context('MarketingEvents - Subscription', function () {
7474
const unsubscribe = email => {
7575
cy.task('getSubscription', email).then(subscription => {
7676
cy.visit(`/newsletter/subscriber/unsubscribe?id=${subscription.subscriber_id}\
@@ -84,8 +84,8 @@ describe('Default behaviour with everything turned off', function() {
8484
cy.get('.action.subscribe.primary[type="submit"]').click();
8585
};
8686

87-
context('guest with double optin off', function() {
88-
it('should not create subscription events', function() {
87+
context('guest with double optin off', function () {
88+
it('should not create subscription events', function () {
8989
const guestEmail = '[email protected]';
9090
subscribe(guestEmail);
9191

@@ -110,7 +110,7 @@ describe('Default behaviour with everything turned off', function() {
110110
});
111111
});
112112

113-
context('guest with double optin on', function() {
113+
context('guest with double optin on', function () {
114114
before(() => {
115115
cy.task('setDoubleOptin', true);
116116
cy.task('flushMagentoCache');
@@ -120,7 +120,7 @@ describe('Default behaviour with everything turned off', function() {
120120
cy.task('setDoubleOptin', false);
121121
});
122122

123-
it('should not create subscription events', function() {
123+
it('should not create subscription events', function () {
124124
const guestEmail = '[email protected]';
125125
subscribe(guestEmail);
126126

dev/testv2/cypress/integration/marketing-events-customer.spec.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
describe('Marketing Events', function() {
3+
describe('Marketing Events', function () {
44
beforeEach(() => {
55
cy.task('clearMails');
66
cy.task('getDefaultCustomer').as('defaultCustomer');
@@ -10,7 +10,7 @@ describe('Marketing Events', function() {
1010
cy.logout();
1111
});
1212

13-
context('magentoSendEmails config is disabled', function() {
13+
context('magentoSendEmails config is disabled', function () {
1414
before(() => {
1515
cy.task('setConfig', {
1616
collectMarketingEvents: 'enabled',
@@ -19,7 +19,7 @@ describe('Marketing Events', function() {
1919
cy.task('clearEvents');
2020
});
2121

22-
it('should create customer_password_reset event', function() {
22+
it('should create customer_password_reset event', function () {
2323
const newPassword = 'newPassword2';
2424

2525
cy.loginWithCustomer(this.defaultCustomer);
@@ -36,7 +36,7 @@ describe('Marketing Events', function() {
3636
});
3737
});
3838

39-
it('should create customer_email_changed event', function() {
39+
it('should create customer_email_changed event', function () {
4040
const newEmail = '[email protected]';
4141

4242
cy.loginWithCustomer(this.defaultCustomer);
@@ -53,7 +53,7 @@ describe('Marketing Events', function() {
5353
});
5454
});
5555

56-
it('should create customer_email_and_password_changed event', function() {
56+
it('should create customer_email_and_password_changed event', function () {
5757
const newEmail = '[email protected]';
5858
const newPassword = 'newPassword3';
5959

@@ -72,7 +72,7 @@ describe('Marketing Events', function() {
7272
});
7373
});
7474

75-
context('magentoSendEmails config is enabled', function() {
75+
context('magentoSendEmails config is enabled', function () {
7676
before(() => {
7777
cy.task('setConfig', {
7878
collectMarketingEvents: 'enabled',
@@ -81,7 +81,7 @@ describe('Marketing Events', function() {
8181
cy.task('clearEvents');
8282
});
8383

84-
it('should create customer_password_reset event', function() {
84+
it('should create customer_password_reset event', function () {
8585
const newPassword = 'newPassword2';
8686

8787
cy.loginWithCustomer(this.defaultCustomer);
@@ -98,7 +98,7 @@ describe('Marketing Events', function() {
9898
});
9999
});
100100

101-
it('should create customer_email_changed event', function() {
101+
it('should create customer_email_changed event', function () {
102102
const oldEmail = this.defaultCustomer.email;
103103
const newEmail = '[email protected]';
104104

@@ -116,7 +116,7 @@ describe('Marketing Events', function() {
116116
});
117117
});
118118

119-
it('should create customer_email_and_password_changed event', function() {
119+
it('should create customer_email_and_password_changed event', function () {
120120
const oldEmail = this.defaultCustomer.email;
121121
const newEmail = '[email protected]';
122122
const newPassword = 'newPassword3';

0 commit comments

Comments
 (0)