T09 · Insecure Skill Coding Practices
- Location
SKILL.md:134- Finding
Unbounded DOCX Table Dimensions Permit Resource Exhaustion
- Content
View full analysis
current_rows: for _ in range(total_needed_rows - current_rows): table.add_row() elif total_needed_rows < current_rows: self._delete_rows_from_end(table, current_rows - total_needed_rows) if target_cols != current_cols: self._resize_columns(table, target_cols) def _resize_columns(self, table, target_cols): """调整表格列数""" current_cols = len(table.columns) tbl = table._tbl tblGrid = tbl.find(qn('w:tblGrid')) if target_cols > current_cols: for _ in range(target_cols - current_cols): gridCol = OxmlElement('w:gridCol') tblGrid.append(gridCol) for row in table.rows: for _ in range(target_cols - current_cols): tc ...[truncated 2180 chars]- Remediation
View remediation
MAX_TABLE_CELLS: raise ValueError("Requested table size exceeds the permitted cell budget") # Invoke this before storing or applying the dimensions. self._validate_table_dimensions(row_idx, target_rows, target_cols) ``` The runtime environment should additionally enforce memory and execution-time limits as defense in depth. ]]>
