Skip to content

Commit f902b07

Browse files
committed
docs(readme): add supply chain attack protection section
- Document all supply chain protections from recent commits - Include npm and NuGet configuration settings - Explain why each protection matters (Axios incident, etc) - Add maintenance notes for future contributors - Consolidate duplicate supply chain text into cross-reference
1 parent 0b3b7af commit f902b07

1 file changed

Lines changed: 77 additions & 1 deletion

File tree

README.md

Lines changed: 77 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ Use only if you cannot run Docker. Note: Manual secret management required.
256256
| `SAFETY_NET_PARANOID_RM=1` | Block ALL `rm -rf` (even within cwd) |
257257
| `SAFETY_NET_PARANOID_INTERPRETERS=1` | Block interpreter one-liners (`node -e`, `python -c`) |
258258

259-
> **Note**: This plugin is registered in `opencode.json` and intercepts all bash commands via the `tool.execute.before` hook. It provides semantic command analysis (not simple pattern matching), shell wrapper detection, and interpreter one-liner detection. Default mode blocks only truly destructive operations while allowing safe git workflows. Configured with `min-release-age=7` in `.npmrc` to prevent supply chain attacks from newly published packages.
259+
> **Note**: This plugin is registered in `opencode.json` and intercepts all bash commands via the `tool.execute.before` hook. It provides semantic command analysis (not simple pattern matching), shell wrapper detection, and interpreter one-liner detection. Default mode blocks only truly destructive operations while allowing safe git workflows. See [Supply Chain Attack Protection](#supply-chain-attack-protection) for npm security settings.
260260
261261
#### .NET Tools
262262

@@ -1543,3 +1543,79 @@ Developers can easily switch between approaches:
15431543
- The "Start both" profile in Visual Studio simplifies launching both projects together
15441544
- OAuth flows and API integration work seamlessly in this local development setup
15451545
- The simplified workflow is particularly beneficial for design-focused tasks and rapid development
1546+
1547+
---
1548+
1549+
## Supply Chain Attack Protection
1550+
1551+
This project implements defense-in-depth protections against package manager and dependency chain attacks. All protections were added in April 2025.
1552+
1553+
### What Are Supply Chain Attacks?
1554+
1555+
Attackers compromise trusted packages to infiltrate downstream applications. Common vectors include:
1556+
1557+
- Typosquatting (malicious packages with similar names)
1558+
- Dependency confusion (internal packages masquerading as public)
1559+
- Malicious maintainers publishing compromised updates
1560+
- Compromised package maintainer accounts
1561+
1562+
### Protections Implemented
1563+
1564+
| Layer | Protection | How It Works |
1565+
| --------- | ------------------------ | ----------------------------------------------------------------------------------------------------- |
1566+
| **npm** | 7-day release age filter | Blocks packages published within 7 days, preventing fresh supply chain attacks (e.g., Axios incident) |
1567+
| **npm** | Ignore scripts | Blocks `postinstall` scripts that could execute malicious code during install |
1568+
| **npm** | Exact versions | `save-exact=true` prevents unexpected version changes from `^` or `~` ranges |
1569+
| **npm** | Strict peer deps | Prevents malformed peer dependency resolution attacks |
1570+
| **NuGet** | Locked-mode restore | `RestoreLockedMode=true` prevents dependency hijacking during restore |
1571+
| **NuGet** | Package lock files | `packages.lock.json` with contentHashes ensures bit-for-bit identical restores |
1572+
| **NuGet** | Signature validation | `signatureValidationMode=accept` validates signed packages while allowing unsigned popular ones |
1573+
1574+
### Configuration Files
1575+
1576+
```text
1577+
.npmrc # npm supply chain settings
1578+
nuget.config # NuGet supply chain settings
1579+
Directory.Build.props # MSBuild restore settings
1580+
packages.lock.json # Per-project NuGet lock files (6 total)
1581+
```
1582+
1583+
### npm Configuration (.npmrc)
1584+
1585+
```
1586+
min-release-age=7 # Block recent packages
1587+
ignore-scripts=true # No postinstall code
1588+
save-exact=true # Exact versions only
1589+
strict-peer-deps=true # Strict peer resolution
1590+
engine-strict=true # Enforce Node.js version
1591+
```
1592+
1593+
### NuGet Configuration (nuget.config)
1594+
1595+
```xml
1596+
<config>
1597+
<add key="signatureValidationMode" value="accept" />
1598+
</config>
1599+
```
1600+
1601+
### Directory.Build.props
1602+
1603+
```xml
1604+
<PropertyGroup>
1605+
<RestoreLockedMode>true</RestoreLockedMode>
1606+
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
1607+
<NuGetLockFilePath>packages.lock.json</NuGetLockFilePath>
1608+
</PropertyGroup>
1609+
```
1610+
1611+
### Why These Protections Matter
1612+
1613+
- **Locked-mode restore**: Without this, attackers who compromise a transitive dependency can inject malicious code during any restore
1614+
- **7-day filter**: The Axios compromise used a same-day malicious release; this blocks that vector entirely
1615+
- **Content hashes**: Lock files include SHA512 hashes that detect any tampering after publication
1616+
1617+
### Maintenance Notes
1618+
1619+
- NuGet lock files must be regenerated after adding/removing packages: `dotnet restore`
1620+
- The `accept` mode allows unsigned packages (BenchmarkDotNet, Dapper, MediatR) while validating signed ones
1621+
- npm settings are repository-scoped via `.npmrc` — applies to all projects in the repo

0 commit comments

Comments
 (0)