T09 · Insecure Skill Coding Practices
- Location
scripts/formora.py:143- Finding
Shared Advertising Budget Caps Can Be Bypassed Through Repeated Launches
- Content
View full analysis
= day_start: daily += amount if ts >= week_start: weekly += amount return { "daily_spent_cny": round(daily, 2), "weekly_spent_cny": round(weekly, 2), "daily_remaining_cny": round(max(0.0, SAFE_DAILY_CAP_CNY - daily), 2), "weekly_remaining_cny": round(max(0.0, SAFE_WEEKLY_CAP_CNY - weekly), 2), "shared_daily_cap_cny": SAFE_DAILY_CAP_CNY, "shared_weekly_cap_cny": SAFE_WEEKLY_CAP_CNY, } def validate_ads_budget(daily_budget_cny, weekly_budget_cny, state): errors = [] if daily_budget_cny is None or weekly_budget_cny is None: errors.append("Both --daily-budget-cny and --weekly-budget-cny are required for ads-launch.") return errors if daily_budget_cny <= 0 or weekly_budget_cny <= 0: errors.append("Budgets must be positive.") if daily_budget_cny > SAFE_DAILY_CAP_CNY: errors.append(f"Requested daily budget {daily_budget_cny} exceeds shared daily cap {SAFE_DAILY_CAP_CNY} CNY.") if weekly_budget_cny > SAFE_WEEKLY_CAP_CNY: errors.append(f"Requested weekly budget {weekly_budget_cny} exceeds shared weekly cap {SAFE_WEEKLY_CAP_CNY} CNY.") summary = get_spend_summary(state) if daily_budget_cny > summary["daily_remaining_cny"]: ...[truncated 5478 chars]- Remediation
View remediation
