v0.5.175: safeReturn fix, stack trace не утекает

This commit is contained in:
2026-06-22 19:31:11 +04:00
parent df697cd703
commit 68c3edd8d8
4 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "ipwhitelist",
"version": "0.5.174",
"version": "0.5.175",
"description": "IP WhiteList microservice for cloud provider",
"main": "server.js",
"scripts": {
+1 -1
View File
@@ -109,7 +109,7 @@ async function start() {
? (err.stack || err.message || String(err))
: JSON.stringify(err);
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
View File
@@ -528,7 +528,7 @@ function httpPost(url, body, headers) {
* Защита от open redirect: //evil.com и https://evil.com → '/'.
*/
function safeReturn(target) {
if (typeof target === 'string' && target.startsWith('/') && !target.startsWith('//')) {
if (typeof target === 'string' && target.startsWith('/') && !target.startsWith('//') && target[1] !== '\\') {
return target;
}
return '/';
+1 -1
View File
@@ -8,7 +8,7 @@
// ═══════════════════════════════════════════════════════════════════════════════
module.exports = {
version: '0.5.174',
version: '0.5.175',
// ── IAM ──────────────────────────────────────────────────────────────────
iamUrl: process.env.V2_IAM_URL || 'https://auth-api.ngcloud.ru/api/v1/auth/user',