- 在 AdminIntegrationSiteStoreRequest 和 AdminIntegrationSiteUpdateRequest 中引入 WalletApiUrlRule,确保 wallet_api_url 字段符合 HTTPS 公开域名要求。 - 更新 HttpMainSiteWalletBalanceClient 和 HttpMainSiteWalletGateway,使用 WalletApiUrlSanitizer 进行 URL 规范化与验证,防止 SSRF 攻击。 - 新增测试用例,验证 wallet_api_url 的有效性,确保系统安全性与稳定性。 - 更新 .env.example 文件,添加 LOTTERY_RISK_POOL_USE_REDIS_LUA 配置项以支持 Redis Lua 原子扣减功能。 - 修改 package-lock.json 中的项目名称,确保一致性。 - 在 API 路由中新增 integration/runtime-origins 路由,提供运行时白名单功能。
36 lines
1.3 KiB
PHP
36 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Admin;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Validation\Rule;
|
|
use App\Rules\WalletApiUrlRule;
|
|
|
|
final class AdminIntegrationSiteStoreRequest extends FormRequest
|
|
{
|
|
public function authorize(): bool
|
|
{
|
|
return true;
|
|
}
|
|
|
|
/** @return array<string, mixed> */
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'code' => ['required', 'string', 'max:64', 'regex:/^[a-z0-9][a-z0-9_-]*$/', Rule::unique('admin_sites', 'code')],
|
|
'name' => ['required', 'string', 'max:128'],
|
|
'currency_code' => ['sometimes', 'string', 'max:16'],
|
|
'status' => ['sometimes', 'integer', 'in:0,1'],
|
|
'wallet_api_url' => ['nullable', 'string', 'max:512', new WalletApiUrlRule()],
|
|
'wallet_debit_path' => ['sometimes', 'string', 'max:128'],
|
|
'wallet_credit_path' => ['sometimes', 'string', 'max:128'],
|
|
'wallet_balance_path' => ['sometimes', 'string', 'max:128'],
|
|
'wallet_timeout_seconds' => ['sometimes', 'integer', 'min:1', 'max:120'],
|
|
'iframe_allowed_origins' => ['nullable', 'array'],
|
|
'iframe_allowed_origins.*' => ['string', 'max:512'],
|
|
'lottery_h5_base_url' => ['nullable', 'string', 'max:512'],
|
|
'notes' => ['nullable', 'string', 'max:5000'],
|
|
];
|
|
}
|
|
}
|