test: update playwright tests to support sha256 and sha512 algorithms (#19725)
* update to support sha256 and sha512 algorithms * Update bigbluebutton-tests/playwright/.env.template Co-authored-by: Anton Barboza de Sá <antonbsa.bck@gmail.com> --------- Co-authored-by: Anton Georgiev <antobinary@users.noreply.github.com> Co-authored-by: Anton Barboza de Sá <antonbsa.bck@gmail.com>
This commit is contained in:
parent
2fec7076b6
commit
fdbab50205
@ -1,6 +1,7 @@
|
|||||||
# meeting credentials
|
# meeting credentials
|
||||||
BBB_URL="" # https://DOMAIN_NAME/bigbluebutton/api
|
BBB_URL="" # https://DOMAIN_NAME/bigbluebutton/api
|
||||||
BBB_SECRET=""
|
BBB_SECRET=""
|
||||||
|
CHECKSUM="" # (sha1 | sha256 | sha512) Force a specific checksum algorithm. Useful for when the secret length is not a sha algorithm length
|
||||||
|
|
||||||
DEBUG_MODE="" # (true / false|empty) Enable or disable debug features
|
DEBUG_MODE="" # (true / false|empty) Enable or disable debug features
|
||||||
TIMEOUT_MULTIPLIER=1 # (number / empty) Apply a multiplier on default timeouts - depending the server strength (not recommended to use greater values than 3)
|
TIMEOUT_MULTIPLIER=1 # (number / empty) Apply a multiplier on default timeouts - depending the server strength (not recommended to use greater values than 3)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const sha1 = require('sha1');
|
const sha = require('sha.js');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const { test, expect } = require('@playwright/test');
|
const { test, expect } = require('@playwright/test');
|
||||||
const xml2js = require('xml2js');
|
const xml2js = require('xml2js');
|
||||||
@ -11,6 +11,24 @@ const { format } = require('node:util');
|
|||||||
const chalk = require('chalk');
|
const chalk = require('chalk');
|
||||||
const parameters = require('./parameters');
|
const parameters = require('./parameters');
|
||||||
|
|
||||||
|
function getChecksum(text, secret) {
|
||||||
|
let algorithm = (process.env.CHECKSUM || '').toLowerCase();
|
||||||
|
if (!['sha1', 'sha256', 'sha512'].includes(algorithm)) {
|
||||||
|
switch (secret.length) {
|
||||||
|
case 128:
|
||||||
|
algorithm = 'sha512';
|
||||||
|
break;
|
||||||
|
case 64:
|
||||||
|
algorithm = 'sha256';
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
default:
|
||||||
|
algorithm = 'sha1'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sha(algorithm).update(text).digest('hex');
|
||||||
|
}
|
||||||
|
|
||||||
function getRandomInt(min, max) {
|
function getRandomInt(min, max) {
|
||||||
min = Math.ceil(min);
|
min = Math.ceil(min);
|
||||||
max = Math.floor(max);
|
max = Math.floor(max);
|
||||||
@ -20,7 +38,7 @@ function getRandomInt(min, max) {
|
|||||||
function apiCallUrl(name, callParams) {
|
function apiCallUrl(name, callParams) {
|
||||||
const query = new URLSearchParams(callParams).toString();
|
const query = new URLSearchParams(callParams).toString();
|
||||||
const apiCall = `${name}${query}${parameters.secret}`;
|
const apiCall = `${name}${query}${parameters.secret}`;
|
||||||
const checksum = sha1(apiCall);
|
const checksum = getChecksum(apiCall, parameters.secret);
|
||||||
const url = `${parameters.server}/${name}?${query}&checksum=${checksum}`;
|
const url = `${parameters.server}/${name}?${query}&checksum=${checksum}`;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@ -38,7 +56,7 @@ function createMeetingUrl(params, createParameter, customMeetingId) {
|
|||||||
+ `&allowStartStopRecording=true&autoStartRecording=false&welcome=${params.welcome}`;
|
+ `&allowStartStopRecording=true&autoStartRecording=false&welcome=${params.welcome}`;
|
||||||
const query = createParameter !== undefined ? `${baseQuery}&${createParameter}` : baseQuery;
|
const query = createParameter !== undefined ? `${baseQuery}&${createParameter}` : baseQuery;
|
||||||
const apiCall = `create${query}${params.secret}`;
|
const apiCall = `create${query}${params.secret}`;
|
||||||
const checksum = sha1(apiCall);
|
const checksum = getChecksum(apiCall, parameters.secret);
|
||||||
const url = `${params.server}/create?${query}&checksum=${checksum}`;
|
const url = `${params.server}/create?${query}&checksum=${checksum}`;
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
@ -61,7 +79,7 @@ function getJoinURL(meetingID, params, moderator, joinParameter) {
|
|||||||
const baseQuery = `fullName=${params.fullName}&meetingID=${meetingID}&password=${pw}`;
|
const baseQuery = `fullName=${params.fullName}&meetingID=${meetingID}&password=${pw}`;
|
||||||
const query = joinParameter !== undefined ? `${baseQuery}&${joinParameter}` : baseQuery;
|
const query = joinParameter !== undefined ? `${baseQuery}&${joinParameter}` : baseQuery;
|
||||||
const apiCall = `join${query}${params.secret}`;
|
const apiCall = `join${query}${params.secret}`;
|
||||||
const checksum = sha1(apiCall);
|
const checksum = getChecksum(apiCall, parameters.secret);
|
||||||
return `${params.server}/join?${query}&checksum=${checksum}`;
|
return `${params.server}/join?${query}&checksum=${checksum}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
92
bigbluebutton-tests/playwright/package-lock.json
generated
92
bigbluebutton-tests/playwright/package-lock.json
generated
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"name": "npm-proj-1704469875970-0.78518707967153170VYA5e",
|
"name": "playwright",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
@ -11,7 +11,7 @@
|
|||||||
"deep-equal": "^2.2.1",
|
"deep-equal": "^2.2.1",
|
||||||
"dotenv": "^16.1.4",
|
"dotenv": "^16.1.4",
|
||||||
"playwright": "^1.37.1",
|
"playwright": "^1.37.1",
|
||||||
"sha1": "^1.1.1",
|
"sha.js": "^2.4.11",
|
||||||
"xml2js": "^0.6.0"
|
"xml2js": "^0.6.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -117,14 +117,6 @@
|
|||||||
"url": "https://github.com/chalk/chalk?sponsor=1"
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/charenc": {
|
|
||||||
"version": "0.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
|
|
||||||
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==",
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/color-convert": {
|
"node_modules/color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
@ -152,14 +144,6 @@
|
|||||||
"node": ">= 0.8"
|
"node": ">= 0.8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/crypt": {
|
|
||||||
"version": "0.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
|
||||||
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==",
|
|
||||||
"engines": {
|
|
||||||
"node": "*"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/deep-equal": {
|
"node_modules/deep-equal": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz",
|
||||||
@ -393,6 +377,11 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
"node_modules/internal-slot": {
|
"node_modules/internal-slot": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
|
||||||
@ -726,21 +715,40 @@
|
|||||||
"url": "https://github.com/sponsors/ljharb"
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/safe-buffer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"node_modules/sax": {
|
"node_modules/sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||||
},
|
},
|
||||||
"node_modules/sha1": {
|
"node_modules/sha.js": {
|
||||||
"version": "1.1.1",
|
"version": "2.4.11",
|
||||||
"resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||||
"integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==",
|
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"charenc": ">= 0.0.1",
|
"inherits": "^2.0.1",
|
||||||
"crypt": ">= 0.0.1"
|
"safe-buffer": "^5.0.1"
|
||||||
},
|
},
|
||||||
"engines": {
|
"bin": {
|
||||||
"node": "*"
|
"sha.js": "bin.js"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/side-channel": {
|
"node_modules/side-channel": {
|
||||||
@ -918,11 +926,6 @@
|
|||||||
"supports-color": "^7.1.0"
|
"supports-color": "^7.1.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"charenc": {
|
|
||||||
"version": "0.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
|
|
||||||
"integrity": "sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA=="
|
|
||||||
},
|
|
||||||
"color-convert": {
|
"color-convert": {
|
||||||
"version": "2.0.1",
|
"version": "2.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
@ -944,11 +947,6 @@
|
|||||||
"delayed-stream": "~1.0.0"
|
"delayed-stream": "~1.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"crypt": {
|
|
||||||
"version": "0.0.2",
|
|
||||||
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
|
|
||||||
"integrity": "sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow=="
|
|
||||||
},
|
|
||||||
"deep-equal": {
|
"deep-equal": {
|
||||||
"version": "2.2.1",
|
"version": "2.2.1",
|
||||||
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.1.tgz",
|
||||||
@ -1105,6 +1103,11 @@
|
|||||||
"has-symbols": "^1.0.2"
|
"has-symbols": "^1.0.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||||
|
},
|
||||||
"internal-slot": {
|
"internal-slot": {
|
||||||
"version": "1.0.5",
|
"version": "1.0.5",
|
||||||
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
|
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.5.tgz",
|
||||||
@ -1317,18 +1320,23 @@
|
|||||||
"functions-have-names": "^1.2.3"
|
"functions-have-names": "^1.2.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"safe-buffer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||||
|
},
|
||||||
"sax": {
|
"sax": {
|
||||||
"version": "1.2.4",
|
"version": "1.2.4",
|
||||||
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
|
||||||
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
|
||||||
},
|
},
|
||||||
"sha1": {
|
"sha.js": {
|
||||||
"version": "1.1.1",
|
"version": "2.4.11",
|
||||||
"resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz",
|
||||||
"integrity": "sha512-dZBS6OrMjtgVkopB1Gmo4RQCDKiZsqcpAQpkV/aaj+FCrCg8r4I4qMkDPQjBgLIxlmu9k4nUbWq6ohXahOneYA==",
|
"integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==",
|
||||||
"requires": {
|
"requires": {
|
||||||
"charenc": ">= 0.0.1",
|
"inherits": "^2.0.1",
|
||||||
"crypt": ">= 0.0.1"
|
"safe-buffer": "^5.0.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"side-channel": {
|
"side-channel": {
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
"deep-equal": "^2.2.1",
|
"deep-equal": "^2.2.1",
|
||||||
"dotenv": "^16.1.4",
|
"dotenv": "^16.1.4",
|
||||||
"playwright": "^1.37.1",
|
"playwright": "^1.37.1",
|
||||||
"sha1": "^1.1.1",
|
"sha.js": "^2.4.11",
|
||||||
"xml2js": "^0.6.0"
|
"xml2js": "^0.6.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user