v0.5.175: safeReturn fix, stack trace не утекает
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ipwhitelist",
|
"name": "ipwhitelist",
|
||||||
"version": "0.5.174",
|
"version": "0.5.175",
|
||||||
"description": "IP WhiteList microservice for cloud provider",
|
"description": "IP WhiteList microservice for cloud provider",
|
||||||
"main": "server.js",
|
"main": "server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ async function start() {
|
|||||||
? (err.stack || err.message || String(err))
|
? (err.stack || err.message || String(err))
|
||||||
: JSON.stringify(err);
|
: JSON.stringify(err);
|
||||||
console.error('Unhandled error:', ctx, detail);
|
console.error('Unhandled error:', ctx, detail);
|
||||||
res.status(500).send('Ошибка [' + ctx.url + '] user=' + ctx.user + ' clientId=' + ctx.clientId + ' — ' + detail.slice(0, 500));
|
res.status(500).send('Внутренняя ошибка сервера');
|
||||||
});
|
});
|
||||||
|
|
||||||
// ── Старт сервера ─────────────────────────────────────────────────────────────
|
// ── Старт сервера ─────────────────────────────────────────────────────────────
|
||||||
|
|||||||
+1
-1
@@ -528,7 +528,7 @@ function httpPost(url, body, headers) {
|
|||||||
* Защита от open redirect: //evil.com и https://evil.com → '/'.
|
* Защита от open redirect: //evil.com и https://evil.com → '/'.
|
||||||
*/
|
*/
|
||||||
function safeReturn(target) {
|
function safeReturn(target) {
|
||||||
if (typeof target === 'string' && target.startsWith('/') && !target.startsWith('//')) {
|
if (typeof target === 'string' && target.startsWith('/') && !target.startsWith('//') && target[1] !== '\\') {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
return '/';
|
return '/';
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
version: '0.5.174',
|
version: '0.5.175',
|
||||||
|
|
||||||
// ── IAM ──────────────────────────────────────────────────────────────────
|
// ── IAM ──────────────────────────────────────────────────────────────────
|
||||||
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',
|
||||||
|
|||||||
Reference in New Issue
Block a user