T09 · Insecure Skill Coding Practices
- Location
scripts/pod-template-generator.py:67- Finding
Unbounded Keyword Generation Loop Allows Denial of Service
- Content
View full analysis
- Remediation
View remediation
max_combinations: raise ValueError( f"count cannot exceed {max_combinations} for the supplied inputs" ) ``` 4. Prefer a bounded algorithm that constructs the Cartesian product, shuffles it, and takes a slice: ```python import random from itertools import product pairs = list(product(style_words, scenario_words)) random.Random(42).shuffle(pairs) selected_pairs = pairs[:count] ``` 5. Normalize comma-separated input by trimming whitespace and rejecting empty entries: ```python style_list = ( [item.strip() for item in args.styles.split(",") if item.strip()] if args.styles else None ) ``` 6. Add tests for zero, negative, excessively large, empty, and over-capacity input values. 7. Apply an execution timeout at the agent or worker boundary as defense in depth. ]]>
