T09 · Insecure Skill Coding Practices
- Location
scripts/daily_review.py:48- Finding
Daily Review Collects Historical Memory Entries Outside the Requested Date
- Content
View full analysis
List[str]: """Extract decision records""" decisions = [] # Find lines containing decision-related keywords decision_keywords = ['decision', 'decided', 'chose', 'confirmed', 'adopted'] for line in content.split('\n'): if date in line or any(kw in line.lower() for kw in decision_keywords): if any(kw in line.lower() for kw in decision_keywords): decisions.append(line.strip()) return decisions[:10] # Limit quantity def _extract_learnings(self, content: str, date: str) -> List[str]: """Extract learning/lesson records""" learnings = [] learning_keywords = ['learned', 'lesson', 'experience', 'note', 'improve'] for line in content.split('\n'): if date in line or any(kw in line.lower() for kw in learning_keywords): if any(kw in line.lower() for kw in learning_keywords): learnings.append(line.strip()) return learnings[:10] ``` ### Technical Analysis The review workflow reads the complete `MEMORY.md` file and passes its contents to extraction functions that are intended to identify entries associated with the requested review date. However, the outer condition in each extraction function is logically ineffective as a date restriction: ```python if date in line or any(keyword_matches): ``` A line is accepted whenever it contains a ...[truncated 2574 chars]- Remediation
View remediation
list[str]: lines = content.splitlines() selected = [] in_target_section = False for line in lines: heading = re.match(r'^##\s+(\d{4}-\d{2}-\d{2})(?:\s+Review)?\s*$', line.strip()) if heading: in_target_section = heading.group(1) == date continue if in_target_section: selected.append(line) return selected ``` Keyword extraction should then operate exclusively on the returned target section. ]]>
