sec: scope app review 1234 bypass exclusively to siro tenant

This commit is contained in:
Hamza-Ayed
2026-07-18 22:57:12 +03:00
parent 898136bc1b
commit 840d0e54fe
2 changed files with 5 additions and 4 deletions
+4 -3
View File
@@ -84,7 +84,8 @@ export class AuthService {
await this.redis.set(this.otpKey(tenant.id, canonical), code, 'EX', ttl); await this.redis.set(this.otpKey(tenant.id, canonical), code, 'EX', ttl);
// أرقام مخصصة لاختبارات E2E ومراجعي Apple/Google (لا تستهلك رصيد). // أرقام مخصصة لاختبارات E2E ومراجعي Apple/Google (لا تستهلك رصيد).
const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical); // مقيدة فقط بـ tenant سيرو (النسخة التجريبية) لمنع الدخول بها في بيئة حقيقية.
const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical) && tenant.slug === 'siro';
if (this.devMode || isAppReviewAccount) { if (this.devMode || isAppReviewAccount) {
this.logger.log(`OTP (dev/review) tenant=${tenant.slug} phone=${canonical} => ${code}`); this.logger.log(`OTP (dev/review) tenant=${tenant.slug} phone=${canonical} => ${code}`);
return { success: true, message: 'OTP sent (dev)', dev_code: code }; return { success: true, message: 'OTP sent (dev)', dev_code: code };
@@ -107,8 +108,8 @@ export class AuthService {
// بصيغة مختلفة قليلاً عن مرة الإرسال (مثال المالك: "01" مقابل "1"). // بصيغة مختلفة قليلاً عن مرة الإرسال (مثال المالك: "01" مقابل "1").
const canonical = this.phones.normalize(phone, tenant.countryPack); const canonical = this.phones.normalize(phone, tenant.countryPack);
// في وضع التطوير أو حسابات مراجعة آبل/جوجل: الرمز الثابت 1234 يمرّ دائماً. // تجاوز التطوير وحسابات المراجعة (مقيد بـ tenant سيرو فقط)
const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical); const isAppReviewAccount = ['962790000001', '962790000002'].includes(canonical) && tenant.slug === 'siro';
const devBypass = (this.devMode || isAppReviewAccount) && code === '1234'; const devBypass = (this.devMode || isAppReviewAccount) && code === '1234';
if (!devBypass) { if (!devBypass) {
const attemptsKey = this.otpAttemptsKey(tenant.id, canonical); const attemptsKey = this.otpAttemptsKey(tenant.id, canonical);
@@ -36,7 +36,7 @@ export class DriversService {
data: Partial<Driver>, data: Partial<Driver>,
): Promise<Driver> { ): Promise<Driver> {
const user = await this.users.findById(tenantId, userId); 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); let driver = await this.findByUser(tenantId, userId);
if (!driver) { if (!driver) {