SShortSingh.
Back to feed

Why a Regex-Based Claude Code Guard Hook Misses Destructive Commands

0
·1 views

The author examines how far a PreToolUse hook in Claude Code's settings.json can protect against destructive agent actions. The hook receives each proposed tool call as JSON and can approve or block it before execution. The author built a minimal guard that pattern-matches Bash commands for operations like rm -rf and git push --force. Testing confirmed it blocks literal destructive commands but approves the same intent when the flag is built from a shell variable or when routed through an unchecked MCP tool. The gap arises because the hook only inspects the raw text of one tool's input and never evaluates what a command actually expands to or which tools it covers.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Lumio AI Aims to Bridge Beginner Lessons and Hands-On AI Engineering Projects

The creator of Lumio AI, a learning platform for beginners pursuing AI engineering, is developing the project as a way to ease the transition from tutorials to building. The platform intends to offer approachable, beginner-friendly lessons paired with hands-on practice. The developer is still refining the project and has invited learners and builders to share what helped them move from basics to their first useful project. Interested readers can join a waitlist at lumioai.dev to follow the platform's progress.

0
ProgrammingDEV Community ·

Official Samsung firmware can be flashed with a locked bootloader, with limits

A locked bootloader does not prevent flashing official Samsung firmware, since the bootloader accepts any software carrying Samsung's signature. Odin can load stock AP, BL, CP, and CSC files in download mode as long as they are genuine and match the phone model. Two conditions apply: the firmware must be unmodified and signed by Samsung, and its bootloader version cannot be older than the one already installed due to rollback protection. Custom recoveries, custom ROMs, and root methods break the signature check, so they still require unlocking the bootloader. Flashing stock firmware does not change the lock state or trip Knox, leaving the phone's lock status and warranty status unchanged.

0
ProgrammingDEV Community ·

Five hosting platforms compared for letting Claude deploy apps through MCP servers

A developer reviewed the official MCP documentation of five hosting platforms in November 2026 to see which ones let Claude deploy an app directly. The key test was whether a server accepts code as files from a chat, or requires a Git repository or a local CLI first. Vercel and Netlify focus on frontends and serverless functions, while Railway and Render suit services and databases that are already set up. The author, who builds InstaPods, recommends it for always-running backends whose code lives in the conversation, while noting where competitors fit better.

0
ProgrammingDEV Community ·

Human-in-the-loop architecture binds approvals to exact payloads

A DEV Community primer outlines a repeatable workflow in which a proposed action runs only after deterministic checks and a human approval. The approval token is cryptographically bound to the exact payload, so the human decision becomes a verifiable part of the transaction rather than a disclaimer. The design separates four sources of truth: stored context, live authoritative API values, enforceable business rules, and model tuning, with tuning never replacing rule-based enforcement. The article pairs a diagnostic table of common failure modes with a flow from proposal through risk policy, approval, and execution to an immutable audit record. It also includes a standard-library Python teaching example demonstrating deterministic risk tiering, hash-bound approval tokens, and verification before execution.

Why a Regex-Based Claude Code Guard Hook Misses Destructive Commands · ShortSingh