Update backend/app/api/skills_marketplace.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
committed by
Abhimanyu Saharan
parent
cd70242043
commit
cd7e411b3e
@@ -687,7 +687,12 @@ def _sanitize_field(value: str) -> str:
|
||||
Prevents prompt injection via skill name or URL fields that could
|
||||
break out of the structured data section into the instruction section.
|
||||
"""
|
||||
return value.replace("\n", " ").replace("\r", " ").strip()
|
||||
sanitized = "".join(
|
||||
ch if ch.isprintable() and ch not in {"\n", "\r"} else " " for ch in value
|
||||
)
|
||||
# Normalize any runs of whitespace (including tabs) down to single spaces.
|
||||
sanitized = re.sub(r"\s+", " ", sanitized)
|
||||
return sanitized.strip()
|
||||
|
||||
|
||||
def _install_instruction(*, skill: MarketplaceSkill, gateway: Gateway) -> str:
|
||||
|
||||
Reference in New Issue
Block a user