惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
C
Cybersecurity and Infrastructure Security Agency CISA
IT之家
IT之家
罗磊的独立博客
阮一峰的网络日志
阮一峰的网络日志
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LINUX DO - 最新话题
C
Cyber Attacks, Cyber Crime and Cyber Security
Cyberwarzone
Cyberwarzone
S
SegmentFault 最新的问题
S
Schneier on Security
A
About on SuperTechFans
L
Lohrmann on Cybersecurity
博客园_首页
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Securelist
博客园 - 司徒正美
H
Hacker News: Front Page
Jina AI
Jina AI
K
Kaspersky official blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
J
Java Code Geeks
B
Blog
Google DeepMind News
Google DeepMind News
博客园 - Franky
The Cloudflare Blog
M
MIT News - Artificial intelligence
Blog — PlanetScale
Blog — PlanetScale
H
Help Net Security
Spread Privacy
Spread Privacy
N
News and Events Feed by Topic
A
Arctic Wolf
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
宝玉的分享
宝玉的分享
T
The Blog of Author Tim Ferriss
O
OpenAI News
N
Netflix TechBlog - Medium
G
GRAHAM CLULEY
F
Fortinet All Blogs
V
V2EX
N
News | PayPal Newsroom
Y
Y Combinator Blog
雷峰网
雷峰网
博客园 - 叶小钗
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Recent Commits to openclaw:main
Recent Commits to openclaw:main

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Securing AI Generated Code: You Ship It, You Own It
Ricardo M Santos · 2026-05-27 · via DEV Community

A developer merges a pull request on Friday afternoon. Monday morning, a security review flags a SQL injection flaw in a new endpoint. When you ask what happened, the answer is: “Copilot generated that part. I didn’t really read it.”

That answer is worse than the bug.

The security problem with AI-generated code is not only that models can produce insecure patterns. It’s that teams start treating shipped code as if ownership can be outsourced along with the typing. Scanners, SAST, and dependency audits still matter, but they sit downstream of a more basic failure: somebody merged code they didn’t understand. If you want to secure AI-generated code, you have to fix that first.

The Illusion of "Done" (And the Vulnerabilities You Inherit)

AI code generation is fast. That speed creates a dangerous shortcut in a developer’s head: the code appeared in seconds, so the task must be nearly finished.

It isn’t.

Code from an LLM carries familiar risks, and it often packages them in a way that looks polished enough to trust. Training data contains insecure patterns: string-built SQL queries, outdated authentication flows, hard-coded secrets, permissive CORS policies, weak validation, and examples copied from old blog posts that never should have made it into production. The model does not know your threat model, your trust boundaries, or which endpoint is exposed to the public internet. It does not know that the DbContext it suggested bypasses your tenant boundary checks, or that the helper it introduced skips the authorization policy your team uses everywhere else.

The testing story is no better. AI-generated tests skew toward happy paths. They verify that the endpoint returns 200 OK when the request is well formed and the caller is authorized. They rarely probe malformed input, privilege escalation, concurrency failures, race conditions, or the authorization edge cases that cause real incidents. That gives teams a green build and a false sense of safety. Coverage goes up. Confidence goes up. The system is not safer.

This is how you end up with dependency hell and architectural drift. Each pull request adds one more unreviewed assumption: a stale package, an extra abstraction, a hidden permission check, a helper method no one can explain. Any single change looks harmless. In aggregate, they create an attack surface the team no longer understands.

That’s the real danger behind the illusion of “done.” AI makes unfinished work look finished, and teams inherit vulnerabilities the moment they confuse generated output with completed engineering.

The Reinvested-Time Thesis

A common claim about AI-assisted development sounds reasonable on the surface: “AI saves me two hours a day.”

The better question is what happens to those two hours.

If the answer is “we ship more features,” the trade has been misunderstood. AI did not remove the hard parts of the job. It removed some of the typing. Boilerplate generation, DTO mapping, CRUD scaffolding, repetitive handlers, and test skeletons can be produced faster. Architectural judgment did not get cheaper. Security review did not get easier. Integration testing still requires someone who understands how the system fails under stress, not how it behaves in a demo.

I think of this as the Reinvested-Time Thesis: every hour AI saves on code generation should be reinvested into the work the model cannot own.

That means reading generated code with more care, not less. It means tracing package additions before npm install or dotnet restore turns a suggestion into a dependency. It means writing the negative tests the model skipped. It means checking whether a generated abstraction matches the architecture you intended, or whether it quietly introduced a second pattern your team will have to support for the next two years.

Teams that treat AI as pure acceleration often ship faster with less understanding. Teams that treat AI as time reallocation keep human judgment where it belongs and raise their confidence in what they ship. The output may still be faster. The difference is that the saved time gets spent on review, verification, and system thinking instead of disappearing into a larger sprint commitment.

That trade is less exciting on a dashboard. It’s much better for production.

The Tooling Supply Chain: It’s Not Just npm Anymore

Most teams already understand supply chain risk in runtime dependencies. You inspect package.json, audit packages.lock.json or package-lock.json, review new NuGet packages, and watch for known CVEs. Good. Keep doing that.

The supply chain is bigger now.

When you install an AI coding extension in VS Code or JetBrains Rider, you are not adding a harmless convenience feature. You are granting software broad visibility into source code, prompts, file contents, and often nearby context that may include secrets or internal contracts. When you connect an agent to an MCP server, you may be exposing local files, shell commands, Git state, issue trackers, database schemas, or internal documentation. Those permissions matter as much as a new production dependency, and in some cases more, because they sit upstream of the code you ship.

That changes the frame. AI-generated code and third-party packages are both forms of code you didn’t write. They deserve the same skepticism. Hallucinated imports can pull typosquatted packages. Suggested libraries can be abandoned, stale, or incompatible with your standards. The tooling itself can exfiltrate data, over-collect context, or create a path for unsafe automation in the developer environment.

For .NET teams, that can mean reviewing every new package reference in .csproj files and checking whether a generated example uses raw SQL where parameterized queries or EF Core APIs would be safer. For TypeScript teams, it means treating generated import statements as part of your supply chain review, not as harmless glue code. In both cases, it also means reviewing the editor extensions, agent permissions, and MCP integrations that produced the code in the first place.

If you wouldn’t add an unknown runtime dependency without scrutiny, you shouldn’t trust an unknown AI tool with your repo, your environment, or your merge path.

The First-Person Merge Rule

The fastest way to spot a team losing accountability is to listen to how it talks after an incident.

“Claude added that endpoint.”
“Copilot missed the null check.”
“Codex forgot the authorization attribute.”

That language sounds harmless. It isn’t. The moment developers describe merged code in the third person, responsibility starts drifting away from the people who shipped it. Reviews get softer because the author can imply the tool is the real source. Retros get muddier because “the AI did it” cuts off the harder question: why did a human approve it? Junior developers hear that phrasing and learn the worst possible lesson from the AI era: shipping code without understanding it is acceptable if the output came from a model.

The rule I want teams to adopt is simple: if you merge it, you wrote it.

I call this the First-Person Merge Rule.

Under that rule, the correct sentence is not “Copilot forgot validation.” The correct sentence is “I merged code without validation.” Not “Claude created an unsafe query,” but “I approved an unsafe query.” The tool may have generated the text, but it did not click merge, approve the PR, or accept the risk on behalf of your team.

This is not about blame theatre. It is about preserving a clean line of ownership. Once that line gets blurry — what another post here calls the accountability fog — security suffers fast. Reviewers stop pressing because the human author sounds less like an owner and more like a courier. Incident analysis turns into tool criticism instead of process correction. Teams focus on model quality while ignoring the broken discipline that allowed bad code into production.

Language shapes culture more than most engineering teams admit. If your team bans “the AI did it” as an excuse, review quality improves because authors know they own the output. Postmortems improve because they stay centered on decision-making. Security conversations improve because accountability is no longer transferable.

Use the rule in pull requests. Use it in retrospectives. Use it when coaching junior developers. The merge button has one name attached to it. That name matters.

How to Actually Own Code You Didn’t Write

Ownership only matters if it changes behavior.

The practical model is to treat AI output the same way you’d treat a pull request from a new contractor on their second day in the codebase. You would read every line. You would question assumptions. You would verify they understood your authorization model, tenancy rules, error handling, and deployment constraints. The same standard applies here. A useful shorthand is to treat the AI like an Infinite Intern: fast, eager, and able to produce a lot of code without knowing which parts are unsafe in your system.

That mindset works best when paired with Intent Architecture: you direct the work with bounded tasks, constrain what the model can touch, and verify the output against your system’s real failure modes instead of its optimistic guesses. The difference is concrete — “Generate an ASP.NET Core endpoint for order cancellation that enforces this policy” is reviewable; “build the cancellation feature” is how you get architectural drift you will own later.

A working checklist looks like this:

  • Run the generated code through a real review gate. The pillar’s Zero Trust audit covers the mechanics — happy-path gaps, hallucinated dependencies, hard-coded secrets. The ownership rule sits on top of it: if you can’t explain a line, you don’t merge it.
  • Reinvest the time AI saved into that review and into the negative tests the model skipped, not into the next ticket.
  • Adopt the First-Person Merge Rule in pull requests and retros. “The AI did it” is not an accepted sentence.
  • Treat your AI tooling as supply chain. Verify the provenance of every package the model suggests, and audit what your extensions, agents, and MCP servers can read, write, and transmit.

None of this is glamorous. It is disciplined engineering. The teams that stay safe with AI are not the ones with the flashiest tools. They are the ones that kept ownership attached to the human who shipped the code.

That’s the standard: you ship it, you own it.

Frequently Asked Questions

Is AI-generated code secure?

Not by default. Models reproduce insecure patterns from their training data — string-built SQL, missing authorization checks, hard-coded secrets — and they have no knowledge of your threat model. AI-generated code can be made secure, but only through the same review, testing, and dependency scrutiny you apply to anything else. The security of what you merge is your responsibility, not the model’s.

Who is responsible for AI-generated code?

The person who merges it. A tool can generate text, but it cannot approve a pull request or accept risk on your team’s behalf. That is the First-Person Merge Rule: if you merge it, you wrote it.

What are the biggest risks of AI-generated code?

Four recurring ones: insecure patterns inherited from training data, happy-path tests that hide real failure modes, hallucinated or stale third-party dependencies, and the AI tooling itself — extensions, agents, and MCP servers that hold broad access to your environment.

How do you review AI-generated code safely?

Treat it like a pull request from a contractor on their second day: read every line, question every assumption, and verify it against your real failure modes. The working model is direct, constrain, verify — give the model bounded tasks, limit what it can touch, and test the edge cases it skipped.