BaiseAI Playground

Configure path routing parameters and map blueprint structures.

{ "is_expert": false, "annotation_type_category": "", "annotation_type": "", "label_behavior": "", "labels": [ "Category A", "Category B" ], "column_mapping": {} }
// Annotation engine interaction hooks stream details here
{
  "id": 1,
  "data": {
    "instruction": "Identify any bugs, exceptions, or edge cases this code fails to handle.",
    "code_snippet": "import hashlib\nimport os\nfrom typing import List, Optional\n\n\nclass UserAccountManager:\n    def __init__(self, db_connection):\n        self.db = db_connection\n        self.cache = {}\n        self.max_login_attempts = 3\n\n    def hash_password(self, password):\n        # Weak hashing algorithm, no salt\n        return hashlib.md5(password.encode()).hexdigest()\n\n    def create_user(self, username, password, email=None):\n        hashed = self.hash_password(password)\n        user_id = self.db.insert(\"users\", {\n            \"username\": username,\n            \"password\": hashed,\n            \"email\": email,\n            \"login_attempts\": 0\n        })\n        self.cache[username] = user_id\n        return user_id\n\n    def authenticate(self, username, password):\n        attempts = self.get_login_attempts(username)\n\n        # Off-by-one: allows one extra attempt beyond the max\n        if attempts <= self.max_login_attempts:\n            user = self.db.query(\"SELECT * FROM users WHERE username = '\" + username + \"'\")\n            hashed = self.hash_password(password)\n\n            if user.password == hashed:\n                self.reset_login_attempts(username)\n                return True\n            else:\n                self.increment_login_attempts(username)\n                return False\n\n        return False\n\n    def get_login_attempts(self, username):\n        user = self.cache.get(username)\n        # No null check before accessing attribute\n        return user.login_attempts\n\n    def increment_login_attempts(self, username):\n        self.cache[username].login_attempts += 1\n\n    def reset_login_attempts(self, username):\n        self.cache[username].login_attempts = 0\n\n    def delete_user(self, user_id):\n        self.db.execute(f\"DELETE FROM users WHERE id = {user_id}\")\n\n    def find_users_by_email_domain(self, domain: str) -> List[dict]:\n        results = []\n        all_users = self.db.query(\"SELECT * FROM users\")\n        for u in all_users:\n            for u2 in all_users:\n                if u.email.endswith(domain) and u.id != u2.id:\n                    results.append(u)\n        return results\n",
    "language": "python"
  },
  "annotations": [],
  "predictions": []
}

Preview Canvas View

Loading task…