frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Show HN: CodeDrift – static analysis for AI-generated code

https://www.npmjs.com/package/codedrift
4•hamzzaamalik•1h ago
Hi HN,

I built *CodeDrift*, a CLI tool that detects bugs commonly introduced by AI coding assistants like Copilot, Cursor and ChatGPT.

Over the last year I noticed that AI tools often generate code that compiles correctly, passes linting and looks reasonable in code review but still contains subtle issues.

Some common examples I kept seeing:

* async `forEach` loops that never await promises * missing authorization checks (IDOR) * hallucinated dependencies that don’t exist * stack traces leaking sensitive information * request data used without validation

These bugs often slip past ESLint, TypeScript and even human reviewers because the code looks correct.

CodeDrift parses the code using the TypeScript compiler API and runs a set of detectors looking for these patterns.

Example:

``` async function syncProducts(items) { items.forEach(async (item) => { await updateStock(item.id); }); } ```

CodeDrift output:

``` CRITICAL: async forEach does not await promises Fix: use Promise.all or a for...of loop ```

Another example it detects:

``` Database query using user-supplied ID without authorization check → potential IDOR vulnerability ```

The goal isn’t to replace tools like ESLint or TypeScript, or security scanners like Snyk. It’s meant to act as a safety layer for code generated with AI assistants.

The tool runs locally, requires no cloud access, and can be tried with:

``` npx codedrift ```

I’d love feedback from developers who are using AI coding tools in production.

Comments

tayyab1122•1h ago
Really nice work. The async forEach bug alone has burned so many teams and it's the kind of thing that looks completely fine in code review. The fact that it runs locally with no telemetry is a big deal for teams that can't pipe source code to external services.

The hallucinated dependency detector is underrated — AI tools confidently import packages that don't exist and it's embarrassing how easily that slips through. Good to have something that catches it automatically.

Adding this to our dev toolchain.

henryellan89•1h ago
Will check and leave feedback
hamzzaamalik•2m ago
Sure
robert_5•1h ago
How is this different from ESLint?
hamzzaamalik•1h ago
Good question.

ESLint focuses mostly on *syntax, style, and common JavaScript pitfalls*. It’s excellent for enforcing code quality rules (formatting, unused variables, best practices, etc.), and many teams already rely on it heavily.

CodeDrift is trying to focus on a different layer: *semantic and security-relevant patterns that often appear in AI-generated code*.

A few examples:

• *Async logic mistakes* – patterns like `array.forEach(async ...)` where promises are never awaited. ESLint can warn about some async patterns, but many variations slip through when the code still “looks” valid.

• *Authorization / IDOR patterns* – cases where user-controlled IDs are used directly in database queries without an authorization check. This usually requires looking at how request data flows into a query.

• *Hallucinated dependencies* – imports of packages that don’t exist in `package.json`, which AI assistants sometimes generate.

• *Stack traces leaking through API responses* – error handlers that expose internal paths or secrets.

So the idea isn’t to replace ESLint. In fact they work well together:

TypeScript → type safety ESLint → style and best practices Security scanners (like Snyk) → dependency vulnerabilities CodeDrift → logic/security patterns often introduced by AI code generation

Right now it’s still early and rule coverage is small, but the goal is to focus specifically on that “AI-generated code safety” layer.

New products introduce only one new thing

https://techinch.com/blog/best-products-introduce-one-new-concept
1•speckx•14s ago•0 comments

Matt Godbolt: Advanced Skylake Deep Dive [video]

https://www.youtube.com/watch?v=BVVNtG5dgks
1•lionkor•1m ago•0 comments

Unix Isn't for Agents

https://pwhite.org/unix-is-not-for-agents
1•handfuloflight•2m ago•0 comments

Show HN: A simple tool to convert CSV data into graphs

https://plotiq-web.web.app/
1•devnpatel•2m ago•0 comments

Ship a Privacy Policy and Terms of Service with Your Astro Site

https://www.openpolicy.sh/blog/astro
1•jamie_davenport•3m ago•0 comments

Adam Smith's Gift

https://lawliberty.org/forum/adam-smiths-gift/
1•RickJWagner•3m ago•1 comments

Show HN: Thought Canvas – Develop Ideas with AI (Mind Mapping)

https://www.thoughtcanvas.app/
1•thesunnez•3m ago•0 comments

The Rise and Fall of a 3-D Printing Empire

https://www.nytimes.com/2026/02/27/business/3d-printing-industry.html
1•linehedonist•4m ago•0 comments

How do you stop AI from making bad architectural decisions in your codebase?

1•Ansh_Dhanani•5m ago•0 comments

AWS Aurora DSQL Playground

https://playground.dsql.demo.aws/
1•tanelpoder•5m ago•0 comments

Discovering a Bluetooth trust flaw in Android

https://medium.com/meetcyber/️-how-i-discovered-a-bluetooth-pairing-flaw-in-android-reported-unde...
1•amitgy04•5m ago•0 comments

Convergent evolution in locomotory patterns of flying, swimming animals (2011)

https://www.nature.com/articles/ncomms1350
1•mooreds•8m ago•0 comments

Rapid Modeling (2023)

https://jbminn.com/blog/posts/rapid-modeling/
1•mooreds•9m ago•0 comments

GPL upgrades via section 14 proxy delegation

https://runxiyu.org/comp/gplproxy/
2•todsacerdoti•11m ago•0 comments

Zed now forces arbitration and opt-out requires PII

https://zed.dev/blog/terms-update
2•shock•11m ago•1 comments

Standard mental health therapies fall short for autistic adults, study suggests

https://www.psypost.org/standard-mental-health-therapies-often-fall-short-for-autistic-adults-stu...
1•pseudalopex•11m ago•0 comments

Version 1.4.1 of Bayesian SSH is available

https://github.com/abdoufermat5/bayesian-ssh
1•abdouyaya1998•12m ago•0 comments

Show HN: Costrace – Open-source LLM cost and latency tracking across providers

https://www.costrace.dev/
1•Ikotun•13m ago•0 comments

LLMs Are Antithetical to Writing and Humanity

https://thedispatch.com/article/donald-trump-third-term-steve-bannon-jd-vance/
2•speckx•13m ago•0 comments

The trackball that merges pointing and 3D control

https://rotatrix.com
1•OJFord•13m ago•0 comments

Chaotic 4 days led to man's suicide, says lawsuit against Google

https://www.sfgate.com/tech/article/suicide-lawsuit-google-ai-21955695.php
1•jamesmiller5•14m ago•0 comments

Mullvad VPN takes its banned anti-surveillance ad to the streets

https://www.techradar.com/vpn/vpn-privacy-security/mullvad-vpn-takes-its-banned-anti-surveillance...
2•nickslaughter02•14m ago•1 comments

Redis-py typing issue open since 2022

https://github.com/redis/redis-py/issues/2399
1•druml•14m ago•0 comments

Show HN: VideoNinja – paste video URLs, walk away, they download

1•hamuf•14m ago•0 comments

Neutralinojs developer framework compromised with malware

https://opensourcemalware.com/blog/neutralinojs-compromise
1•6mile•14m ago•0 comments

Extending Daniel Lemire's bit packing to handle 64-bit values

https://old.reddit.com/r/cpp/comments/1rlekeb/extending_daniel_lemires_bit_packing_to_uint64_t
1•gnusi•14m ago•0 comments

You Shouldn't Ask an AI for Advice Before Selling Your Soul to the Devil

https://ernaud-breissie.github.io/thoughts/why-you-shouldnt-ask-an-ai-for-advice-before-selling-y...
1•bussiere•15m ago•0 comments

Show HN: Pulse – personalized daily audio news briefs from topics you choose

https://pulsemedialaboratories.com
2•jvando•15m ago•3 comments

Product Price Alert Service

https://buysignal.co.uk/
1•hollywoodoo•15m ago•2 comments

My Data Quality Tools List: Tried Any?

https://toolsfordata.com/lists/data-quality-tools/
1•Arimbr•18m ago•0 comments