T09 · Insecure Skill Coding Practices
- Location
scripts/bazi_chart.py:112- Finding
Unbounded Year-Range Input Can Cause Resource Exhaustion
- Content
View full analysis
- Remediation
View remediation
int: count = int(value) if not 1 <= count <= 100: raise argparse.ArgumentTypeError("years must be between 1 and 100") return count ap.add_argument( '--years', type=bounded_year_count, default=10, help='Number of annual results to generate, from 1 to 100' ) ``` 3. Validate `--from-year` and the computed ending year against the calendar range supported by `lunar_python`. 4. If invoked by a network-facing or multi-user service, also enforce request timeouts, per-user rate limits, memory limits, and CPU quotas. These controls should supplement rather than replace input validation. 5. Add regression tests covering zero, negative, maximum permitted, above-maximum, and unsupported year-range inputs. ]]>
