Skip to content

Comment on Python 3.14.0

Comments

I've created a library that use t-strings to prevent shell injection that even works on Windows. It's written in Rust. https://github.com/aspizu/tshu

    $ uv run --with tshu python -m asyncio
    >>> from tshu import sh
    >>> username = "aspizu; rm -rf /"
    >>> await sh(t"echo {username}")
    aspizu; rm -rf /

Does the library handle arguments that begin with a dash?

Does this code print out the contents of the file named `--help`, or does it print the documentation for the `cat` command?

  filename = "--help"
  await sh(t"cat {filename}")
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.