T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/conformer_gen.py:48
- Finding
- Unbounded Computational Parameters Permit Resource Exhaustion## Vulnerability Details **File Locations**: - `scripts/conformer_gen.py:48-55` - `scripts/conformer_gen.py:175-180` - `scripts/stereoisomers.py:85-91` - `scripts/stereoisomers.py:184-196` - `scripts/recap_fragment.py:139-153` - `scripts/recap_fragment.py:231-244` **Vulnerability Type**: Uncontrolled resource consumption **Risk Level**: Medium ### Vulnerable Code `scripts/conformer_gen.py:48-55`: ```python # ETKDG parameters params = rdDistGeom.ETKDGv3() params.randomSeed = seed params.pruneRmsThresh = prune_rms params.numThreads = 0 # use all cores # Generate conformers conf_ids = rdDistGeom.EmbedMultipleConfs(mol, numConfs=num_confs, params=params) ``` `scripts/conformer_gen.py:175-180`: ```python parser.add_argument("--num_confs", type=int, default=10, help="Number of conformers") parser.add_argument("--optimize", choices=["mmff", "uff", "none"], default="mmff") parser.add_argument("--energy_window", type=float, default=None, help="Energy window in kcal/mol (filter high-energy confs)") parser.add_argument("--prune_rms", type=float, default=0.5, help="RMSD threshold for pruning similar conformers") ``` `scripts/stereoisomers.py:85-91`: ```python # Configure enumeration options opts = StereoEnumerationOptions() opts.onlyUnassigned = only_unassigned opts.maxIsomers = max_isomers opts.unique = unique # Enumerate isomers = list(EnumerateStereoisomers(mol, options=opts)) ``` `scripts/stereoisomers.py:184-196`: ```python parser.add_argument("--max_isomers", type=int, default=64) parser.add_argument("--only_unassigned", action="store_true", help="Only enumerate unassigned stereocenters") args = parser.parse_args() if args.action == "analyze": result = analyze_stereo(args.smiles) elif args.action == "compare": result = compare_enantiomers(args.smiles) else: result = enumerate_stereois ...[truncated 3040 chars]
- Remediation
- ## Remediation Suggestions - Enforce strict ranges for every caller-controlled numeric parameter. For example, limit conformers and stereoisomers to a deployment-approved maximum and restrict RECAP depth to a small positive value. - Reject zero, negative, non-finite, or otherwise nonsensical values. - Replace `params.numThreads = 0` with a small configurable upper bound. - Limit molecular complexity using atom count, heavy-atom count, rotatable-bond count, ring count, and potential stereocenter count rather than relying only on SMILES length. - Apply process-level CPU, memory, and wall-clock limits around RDKit operations. - Avoid eagerly materializing potentially large generators where incremental processing is possible. - Apply request quotas and concurrency controls when exposing these scripts through an Agent or service interface. - Return a controlled error when an input exceeds the permitted complexity or resource budget.
