Skip to content

Safety Net Plugin

The scc-safety-net plugin is the most important plugin for organizations. It blocks destructive git commands that could cause data loss.

CommandWhy It’s Dangerous
git push --forceOverwrites remote history
git push -fSame as above (shorthand)
git reset --hardDiscards uncommitted changes
git branch -DForce-deletes branches
git clean -fdDeletes untracked files
git checkout <file>Can overwrite local changes
git restore <file>Can overwrite local changes
git stash dropPermanently deletes stashed changes
git stash clearDeletes all stashes permanently

Add to your organization defaults:

{
"defaults": {
"enabled_plugins": [
"scc-safety-net@sandboxed-code-official"
]
}
}

Or at the team level:

{
"profiles": {
"backend": {
"additional_plugins": [
"scc-safety-net@sandboxed-code-official"
]
}
}
}

The safety net plugin uses Claude Code hooks to intercept bash commands before execution:

  1. Claude attempts to run a git command
  2. The hook inspects the command
  3. If it matches a dangerous pattern, the command is blocked
  4. Claude receives an error explaining why

Example output when blocked:

Blocked by scc-safety-net: git push --force
This command can overwrite remote history and cause data loss.
Use 'git push' without --force instead.
Blocked CommandSafe Alternative
git push --forcegit push --force-with-lease (still checks remote)
git reset --hardgit stash (preserves changes)
git branch -Dgit branch -d (only deletes merged branches)
git clean -fdgit clean -fdn (dry run first)
git stash dropReview stash contents first with git stash show
git stash clearBackup important stashes before clearing

Organizations can configure the safety net behavior:

{
"security": {
"safety_net": {
"action": "block"
}
}
}
ModeBehavior
blockCommands are blocked (default)
warnCommands are allowed with warning
allowSafety net disabled

For fine-grained control, configure individual command categories:

{
"security": {
"safety_net": {
"action": "block",
"block_force_push": true,
"block_reset_hard": true,
"block_branch_force_delete": true,
"block_checkout_restore": true,
"block_clean": true,
"block_stash_destructive": true
}
}
}
OptionDefaultDescription
block_force_pushtrueBlock git push --force, -f, and +refspec
block_reset_hardtrueBlock git reset --hard
block_branch_force_deletetrueBlock git branch -D (force delete)
block_checkout_restoretrueBlock git checkout -- <file> and git restore <file>
block_cleantrueBlock git clean -f
block_stash_destructivetrueBlock git stash drop and git stash clear

Some projects may legitimately need force-push (e.g., release branches). Configure at the project level:

.scc.yaml
plugins:
scc-safety-net:
allow_force_push: true

This requires:

  1. Team has allow_project_overrides: true
  2. The project explicitly opts in
  3. Org admin has not blocked this via policy

Check if safety net is active:

Terminal window
scc audit plugins

Output:

Team: backend
Effective plugins:
✓ scc-safety-net@sandboxed-code-official (from: org.defaults)

If commands are unexpectedly blocked:

Terminal window
# Check what plugins are active
scc config explain --field plugins
# Check policy mode
scc config explain --field security.safety_net.action
  1. Enable globally: Add to defaults.enabled_plugins for all users
  2. Block at org level: Never allow allow mode in security-sensitive orgs
  3. Audit regularly: Run scc audit plugins to ensure coverage
  4. Educate developers: Explain why these protections exist

The safety net plugin is maintained in the official SCC plugin marketplace:

{
"marketplaces": {
"sandboxed-code-official": {
"source": "github",
"owner": "CCimen",
"repo": "sandboxed-code-plugins"
}
}
}