From 840d0e54feb9cf531d58d52f96329810016d878f Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sat, 18 Jul 2026 22:57:12 +0300 Subject: [PATCH] sec: scope app review 1234 bypass exclusively to siro tenant --- backend/src/modules/auth/auth.service.ts | 7 ++++--- backend/src/modules/drivers/drivers.service.ts | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/src/modules/auth/auth.service.ts b/backend/src/modules/auth/auth.service.ts index ab25f54..bce9434 100644 --- a/backend/src/modules/auth/auth.service.ts +++ b/backend/src/modules/auth/auth.service.ts @@ -84,7 +84,8 @@ export class AuthService { await this.redis.set(this.otpKey(tenant.id, canonical), code, 'EX', ttl); // أرقام مخصصة لاختبارات E2E ومراجعي Apple/Google (لا تستهلك رصيد). - const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical); + // مقيدة فقط بـ tenant سيرو (النسخة التجريبية) لمنع الدخول بها في بيئة حقيقية. + const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical) && tenant.slug === 'siro'; if (this.devMode || isAppReviewAccount) { this.logger.log(`OTP (dev/review) tenant=${tenant.slug} phone=${canonical} => ${code}`); return { success: true, message: 'OTP sent (dev)', dev_code: code }; @@ -107,8 +108,8 @@ export class AuthService { // بصيغة مختلفة قليلاً عن مرة الإرسال (مثال المالك: "01" مقابل "1"). const canonical = this.phones.normalize(phone, tenant.countryPack); - // في وضع التطوير أو حسابات مراجعة آبل/جوجل: الرمز الثابت 1234 يمرّ دائماً. - const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical); + // تجاوز التطوير وحسابات المراجعة (مقيد بـ tenant سيرو فقط) + const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical) && tenant.slug === 'siro'; const devBypass = (this.devMode || isAppReviewAccount) && code === '1234'; if (!devBypass) { const attemptsKey = this.otpAttemptsKey(tenant.id, canonical); diff --git a/backend/src/modules/drivers/drivers.service.ts b/backend/src/modules/drivers/drivers.service.ts index d2e113f..4c18d34 100644 --- a/backend/src/modules/drivers/drivers.service.ts +++ b/backend/src/modules/drivers/drivers.service.ts @@ -36,7 +36,7 @@ export class DriversService { data: Partial, ): Promise { const user = await this.users.findById(tenantId, userId); - const isAppReview = ['962790000001', '962790000002'].includes(user?.phone ?? ''); + const isAppReview = ['962790000001', '962790000002'].includes(user?.phone ?? '') && tenantId === 'siro'; let driver = await this.findByUser(tenantId, userId); if (!driver) {