mirror of
https://github.com/usestrix/strix.git
synced 2026-09-14 14:19:09 +08:00
de730119f0
* feat(cli): add strix login for managed platform sign-in (device flow) * feat(cli): add --scopes flag to strix login * docs: document strix login and managed billing in README, AGENTS, docs, and managed skill * fix(cli): handle malformed login responses and credential file failures * fix(cli): reject sign-in responses without an API token * feat(login): interactive workspace and scope selection with presets * fix(login): reject malformed API token values in sign-in responses * fix(login): skip the scope prompt when stdin is not a terminal * fix(login): tolerate malformed selection containers and remove unreadable credential files on logout * fix(login): treat overflowing timing values as invalid * fix(login): show the configured platform host in the sign-in banner * fix(login): bound device flow timing values and clean up unreplaced secret temp files * feat(cli): add the strix cloud command surface for the managed platform * feat(cli): manage workspaces and hosted onboarding links from strix cloud * fix(cli): report a leftover temporary secret file instead of hiding it * feat(cli): pass a Stripe payment method to the top-up wallet client * docs(cloud): recommend the Stripe agent wallet as the default payment path * fix(cloud): preserve API auth during MPP payment * fix(cloud): drop knowledge query and settings commands removed from the API * fix(cloud): align agent commands with API contracts * fix(cloud): send required PR review integration fields * fix(cloud): preserve scopes when switching workspaces * fix(cloud): make session command help non-destructive * feat(cloud): improve human navigation and output * feat(cli): add native shell completions * feat(cloud): tailor human list and detail views * feat(cloud): upload local source for managed scans * fix(cloud): infer scan type from local targets * Add agent-friendly managed cloud CLI * Harden cloud CLI type boundaries * Clarify cloud test user MFA options * Correct cloud vulnerability status guidance * Clarify chat file path handling * Allow signed storage upload URLs * Fix provider token request handling * Improve cloud CLI human list views * Make cloud CLI workflows actionable and safe * Make cloud workspace switching session-safe * Preserve CLI session metadata in JSON output * Remove preview protection bypass plumbing from cloud CLI
22 lines
600 B
Python
22 lines
600 B
Python
"""Safe rendering of untrusted text in a terminal."""
|
|
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
|
|
|
|
_TERMINAL_CONTROL = re.compile(r"[\x00-\x1f\x7f-\x9f]")
|
|
|
|
|
|
def has_terminal_control(value: object) -> bool:
|
|
"""Return whether text contains bytes that can alter terminal state/protocols."""
|
|
return _TERMINAL_CONTROL.search(str(value)) is not None
|
|
|
|
|
|
def sanitize_terminal_text(value: object) -> str:
|
|
"""Make C0/C1 control bytes visible so they cannot operate a terminal."""
|
|
return _TERMINAL_CONTROL.sub(
|
|
lambda match: f"\\x{ord(match.group()):02x}",
|
|
str(value),
|
|
)
|