Compare commits
10 Commits
fix/pycach
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a2ba1e38f1 | |||
| a6caa3b944 | |||
| bf8f649996 | |||
| 31ce9b05e2 | |||
| 3b400bb757 | |||
| e9b2b0b61c | |||
| d13e827ed8 | |||
| 4cbe3ddf23 | |||
| f7b98959fa | |||
| b874be18c5 |
5
.gitea/workflows/ci.yml
Normal file
5
.gitea/workflows/ci.yml
Normal file
@ -0,0 +1,5 @@
|
||||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
validate:
|
||||
uses: molecule-ai/molecule-ci/.gitea/workflows/validate-plugin.yml@main
|
||||
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -1,5 +0,0 @@
|
||||
name: CI
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
validate:
|
||||
uses: molecule-ai/molecule-ci/.github/workflows/validate-plugin.yml@main
|
||||
17
.gitignore
vendored
17
.gitignore
vendored
@ -19,3 +19,20 @@
|
||||
# Workspace auth tokens
|
||||
.auth-token
|
||||
.auth_token
|
||||
|
||||
# Python bytecode (append only — do not remove entries above)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
.pytest_cache/
|
||||
# Python bytecode (append only — do not remove entries above)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
.Python
|
||||
*.egg-info/
|
||||
*.egg
|
||||
.pytest_cache/
|
||||
build/
|
||||
dist/
|
||||
.eggs/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: molecule-careful-bash
|
||||
version: 1.0.0
|
||||
version: 1.0.1
|
||||
description: Refuse destructive bash commands (git push --force to main, rm -rf at root, DROP TABLE prod). PreToolUse:Bash hook.
|
||||
author: Molecule AI
|
||||
tags: [molecule, guardrails]
|
||||
|
||||
27
tests/README.md
Normal file
27
tests/README.md
Normal file
@ -0,0 +1,27 @@
|
||||
# Test Coverage — molecule-careful-bash
|
||||
|
||||
## What We Test
|
||||
|
||||
This plugin has **executable hooks** (Python), so it warrants real unit tests.
|
||||
|
||||
| File | Tests | Coverage |
|
||||
|------|-------|---------|
|
||||
| `hooks/pre-bash-careful.py` | 35 pytest tests | Destructive command blocking, token exfiltration prevention |
|
||||
|
||||
## Test Categories
|
||||
|
||||
| Class | Count | What |
|
||||
|-------|-------|------|
|
||||
| `TestRefuseForcePush` | 5 | `git push --force` to main/master blocked; feature branches allowed |
|
||||
| `TestRefuseGitResetHard` | 3 | `git reset --hard` on main blocked; feature branches allowed |
|
||||
| `TestRefuseSQLDestructive` | 4 | `DROP TABLE/DATABASE prod` blocked; test/sandbox allowed |
|
||||
| `TestRefuseRmRf` | 5 | `rm -rf /`, home, `.git` blocked; safe paths allowed |
|
||||
| `TestTokenExfiltrationBlocking` | 13 | Token file reads, `env \| grep` secrets, credential path exfil blocked |
|
||||
| `TestWarnList` | 2 | Warning-only patterns: `--force-with-lease`, `close` PR |
|
||||
| Safe-prompt passthrough | 3 | Legitimate commands (normal push, grep for non-secret, non-token files) pass through |
|
||||
|
||||
## Running Tests
|
||||
|
||||
```bash
|
||||
python -m pytest tests/ -v
|
||||
```
|
||||
Binary file not shown.
Loading…
Reference in New Issue
Block a user