The rise of AI coding assistants like GitHub Copilot and ChatGPT has drastically accelerated development. But it has also introduced a terrifying new supply chain vulnerability: AI hallucinations in dependencies.
Note: To solve this exact vulnerability, I built **SafeDroid* — an open-source GitHub Action. You can check out the code, use it in your CI/CD pipelines, and leave a star if you find it useful here: https://github.com/zhenyasedoy-blip/SafeDroid*
The Threat Model: How AI Tricks You
When developers ask an AI to generate a build.gradle snippet, the AI will sometimes confidently suggest a package name that doesn't actually exist.
If a developer blindly accepts this suggestion and merges it, the CI/CD pipeline will simply fail. But that's not the worst part. If an attacker spots this common hallucination (e.g., through public logs, open-source repos, or forums), they can register that exact fake package name on public repositories.
The next time your pipeline runs, it will silently download the attacker's malicious code directly into your project.
The Solution: How SafeDroid Stops It
I built SafeDroid to catch these hallucinated dependencies before they ever get merged into your main branch.
It is a Python-based GitHub Action that does the following:
- Parses Gradle files in your Android repository.
- Validates dependencies via live HTTP checks against Google Maven and Maven Central.
- Breaks the build instantly if a hallucinated or fake package is detected.
Why I Built It
As an Android & DevSecOps Engineer, I believe we need automated safeguards against AI-generated flaws. You can read my full, deep-dive architectural breakdown of this threat model on Medium:
https://medium.com/@zhenya_sedoy/how-ai-hallucinations-can-ruin-your-android-project-and-how-i-built-a-devsecops-tool-to-stop-it-40ac25025d6d
Try it out!
If you are building Android apps or managing CI/CD pipelines, I'd love for you to test it out.
🔗 GitHub Repo: https://github.com/zhenyasedoy-blip/SafeDroid
Let me know your thoughts in the comments! Are you using any tools to validate AI-generated code in your workflows?
Top comments (0)