T09 · Insecure Skill Coding Practices
- Location
scripts/valu_app.py:1057- Finding
Batch Analysis Bypasses Quota and Billing Enforcement
- Content
View full analysis
Dict[str, Any]: self.log.info(f"Starting batch analysis for {symbols}") max_stocks = self.config.batch_max_stocks if len(symbols) < 2: return {'success': False, 'error': 'At least 2 stocks required', 'error_code': 'INVALID_INPUT'} if len(symbols) > max_stocks: return {'success': False, 'error': f'Max {max_stocks} stocks allowed', 'error_code': 'INVALID_INPUT'} stock_results = [] for symbol in symbols: price_result = self.data_service.get_historical_prices(symbol) basic_result = self.data_service.get_basic_info(symbol) stock_results.append({ 'symbol': symbol, 'name': basic_result['data'].get('stock_name', symbol), 'price_data': price_result['data'] if price_result['success'] else None, 'basic_info': basic_result['data'], 'success': price_result['success'] }) time.sleep(0.5) comparator = StockComparator() comparison = comparator.compare_stocks(stock_results) report = comparator.generate_comparison_report() report = self.report_service.add_disclaimer(report) filepath = self.report_service.save_report(report, f"batch_{'_'.join(symbols)}") return { 'success': True, 'stocks': symbols, 'stocks_analyzed': len([s for s in stock_results if s['success']]), 'comparison': comparison, 'report': report, 'report_file': filepath } ``` Related batch authorization and charging functions exist in `scripts/valu_pricing.py:268-309`, but the application does not call them: ```python def can_use_batch(self, user_id: str) -> bool: user = self.quota_manager._init_user(user_id) if user.get("credits", 0) >= PRICING["batch_ ...[truncated 2128 chars]- Remediation
View remediation
