Truth in IT
    • Sign In
    • Register
        • Videos
        • Channels
        • Pages
        • Galleries
        • News
        • Events
        • All
Truth in IT Truth in IT
  • Data Management ▼
    • Converged Infrastructure
    • DevOps
    • Networking
    • Storage
    • Virtualization
  • Cybersecurity ▼
    • Application Security
    • Backup & Recovery
    • Data Security
    • Identity & Access Management (IAM)
    • Zero Trust
    • Compliance & GRC
    • Endpoint Security
  • Cloud ▼
    • Hybrid Cloud
    • Private Cloud
    • Public Cloud
  • Webinar Library
  • TiPs
  • DRAW
  • CPE

Snyk: Setting Up Security Hooks in Claude Code VS Code

Snyk
07/05/2026
0 (0%)
Share
  • Comments
  • Download
  • Transcript
Report Like Favorite
  • Share/Embed
  • Email
Link
Embed

Transcript


I'm going to open up my settings JSON file within the Claude folder, and I'm going to add a new keyword here. I'm going to paste it in, hooks. So what I pasted in is two different hooks for the purposes that I'm looking to achieve here. One is a pre-tool use, and one is a post-tool use. For the pre-tool use, I want it to match on any bash actions that the agentic coding tool is trying to do within that type of scope. And before it goes ahead and uses or runs some bash command, I want it to actually run this command, which is local to my project here. And you can see I'm referencing .claude hooks sneak-pre-commit-gate.sh. So I wrote a shell script. So I'm going to paste in my shell script here. And this is actually something that I pulled directly from Snyk that is part of Snyk Studio Recipes. So now we have a script in place that can check to see if a commit is about to be executed and run some actions before we allow that to go through. When it comes to the post-tool use hook that I have set up here, I'm matching on any time a file had modifications to it, which is what the edit keyword is there, or if a new file is written or we write to a new file, we being the agentic coding tool here. And if that happens, the hook we want to run is a command. And it's going to be this other shell script. And very similarly here, I pulled this from our Studio Recipes repository for demonstration purposes. So with both those in place, now I have a guaranteed deterministic way that security checks will happen either before the model tries to make a commit to my branch in my project here or during code changes that are happening.

TL;DR

  • Claude Code hooks are configured in the project's settings JSON file inside the .claude folder, allowing project-scoped security automation.
  • A pre-tool use hook intercepts bash commands from the AI agent and runs a Snyk security check before execution proceeds.
  • A post-tool use hook triggers on file edits or new file writes, running a second Snyk script from the Studio Recipes repository.

Summary

This short tutorial demonstrates how to configure pre-tool use and post-tool use hooks within a Claude Code project scoped to Visual Studio Code. The presenter walks through editing the settings JSON file inside the .claude folder to add two distinct hooks: a pre-tool use hook that intercepts any bash commands the agentic coding tool attempts to execute, triggering a Snyk-provided shell script called snyk-pre-commit-gate.sh before the command runs; and a post-tool use hook that fires whenever a file is edited or a new file is written, executing a second shell script sourced from Snyk's open-source Studio Recipes repository. Together, these hooks create a deterministic security gate that ensures Snyk vulnerability checks run automatically — either before a commit is pushed to the project branch or immediately after code modifications are made by the AI agent. The approach requires no manual intervention once configured, making it a practical pattern for teams looking to embed security scanning directly into AI-assisted development workflows without relying on developer discipline alone.

Chapters

0:00 - Opening Settings JSON
0:10 - Pre-Tool Use Hook Setup
0:58 - Post-Tool Use Hook Setup
1:27 - Deterministic Security Gate Result

Key Quotes

0:15 "One is a pre-tool use, and one is a post-tool use."
0:44 "This is actually something that I pulled directly from Snyk that is part of Snyk Studio Recipes."
1:29 "Now I have a guaranteed deterministic way that security checks will happen either before the model tries to make a commit to my branch in my project here or during code changes that are happening."

FAQ

Where do you configure hooks for a Claude Code project in VS Code?

Hooks are added to the settings JSON file located inside the .claude folder within your project directory. You add a 'hooks' key containing your pre-tool use and post-tool use hook definitions.

Where can I find the Snyk shell scripts used in this demo?

Both shell scripts — including snyk-pre-commit-gate.sh — are available in Snyk's open-source Studio Recipes repository on GitHub at github.com/snyk/studio-recipes.


Categories:
  • » Cybersecurity » Application Security
  • » Data Protection
Channels:
News:
Events:
Tags:
  • DevSecOps
  • Application Security
  • How-To
  • Demo
  • Getting Started
  • Claude Code hooks
  • Agentic coding security
  • Pre-commit security gates
  • VS Code project configuration
  • Snyk Studio Recipes
  • DevSecOps automation
  • AI-assisted development
Show more Show less

Browse videos

  • Related
  • Featured
  • By date
  • Most viewed
  • Top rated
  •  

              Video's comments: Snyk: Setting Up Security Hooks in Claude Code VS Code

              How secure is your Microsoft enterprise? Under 5 minutes, earn $10 in TruthPoints.

              View CPE Certificates

              Upcoming 360 View Events

              • Nov
                19

                Securing the Microsoft Enterprise: Strengthening Configuration Management, Identity Security, and Data Protection

                11/19/202601:00 PM ET
                More events

                XStreaminars (watch here)

                • Dec
                  09

                  Beyond Continuous Compliance: Getting Ready to Detect, Recalculate, and Adapt

                  12/09/202601:00 PM ET
                  More events

                  Industry Events (Sponsor Hosted)

                  • Nov
                    18

                    Hands-On Workshop: Connecting On-Prem Data to Databricks via MinIO AIStor (International)

                    11/18/202608:00 AM ET
                    • Nov
                      19

                      Zendesk Deep Dive: Get the work done faster with Employee Service AI Agents

                      11/19/202601:00 PM ET
                      • Nov
                        19

                        AI Agent Showdown: Discover What Muse, Dots, and Duet Bring to Your Website

                        11/19/202601:00 PM ET
                        • Dec
                          02

                          Skylight en acción: salvaguardando la IA más allá del usuario.

                          12/02/202604:00 AM ET
                          • Dec
                            03

                            CISO Insights: Steering Cybersecurity Strategies in an AI-Driven Era

                            12/03/202601:00 PM ET
                            More events

                            Upcoming Webinar Calendar

                            • 11/18/2026
                              08:00 AM
                              11/18/2026
                              Hands-On Workshop: Connecting On-Prem Data to Databricks via MinIO AIStor (International)
                              https://www.truthinit.com/index.php/channel/2194/hands-on-workshop-connecting-on-prem-data-to-databricks-via-minio-aistor-international/
                            • 11/19/2026
                              01:00 PM
                              11/19/2026
                              Securing the Microsoft Enterprise: Strengthening Configuration Management, Identity Security, and Data Protection
                              https://www.truthinit.com/index.php/channel/2076/securing-the-microsoft-enterprise-strengthening-configuration-management-identity-security-and-data-protection/
                            • 11/19/2026
                              01:00 PM
                              11/19/2026
                              Zendesk Deep Dive: Get the work done faster with Employee Service AI Agents
                              https://www.truthinit.com/index.php/channel/2181/zendesk-deep-dive-get-the-work-done-faster-with-employee-service-ai-agents/
                            • 11/19/2026
                              01:00 PM
                              11/19/2026
                              AI Agent Showdown: Discover What Muse, Dots, and Duet Bring to Your Website
                              https://www.truthinit.com/index.php/channel/2228/ai-agent-showdown-discover-what-muse-dots-and-duet-bring-to-your-website/
                            • 12/02/2026
                              04:00 AM
                              12/02/2026
                              Skylight en acción: salvaguardando la IA más allá del usuario.
                              https://www.truthinit.com/index.php/channel/2147/skylight-en-acción-salvaguardando-la-ia-más-allá-del-usuario/
                            • 12/03/2026
                              01:00 PM
                              12/03/2026
                              CISO Insights: Steering Cybersecurity Strategies in an AI-Driven Era
                              https://www.truthinit.com/index.php/channel/2231/ciso-insights-steering-cybersecurity-strategies-in-an-ai-driven-era/
                            • 12/09/2026
                              01:00 PM
                              12/09/2026
                              Beyond Continuous Compliance: Getting Ready to Detect, Recalculate, and Adapt
                              https://www.truthinit.com/index.php/channel/2250/beyond-continuous-compliance-getting-ready-to-detect-recalculate-and-adapt/
                            • 12/09/2026
                              02:00 PM
                              12/09/2026
                              Strategies for Safeguarding Endpoints in the Agentic Era with Cyera
                              https://www.truthinit.com/index.php/channel/2256/strategies-for-safeguarding-endpoints-in-the-agentic-era-with-cyera/
                            • 01/19/2027
                              04:00 AM
                              01/19/2027
                              Skylight in Aktion: Gewährleisten Sie KI-Schutz über den Benutzer hinaus
                              https://www.truthinit.com/index.php/channel/2176/skylight-in-aktion-gewährleisten-sie-ki-schutz-über-den-benutzer-hinaus/
                            • 01/19/2027
                              02:00 PM
                              01/19/2027
                              HUMAN Dialogue: Embracing the Rise of the Empowered AI Consumer.
                              https://www.truthinit.com/index.php/channel/2160/human-dialogue-embracing-the-rise-of-the-empowered-ai-consumer/
                            • 03/18/2027
                              01:00 PM
                              03/18/2027
                              Securing Access for People, Partners and AI Agents
                              https://www.truthinit.com/index.php/channel/2251/securing-access-for-people-partners-and-ai-agents/
                            • 06/17/2027
                              01:00 PM
                              06/17/2027
                              Stop the Leak: Data Loss Prevention for the AI Era
                              https://www.truthinit.com/index.php/channel/955/360view-stop-the-leak-data-loss-prevention-for-the-ai-era/
                            • 08/19/2027
                              01:00 PM
                              08/19/2027
                              Who Has Access to What...and Should They?
                              https://www.truthinit.com/index.php/channel/2252/who-has-access-to-what-and-should-they/
                            • 10/21/2027
                              01:00 PM
                              10/21/2027
                              After VMware: Building the Private Cloud You Actually Want
                              https://www.truthinit.com/index.php/channel/2253/after-vmware-building-the-private-cloud-you-actually-want/
                            • 11/18/2027
                              01:00 PM
                              11/18/2027
                              Assume Breach, Prove Recovery
                              https://www.truthinit.com/index.php/channel/2254/assume-breach-prove-recovery/
                            • 12/16/2027
                              01:00 PM
                              12/16/2027
                              The Self-Running Service Desk
                              https://www.truthinit.com/index.php/channel/2255/the-self-running-service-desk/
                            Truth in IT
                            • Sponsor
                            • About Us
                            • Terms of Service
                            • Privacy Policy
                            • Contact Us
                            • Preference Management
                            Desktop version
                            Standard version