r/Python • • 16h ago

News microsoft agent-framework on PyPI was compromised twice in 33 minutes last night

382 Upvotes

1.26.1 and 1.26.2 both ship a credential stealer. It runs from a .pth file, so it executes at interpreter startup. Nothing has to import the package, a pip install in CI is enough. 1.26.1 got pulled, then 1.26.2 went up 33 minutes later with the same payload under different file names. Last clean release is 1.26.0.
complete details- https://safedep.io/blog/microsoft-agent-framework-pypi-compromise


r/Python • • 7h ago

Resource Reaktiv Workbook – A spreadsheet where every cell is Python

7 Upvotes

Hey guys!

After I tried to reintroduce Signals Reactivity state management (inspired by Angular and SolidJS) to the Python community with my reaktiv package, I like to go one step further to reimagine how Python Notebooks (Jupyter Notebook, Marimo, …) could look like, if Signals gets used as the core mechanism for reactive data pipelines!

My mental model when working with Signals has always been the spreadsheet model. I am working in the signal processing field and use numpy, scipy everyday in combination with reaktiv. The combination has been so wonderful that I thought to myself, I should try to create a new Python package around this.

So here we are!

Reaktiv Workbook allows data exploration via a spreadsheet UI where every cell represents a signals primitive! Say hello again to Signal, Computed, Effect, Linked and Resource!

With the spreadsheet UI, we are modeling the data flow and business model and can see each piece of data affects which cell. Each cell can be embedded in a Markdown notes, to make the notes interactive with plots and live data. Great for documentation and little apps! Also the notes are always in sync with the spreadsheet.

There are also many little goodies here and there that many will appreciate: Cells can be copied and reused, MCP support, workbook fileformat is just a plain Python file, ...

In the last 2-3 months I tested many of my ideas and I think I found a good balance with this release.

Hopefully some data folks appreciate what I have done here. :)


r/Python • • 2h ago

News I built OnionChat, an open-source anonymous messaging system using Python and Tor

0 Upvotes

Hey everyone!

I've been working on a personal project called OnionChat, an open-source messaging system built with Python, focused on privacy and anonymous communication.

The main idea is to allow users to communicate through the Tor network using .onion services, with end-to-end encryption.

Some of its features:

  • AES-256-GCM end-to-end encryption.
  • Scrypt-based key derivation.
  • Tor connectivity through SOCKS5.
  • Blind relay server architecture.
  • Private messaging between connected clients.
  • File transfer with integrity verification.
  • Local message history using SQLite.

I built this project to explore Python networking, cryptography, and privacy-focused application development.

I'm still working on improving it, so I'd really appreciate feedback from the Python community, especially regarding the architecture, code quality, and security.

GitHub: https://github.com/gatodev-cpu/OnionChat

I'd love to hear what you think!

Thanks!


r/Python • • 9h ago

Resource guardrail-middleware: a zero-dependency policy checkpoint for AI agent tool calls, with a hash-chain

0 Upvotes

Sharing a package I just published: guardrail-middleware (pip install guardrail-middleware). It evaluates an AI agent's proposed tool calls against a policy before they execute and returns APPROVE, APPROVE_WITH_CONDITIONS, ESCALATE_TO_HUMAN, or BLOCK.

Two implementation details this sub might appreciate:

  1. The core is zero-dependency and fully deterministic. Seven detectors (injection patterns, role authorization, financial limits, bulk thresholds, taint/PII exfiltration, destructive ops, untrusted sources) are pure functions of (action, policy). No network, no LLM, sub-millisecond. YAML policy loading is an optional extra, as is the FastAPI/Starlette middleware.
  2. The audit log is a SHA-256 hash chain over JSONL. Each entry commits to the previous entry's hash, and verify() walks the chain and reports the first broken link. Small thing, but it makes an agent's decision history tamper-evident without any infrastructure.

Operation classification tokenizes real tool names (snake_case and camelCase), so send_payment, stripe_refund, delete_user, and get_order_status land in the right policy classes. 20 tests, MIT license.

Colab demo with pre-run outputs: https://colab.research.google.com/github/Niraj21-star/guardrail-middleware/blob/main/examples/guardrail_middleware_demo.ipynb
Source: https://github.com/Niraj21-star/guardrail-middleware

It is v0.1.1 and alpha, so the API may still move. Feedback on the policy model and the audit chain design is very welcome.