Skip to content

Commit f2f3c3b

Browse files
Jonathan Muchaclaude
andcommitted
docs: add --strict-blocking flag documentation to README
Added comprehensive documentation for the new --strict-blocking feature: - Added flag to Advanced Configuration parameters table - Created dedicated "Strict Blocking Mode" section with: - Behavior comparison (standard vs strict) - Usage examples for different CI/CD platforms - Output examples showing NEW vs EXISTING violations - Common use cases and implementation strategies - Important notes about limitations and flag priority - Flag combination examples - Migration strategy guidance - Links to GitLab CI example files The documentation clearly explains: - Zero-tolerance security policy enforcement - Diff mode requirement - Error-level filtering (not warnings) - --disable-blocking precedence - First scan behavior Co-Authored-By: Claude Sonnet 4.5 <[email protected]>
1 parent ff33725 commit f2f3c3b

File tree

1 file changed

+94
-0
lines changed

1 file changed

+94
-0
lines changed

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ The CLI will automatically install @coana-tech/cli if not present. Use `--reach`
193193
|:-------------------------|:---------|:--------|:----------------------------------------------------------------------|
194194
| --ignore-commit-files | False | False | Ignore commit files |
195195
| --disable-blocking | False | False | Disable blocking mode |
196+
| --strict-blocking | False | False | Fail on ANY security policy violations (blocking severity), not just new ones. Only works in diff mode. See [Strict Blocking Mode](#strict-blocking-mode) for details. |
196197
| --enable-diff | False | False | Enable diff mode even when using --integration api (forces diff mode without SCM integration) |
197198
| --scm | False | api | Source control management type |
198199
| --timeout | False | | Timeout in seconds for API requests |
@@ -328,6 +329,99 @@ Bot mode (`bot_configs` array items):
328329
- `alert_types` (array, optional): Only send specific alert types
329330
- `reachability_alerts_only` (boolean, default: false): Only send reachable vulnerabilities when using `--reach`
330331
332+
## Strict Blocking Mode
333+
334+
The `--strict-blocking` flag enforces a zero-tolerance security policy by failing builds when **ANY** security violations with blocking severity exist, not just new ones introduced in the current changes.
335+
336+
### Standard vs Strict Blocking Behavior
337+
338+
**Standard Behavior (Default)**:
339+
- ✅ Passes if no NEW violations are introduced
340+
- ❌ Fails only on NEW violations from your changes
341+
- 🟡 Existing violations are ignored
342+
343+
**Strict Blocking Behavior (`--strict-blocking`)**:
344+
- ✅ Passes only if NO violations exist (new or existing)
345+
- ❌ Fails on ANY violation (new OR existing)
346+
- 🔴 Enforces zero-tolerance policy
347+
348+
### Usage Examples
349+
350+
**Basic strict blocking:**
351+
```bash
352+
socketcli --target-path ./my-project --strict-blocking
353+
```
354+
355+
**In GitLab CI:**
356+
```bash
357+
socketcli --target-path $CI_PROJECT_DIR --scm gitlab --pr-number ${CI_MERGE_REQUEST_IID:-0} --strict-blocking
358+
```
359+
360+
**In GitHub Actions:**
361+
```bash
362+
socketcli --target-path $GITHUB_WORKSPACE --scm github --pr-number $PR_NUMBER --strict-blocking
363+
```
364+
365+
### Output Differences
366+
367+
**Standard scan output:**
368+
```
369+
Security issues detected by Socket Security:
370+
- NEW blocking issues: 2
371+
- NEW warning issues: 1
372+
```
373+
374+
**Strict blocking scan output:**
375+
```
376+
Security issues detected by Socket Security:
377+
- NEW blocking issues: 2
378+
- NEW warning issues: 1
379+
- EXISTING blocking issues: 5 (causing failure due to --strict-blocking)
380+
- EXISTING warning issues: 3
381+
```
382+
383+
### Use Cases
384+
385+
1. **Zero-Tolerance Security Policy**: Enforce that no security violations exist in your codebase at any time
386+
2. **Gradual Security Improvement**: Use alongside standard scans to monitor existing violations while blocking new ones
387+
3. **Protected Branch Enforcement**: Require all violations to be resolved before merging to main/production
388+
4. **Security Audits**: Scheduled scans that fail if any violations accumulate
389+
390+
### Important Notes
391+
392+
- **Diff Mode Only**: The flag only works in diff mode (with SCM integration). In API mode, a warning is logged.
393+
- **Error-Level Only**: Only fails on `error=True` alerts (blocking severity), not warnings.
394+
- **Priority**: `--disable-blocking` takes precedence - if both flags are set, the build will always pass.
395+
- **First Scan**: On the very first scan of a repository, there are no "existing" violations, so behavior is identical to standard mode.
396+
397+
### Flag Combinations
398+
399+
**Strict blocking with debugging:**
400+
```bash
401+
socketcli --strict-blocking --enable-debug
402+
```
403+
404+
**Strict blocking with JSON output:**
405+
```bash
406+
socketcli --strict-blocking --enable-json > security-report.json
407+
```
408+
409+
**Override for testing** (passes even with violations):
410+
```bash
411+
socketcli --strict-blocking --disable-blocking
412+
```
413+
414+
### Migration Strategy
415+
416+
**Phase 1: Assessment** - Add strict scan with `allow_failure: true` in CI
417+
**Phase 2: Remediation** - Fix or triage all violations
418+
**Phase 3: Enforcement** - Set `allow_failure: false` to block merges
419+
420+
For complete GitLab CI/CD examples, see:
421+
- [`.gitlab-ci-strict-blocking-demo.yml`](.gitlab-ci-strict-blocking-demo.yml) - Comprehensive demo
422+
- [`.gitlab-ci-strict-blocking-production.yml`](.gitlab-ci-strict-blocking-production.yml) - Production-ready template
423+
- [`STRICT-BLOCKING-GITLAB-CI.md`](STRICT-BLOCKING-GITLAB-CI.md) - Full documentation
424+
331425
## Automatic Git Detection
332426
333427
The CLI now automatically detects repository information from your git environment, significantly simplifying usage in CI/CD pipelines:

0 commit comments

Comments
 (0)