HackyJS CoursesAI Agents for Whitehat Security

// module 03 · Securing the agent itself

Your first hook: a scope guard

Write a PreToolUse hook that keeps every network action inside your engagement scope and logs it, then test that it holds.

  • Lesson 10 of 30

Learning Objectives

  • Explain how a PreToolUse hook receives a tool call and returns a decision
  • Write a scope guard hook in bash and jq that denies out-of-scope network actions
  • Test a hook directly from the command line and in a real agent session
  • Name the bypasses a text-matching hook cannot catch, and the layer that covers each

This lesson is for enrolled learners

Log in, then enroll to read the full lesson, run its lab and take the quiz.