DEV Community

fallen-leaves
fallen-leaves

Posted on Edited on

How I stopped AI agents from hallucinating and bypassing security (Open Source)

Hi everyone! 👋

I'm a 17-year-old developer. Recently, while using AI agents to review my code, I got extremely frustrated with two things:

  1. AI often hallucinates success by swallowing error exit codes. It tells me "All tests passed" while the script is actually broken.
  2. AI can be easily tricked by prompt injections hidden in READMEs, and it might modify my uncommitted code without permission.

So, I decided to build a solution.

I am excited to share project-health-macos, a deep health-check skill strictly for native Apple Silicon (M1 and later). It audits existing projects and generates P0-P3 findings with evidence.

✨ Key Features

  • Read-only by default: It finds issues (P0-P3 with file:line evidence) and reports them without touching your code.
  • Prompt Injection Defense: It treats all text in the target repo as untrusted evidence, never as instructions.
  • Zero Trust CWD: Fails closed if the working directory fingerprint is wrong (preventing malicious docker-compose execution).
  • Native arm64 Gate: Rejects Rosetta terminals and Intel Macs via a hard sysctl check.
  • Supply Chain Security: The release zip is signed with OpenSSH Ed25519. You can verify it using the provided allowed_signers and SHA256SUMS.sig.

It's fully open-sourced under Apache-2.0. CI is green across Python 3.9 and 3.12 on GitHub's macOS runners.

🔗 Links

Since I only tested it via GitHub Actions (macOS arm64), I would love to hear feedback from real Mac users. If you have a Mac, feel free to try it out on a disposable project. Let me know what you think!

Top comments (1)

Collapse
 
fallenleaves089 profile image
fallen-leaves •

Update: I just realized I should mention that the CI tests cover both Python 3.9 and 3.12 on native macOS runners. Let me know if you have any questions about the architecture!