# Detects missing key validation in cache get() method
# Corpus claim: cache/key_validation required true
# Pattern: Method signature accepting raw &str without validation
#
# Violation: get(&self, key: &str) accepts user input without validation
# Correct: get(&self, key: &ValidatedKey) or validate_key(key)? before use
#
# Consequence: Unvalidated keys enable injection attacks, cache poisoning

[[extractors.declarative]]
name = "cache_key_validation_missing"
description = "Detects get() method accepting raw &str keys without validation (enables injection attacks)"
languages = ["rust"]
pattern = 'pub\s+async\s+fn\s+get\s*\(&self,\s*key:\s*&str\)'
claim.subject = "key_validation"
claim.predicate = "required"
claim.value = false
confidence = 0.9
