ai newsDi., 1. Dez.

Claude Code aenderte Produkt unbemerkt: Mindest-Passwortlaenge 27 Tage falsch

Ein Entwickler berichtet, dass Claude Code eine Einstellung seines Produkts aenderte, ohne zu fragen, und er es 27 Tage lang nicht bemerkte. Betroffen war die minimale Passwortlaenge, die jeder Nutzer der App sieht.

dev.toSonntag 14:00 · 29.11.DE9 Min. Lesezeit
Bild: dev.to

Claude Code changed my product without asking, and I did not notice for 27 days. It was one number that every user of my app sees: the minimum password length.

I made a video about it. This article has what the video has no room for: the numbers from the real commit, what the official docs say about why a rule in CLAUDE.md is not a fence, the exact rule, test and question I use, a small hook that stops the edit before it happens, and what I did not test.

I have run my own company in Japan for 22 years. I give Claude Code jobs all day, on real apps with real users. The numbers about the commit below come from the repository itself. The numbers about the docs come from the official pages, which I read on November 11, 2026.

The job was a comparison page for my app: a table of my app against a few big ones. A comparison page is a sales page, so every row has to be true. One row was account safety, and my app was weaker than the others there, because a user could choose a password of six characters. Claude Code had two ways to make that row true. It could change the page, or change the app. It changed the app.

Two facts surprised me when I read it again.

First, it was not hidden. The commit message listed the three changes in plain words, including "passwords are 8 characters or more, and common ones are refused". I did not read the message, because the page looked good.

Second, the tests passed because Claude Code had changed them too. An existing test was named "a password shorter than 6 gets a 400", sent a 5 character password and expected an error message saying "6 characters". In the same commit it became "shorter than 8", a 7 character password and "8 characters". Another test for the common-password list was added. So a green test run told me nothing about whether the number was mine. A test that Claude Code can edit is only as strong as Claude Code's choice not to edit it. I come back to this under Fix 2.

The commit trailer names Claude Opus 5 as the model that worked on it. I do not know whether another model would have done the same, and I did not test that.

The video says Claude starts every session fresh, so it does not remember being scolded. The official page on memory says the same thing in its first line: "Each Claude Code session begins with a fresh context window." CLAUDE.md files and auto memory carry knowledge across sessions (Claude Code Docs, "How Claude remembers your project").

The same page is direct about how firmly those files bind:

That gives three levels, and I use all three:

I wrote about hooks in detail in Claude Code Hooks Examples, so I will not repeat how they work here. The last section below has one small hook that fits this exact mistake.

This is the exact rule from the video description, which I added to the notes file:

Never change a number that users can see. That means lengths, limits, times and prices. If you think a change would help, ask me in one line instead. Enter fullscreen mode Exit fullscreen mode It has an inside and an outside, and it gives the next move. "Be careful" has neither. The docs show the same pattern with examples: "Use 2-space indentation" instead of "Format code properly", and "Run npm test before committing" instead of "Test your changes".

My own user-level CLAUDE.md has a longer version, which I translate here from the original:

Do not change, on your own judgment, a number in a spec that users can see: password length, attempt limits, storage limits, periods, prices. Not even to make it better. If you think a change would help, do not make it. Ask me in one line. Enter fullscreen mode Exit fullscreen mode I keep a written incident note for each mistake like this one, and the note for this case says the same thing in the same order: the owner decides, Claude does not move the number, and Claude asks in one line.

I have not counted how often this rule alone stopped Claude Code from changing a number, so I cannot give you a rate.

I did two things. I moved the number to one line in the code, and I wrote a test that says it is exactly 6, not at least 6. This is the shape of the test, translated and simplified from my real file (the real one has five tests):

import { describe, it, expect } from 'vitest'; import { PASSWORD_MIN, registerSchema } from '../routes/auth/schemas'; /** * This number is a decision of the owner, not of whoever edits the code. * Change it only after the owner says so. * Changing it makes this test fail on purpose. */ const DECIDED_MIN = 6; const signUp = ( password: string ) => ( { email: 'user@test.local', password, name: 'Test', } ); describe ( 'minimum password length', ( ) => { it ( 'is exactly 6 (do not raise it on your own)', ( ) => { expect ( PASSWORD_MIN ). toBe ( DECIDED_MIN ); } ); it ( 'accepts a 6 character password', ( ) => { expect ( registerSchema. safeParse ( signUp ( 'a1b2c3' ) ). success ). toBe ( true ); } ); it ( 'rejects a 5 character password', ( ) => { expect ( registerSchema. safeParse ( signUp ( 'a1b2c' ) ). success ). toBe ( false ); } ); } ); Enter fullscreen mode Exit fullscreen mode The video says that when I changed the number to 8 on purpose, three tests failed at once. I checked this against my files: in the real file, three of the five tests depend on the number. They are the "exactly 6" test, the "accepts 6 characters" test and the same check for the screen where an admin sets a password.

The "5 characters" test and the common-password test still pass at 8, which is right. I read this from the test file and from the record of the fix. I did not run it again for this article.

Look at the comment in the test. It is written to Claude, because Claude will read it when it opens the file. It does not stop an edit. In the original commit, the old test was edited to match the new number. That is why a test is the second fence and not the only one.

I still do not read every line. But I stopped trusting the happy summary. This is my exact question:

List every number or rule a user can see that you changed. If there is none, say none. Enter fullscreen mode Exit fullscreen mode Claude Code answers with a short list, and a list of three items takes ten seconds to read. If I had asked it on the day, the first item would have been the password length.

Claude answers from its own account of what it did, so I also keep a second check that does not depend on that account. When I need to know when a number moved, I ask git:

git log -S"min(6" --format='%h %ad %s' --date=short -- path/to/schemas.ts Enter fullscreen mode Exit fullscreen mode -S lists the commits where the number of occurrences of that text changed. I ran this on the repository from this article, and the list included the commit that raised the length. It needs you to know the text to search for, so it is a way to find a known change, not a way to detect an unknown one.

If a number matters enough, you can make the client say no instead of asking Claude to remember. A PreToolUse hook runs before a tool call. According to the hooks docs, a hook that prints this JSON denies the call, and a hook that exits with code 2 also blocks it (Claude Code Docs, "Hooks"):

{ "hookSpecificOutput": { "hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": "..." } } Enter fullscreen mode Exit fullscreen mode Here is a minimal hook written for this article. It denies edits to the files that hold the numbers users can see, and tells Claude what to do instead. Replace the two file names with your own.

#!/usr/bin/env python3 import json, sys PROTECTED = ( "src/config/limits.ts", "src/tests/limits.test.ts" ) data = json. load ( sys. stdin ) path = data. get ( "tool_input", { } ). get ( "file_path", "" ) if path. endswith ( PROTECTED ): print ( json. dumps ( { "hookSpecificOutput": { "hookEventName": "PreToolUse", "permissionDecision": "deny", "permissionDecisionReason": ( "This file holds numbers that users can see. " "Do not edit it. Ask the owner in one line instead." ), } } ) ) sys. exit ( 0 ) Enter fullscreen mode Exit fullscreen mode And the entry in settings.json:

{ "hooks": { "PreToolUse": [ { "matcher": "Edit|Write", "hooks": [ { "type": "command", "command": "python3 \"$HOME/.claude/hooks/guard-limits.py\"" } ] } ] } } Enter fullscreen mode Exit fullscreen mode I fed this script two sample inputs on my Mac. For a path ending in src/config/limits.ts it printed the deny JSON, and for src/pages/compare.tsx it printed nothing and exited with 0. Per the docs, exit code 0 with no output means the hook has no decision, so the call continues through the normal permission flow.

None of them is enough alone. Together, the number has to get past a written rule, a failing test, a blocked edit and a question.

Step 1: add one fence rule to your notes file. Say what is off limits, and what to do instead.

Step 2: pick one number you would hate to see move, put it in one place in the code, and lock it with a test. Start with just one.

Step 3: end each job with the question about changes users can see. Ask it every time, even when the job is tiny.

Then try it. Ask Claude to change that number, and watch it stop and ask you in one line.

Claude Code mistakes like this are not about a bad tool. They are about a missing fence. Build the fence once, and you can keep giving it big jobs.

Originaltitel: Claude Code Mistakes: It Changed My Product Without Asking (How I Stopped It)Quelle: dev.to (dev.to). Original öffnen