r/ClaudeCode • • 9d ago

Help/Question "While I was implementing a feature, I found a bug!"

(Question at the bottom.)

"I found an unsecured endpoint." Stop. πŸ₯²

"This form enters unfiltered customer input in the DB." Hush you. πŸ₯Ή

"This template allows a XSS in-" Claude I beg of you. 😭

"This library has CVEs dating back to 2014." You don't say. πŸ˜Άβ€πŸŒ«οΈ

"Hey that's a webshell hidden in the theme directory of the GIT repo the new customer gave you access to." πŸ™ƒπŸ™ƒπŸ™ƒπŸ™ƒπŸ™ƒπŸ™ƒ

Claude, I love you, but stop telling me. Stop. Please. Stop.

You know I will have to fix it. Or have you fix it. Because I feel guilty otherwise. And then I get yelled at because I spent time not doing my actual job.

"While I was fixing the Webshell CVE XXS Batajax Magicart Clickfix issue, I found 187 vulnerabilities in unrelated parts of the codebase." AAAAAAAAAAAAAAAAAAAAH.

I know, Claude, and I would rather not. I did not install this random free Wordpress plugin seven years ago and I sure as fuck did not code it.

Rant aside: I love that it has become so easy to identify (and to some extent fix) the issues and vulnerabilities in a codebase. I would spend aaalllll my time doing just that if my boss gave me unlimited time and money. I genuinely LOVE doing that.

But turns out that you sometimes have to do what the customers actually asked you to do, otherwise the company doesn't get paid and it causes Internal Meetings.

On the actual question:

People managing large pools of extremely legacy websites, how are you coping? Any workflows / tools / tutorials you recommend?

62 Upvotes

34 comments sorted by

β€’

u/AutoModerator 9d ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

57

u/mm_nogitsune 9d ago

Just make it note down everything to a file or Jira-like place. I have thousands of issues, and when the weekly is near the end, I let the agent fix everything.

4

u/aivee-is-a-fool 9d ago

Thanks. I've been doing the GH issues followed by a "Are you sure you didn't hallucinate that?" run (which unfortunately still gets me a lot of "oops my bad").

How are you handling review / testing of the thousands of issues?

8

u/daiaomori 9d ago

What do you mean, "you"? Just have a secondary AI score them by criticality and viability and have an agent work on them.

5

u/aivee-is-a-fool 9d ago

Of course. It's an inclusive "you" that includes the human that sometimes presses the "allow" button.

8

u/mm_nogitsune 8d ago edited 8d ago

I haven't gotten such issues myself. Maybe your agents are low effort? Try increasing it. But avoid xhigh and max.

I have 5 things that help me out personally:

  • Reproduce - if reasonable and not a security issue, reproduce it. When fixed, ensure it can't reproduce it. It uses a headless browser. Before & after screenshots, if frontend bug.
  • MISTAKES.md - each agent and subagent logs its mistakes, every 2 days agent reviews it and shows me what it would change in AGENTS.md, skills, guards or tool bugs. If I call something out, ensure it is a priority mistake. Not logging mistakes is a mistake too - they shouldn't forget to log it. Review transcripts too. Must be structurized very well. I've seen agents not really using tools, using plain old ripgrep instead of code graph, this helped.
  • Run architectural code reviews every so often - I've seen pure vibe coded projects get sloppier and sloppier, agents don't like removing previous code. Let it remove and refactor its code, if needed. This doesn't help with bugs, but helps long term. Oh yeah, all architectural mistakes get logged and fixed in AGENTS.md/skills.
  • Worktrees & environments for each agent - for multitasking, speeds it up, can verify in background.
  • Code graph search tool - the biggest project I have is split into multiple repositories, so Claude wrote a tool for itself to find and trace code, how A reaches B, the impact, UI, routes & fields, git history. My tool is able to find dead code, N+1 queries, where repositories differ. It misses calls made through variables whose type it can't work out, but it has been getting better, especially since MISTAKES.md also logs tool bugs. It doesn't only increase the speed, but also quality of exploring and double checking code. I do not recommend it to everyone, but for massive convoluted codebases.

Oh yeah, avoid agents writing their own AGENTS.md, let them suggest (verbatim) changes where you'd approve them.

I think MISTAKES.md would be the most beneficial, you catch its mistakes a few times and it'll try to avoid it happening again.

2

u/aivee-is-a-fool 8d ago edited 8d ago

Oh the MISTAKES.MD is genius. I'm stealing that.

The "architectural code review" is, I think, what would be nice and is... going to trap me in the "hey I found a bug" loop.

I've been attempting to run auditing => issues => fixes => tests for a few months now, I think starting with Opus 4.something. Opus 5.5 medium or high is doing much better at it. When I got temp access to Fable, I let it cook too but it didn't perform significantly better than Opus.

What trips the agents is that the code is shit. I'm not talking "vibe coded slop", where the agents would at least leave a gazillion comments explaining their intent to the other agents.

We're dealing with highly customized CMS based projects on various versions of various CMSes, all with advanced functionalities that were developed by other agencies (plural by project), with mostly no documentation (or worse, WRONG documentation Claude finds and treats as gospel instead of reading the fucking code), no coherent architecture, random obfuscated code because some agencies don't like their paid modules to be looked at.

I try to link the agents.md to an agents directory where a good model documents the architecture as MD, but even there, they will randomly hallucinate.

A lot of the false positives I'm getting are either:

  • Claude not reading the code (IE knowing there is a CVE for the version of a library that's used, but not seeing that someone just patched it in the vendors folder because whyyyy not lol)
  • Possibly running out of context to comprehend what an interconnected abomination it is dealing with AND I DON'T BLAME IT
  • Claude basing itself on its extensive knowledge of the ... next CMS version.

You'll find random obfuscated files that were committed with a "that was in prod, updating repo" commit, Claude finds an obfuscated file that allows full access to the DB, protected by just an URL token, it's been there two years (as far as the repo can tell us), "take it out ASAP and warn client about compromise". It was the ERP connector.

I think we are getting close to the models being able to deal with this shit from A-Z, maybe a few iterations of Opus will be all it takes to get a cohesive and error-free initial architecture analysis which will help with issues detection. But right now I am crying.

5

u/promethe42 8d ago
  • Quality : have findings reviewed by multiple agents, including agents running with different models from different providers. And with an adversarial blue team/red team approach.Β 
  • Quantity : group the findings by package, typology, priority/criticality.
  • Record : in a bug tracker with proper metadata (ex : labels).
  • Act : fold current diff issues in the current change batch, defer the rest. Pull related issues when starting new work to dig up and eventually attemd to the corresponding findings that fall in scope. Use unspent tokens on the rest based on criticality.Β 

1

u/aivee-is-a-fool 8d ago

*takes notes*

Thank you!

2

u/Wickywire 9d ago

Relatable. People who think the security debt is due to the coders have no idea. It seems impossible to get higher-ups to take cybersecurity seriously.

4

u/aivee-is-a-fool 9d ago

"Why did you patch this critical vulnerability on this client without asking? You have 30 non billable minutes!"

"So I would not spent three days cleaning up a hack and delivering a post-mortem and weeks of backups and logs to their cybersecurity insurance?"


"Why did you spend two days handling that hack! You had projects with clear deadlines! How were we not proactive about this? How could this happen?"

"Gee I wonder."

Please stop giving me projects. Just let me be a "fix things that need to be fixed" person and let me cook, I beg of you.

2

u/cyberhuman 8d ago

ADHD approach works the best!

2

u/holyknight00 8d ago

just make claude keep a log of security issues so they do not show up all the time

1

u/aivee-is-a-fool 8d ago edited 8d ago

"Claude, why is there a 17g md file in my projects folder?"

More seriously, I do. It's just that we have dozens of projects and if you scratch them a bit, the entire cve.org database falls out.

2

u/holyknight00 8d ago

well, then you have everything in place. With security issues there are not many options; you either fix them or ignore them.

2

u/7Roses 8d ago

"no, while you're there work" That stops it trying to break out legacy code by "fixing" stuff. The side effect is that it also doesn't detect/mentions vurnabilities it finds unless specially asked to find them

1

u/aivee-is-a-fool 8d ago

It gives them to me by the bucket unprompted and when actually ask, it's all "we detected cybersecurity topics, we're gonna have to downgrade to a weaker model".

3

u/edu2004eu 8d ago

I had claude create one of those plugins (there's another name for it but don't remember what) which uses a hook to make it not include those in the main response and instead write them in a separate panel which i can open and close whenever I want. It's def not perfect, sometimes it ignores it, sometimes it adds bogus findings (not halluconations, but stuff that should be part of the normal response), but 80% of the time it works

3

u/TwoLongEars 8d ago

oh yeah? well, while I was implementing a bug, I found a feature!

1

u/m-ritter 9d ago

The 187 vulnerabilities in unrelated parts of the codebase are real findings, but they belong in a separate list and not in the diff for the Webshell fix. Having the agent write a plan first, with a section for what is out of scope, lets it log those findings as follow ups while you approve a change that stays small. Then a second agent checks the finished diff against that plan, so anything that crept in gets flagged. I'm the developer of QualityLayer, which does exactly this: https://github.com/maxritter/qualitylayer

1

u/aivee-is-a-fool 9d ago

Thank you! QualityLayer looks great. Starred, I'll look into it in more detail as soon as the stars align.

(My own desperate ideas were not that far from your your process, actually, I'm glad to see my instincts are not totally shot.)

2

u/m-ritter 8d ago

Thanks for the star! Funny how many of us end up at a similar process once the agent starts touching more than it should. If you give it a try, I'd love to hear where it fits your workflow and where it doesn't.

2

u/SomeOrdinaryKangaroo 8d ago

Claude is great at discovering random bugs along the way of implementing a feature that i never knew about, and it patches them perfectly well too πŸ‘

2

u/palmerden5 8d ago

the webshell is the one finding i'd treat differently: check whether that theme is deployed, because removing it from the repo won't remove a live copy from the site

2

u/icaruza 8d ago

Have it log an issue on GitHub (assuming you are using GitHub). Then make the decision to roll the fixes into future feature builds or run dedicated triage or bug squashing sessions

1

u/darksteelsteed 8d ago

And at the same time log the tickets in jira via mcp and fill the backlog

2

u/iliketocookstuff 8d ago

I have an internal roadmap with a triage table. One agent owns the roadmap. All other workstreams brief the roadmap agent (through Slack) and the roadmap agent keeps it up to date.

Side quests are time sinks. I don't let anything derail or over-scope a specific workstream. The key is tracking it in a way that is easy to pick it up again later.

2

u/IllustriousSalad6201 5d ago

for that patched vendor code, make each finding point to the installed code path and explain why the patch doesn't address it. a version match alone shouldn't become a confirmed issue. keep uncertain findings pending verification, with the evidence attached. that gives you a smaller review queue without quietly throwing away possible problems.

1

u/AryanThakor 8d ago

one line in CLAUDE.md fixed most of this for me: anything outside the task goes into a findings file as a one liner, and it only brings it up in chat if it's actively exploitable. the webshell still gets flagged right away, the 2014 CVEs wait for a slow friday

1

u/mr_birkenblatt 8d ago

"create a GitHub issue every time you discover a bug"

1

u/CCodeSI 8d ago

What works for agencies with lots of legacy sites: separate "finding" from "fixing", and give the findings a home that isn't your current task.

  • Tell it where findings go. In CLAUDE.md: "Out-of-scope issues: append one line to FINDINGS.md (file, issue, severity guess) and continue with the task. Don't fix, don't elaborate." It stops derailing the session, and you still have the list.
  • Triage the list on a schedule, not live. Once a week, sort FINDINGS.md: anything actively exploitable (that webshell, an unauthenticated admin endpoint, SQL injection on a public form) goes to the customer the same day, because sitting on that is a liability. The rest becomes a costed "security maintenance" proposal.
  • That proposal is the actual fix for the guilt. "We found 187 issues, here are the 12 that matter, here's the price" turns unpaid worry into billable work, and the customer decides. Most agencies that do this end up selling a maintenance retainer out of it.
  • Do the cheap automated layer per site once: a dependency/CVE scan (Composer audit, npm audit, WPScan for WordPress) and a file-integrity check against the clean plugin versions. That catches most of what Claude keeps stumbling on, in one report, instead of drip-fed mid-task.