T09 · Insecure Skill Coding Practices
- Location
scripts/analyse_bookmarks.py:121- Finding
Untrusted bookmark content is passed into agent analysis without an explicit instruction boundary
- Content
View full analysis
dict: """Analyse a single bookmark and return enriched data.""" text = bookmark.get("text", "") author = bookmark.get("author_username", bookmark.get("username", "unknown")) bm_id = bookmark.get("id", "") created = bookmark.get("created_at", "") # Handle nested author object (X API v2 format with expansions) if isinstance(bookmark.get("author"), dict): author = bookmark["author"].get("username", author) urls = extract_urls(text) # Also check entities.urls if present (X API v2) entities = bookmark.get("entities", {}) if isinstance(entities, dict): for url_entity in entities.get("urls", []): expanded = url_entity.get("expanded_url", "") if expanded and expanded not in urls: urls.append(expanded) github_repos = extract_github_repos(urls) category = categorise(text, urls) relevance = score_relevance(text, urls, category) return { "id": bm_id, "text": text[:500], # Truncate very long tweets "author": f"@{author}" if not author.startswith("@") else author, "created_at": created, "category": category, "relevance": relevance, "urls": urls, "github_repos": github_repos, "keywords": extract_keywords(text), } ``` The related agent instructions consume this output as follows: ```markdown ### Step 3: Analyse Bookmarks Pipe the fetched bookmarks through the analyser: ```bash python3 {baseDir}/scripts/fetch_bookmarks.py --count 50 | python3 {baseDir}/scripts/analyse_bookmarks.py ``` ... ### Step 5: Decide on Actions For each high-value bookmark, decide: | Bookmark Type | Action | |-- ...[truncated 2783 chars]- Remediation
View remediation
