Version: 0.1 Status: Draft for MVP Execution
Status: Complete / In Progress
Objective:
Create the first working CLI package structure.
Capabilities:
- Go CLI project
- Local npm package scanner
- Lockfile scanner
- Risk engine
- Basic MCP stub
- Test fixtures
- Build scripts
- Release packages
Exit criteria:
- CLI builds successfully.
- Tests pass.
- Local fixtures scan correctly.
- Release binaries are generated.
Timeline: Sprint 1 Priority: Critical
Objective:
Enable PkgSafe to scan real npm packages from the public registry.
Features:
pkgsafe scan-npm-package <name>--version--json- npm metadata fetcher
- latest version resolver
- tarball downloader
- safe extractor
- package.json analyzer
- risk scoring
- result cache
Acceptance criteria:
- Scans real npm packages.
- Detects lifecycle scripts.
- Detects suspicious script patterns.
- Handles missing packages gracefully.
- Supports human and JSON output.
- Tests cover registry metadata and tarball fixture scanning.
Timeline: Sprint 2 Priority: High
Objective:
Improve risk quality and reduce false positives.
Features:
- Policy-driven scoring
- Configurable thresholds
- Trusted package allowlist
- Denylist
- Package age checks
- Repository metadata checks
- Maintainer metadata checks
- Typosquat similarity scoring
- Better reason generation
- Debug mode
Acceptance criteria:
- Users can configure allow/warn/block thresholds.
- High-trust packages are not over-warned.
- Suspicious unknown packages are clearly flagged.
- Output explains scoring clearly.
- Policy file loads successfully.
Timeline: Sprint 3 Priority: High
Objective:
Add known vulnerability intelligence.
Features:
- OSV query support
- GitHub Advisory DB support later
- Local vulnerability cache
pkgsafe update-db- Vulnerability-based scoring
- CVE/GHSA reporting in output
- Offline vulnerability check from cache
Acceptance criteria:
- Known vulnerable package versions are detected.
- Scan results include vulnerability IDs.
- Offline mode can use cached advisory data.
- JSON output includes vulnerability details.
Timeline: Sprint 4 Priority: Critical Strategic Differentiator
Objective:
Allow AI coding agents to call PkgSafe before package installation.
Features:
pkgsafe mcp serve- MCP tool:
validate_package_install - MCP tool:
explain_package_risk - MCP tool:
score_lockfile - Cursor configuration example
- Claude Code configuration example
- Codex configuration example
- Local REST bridge optional
Acceptance criteria:
- MCP client can validate a package.
- AI-agent request returns allow/warn/block.
- Response includes risk score and reasons.
- Documentation includes setup examples.
- MCP tool does not require cloud connectivity.
Timeline: Sprint 5-6 Priority: Major Differentiator
Objective:
Detect malicious install-time behavior with real containment.
Features:
- Isolated behavior backend
- Fake HOME directory
- Fake credential canaries
- Lifecycle script execution in restricted environment
- File access logging
- Process execution logging
- Network attempt detection
- Timeout and resource limits
- Block if credential canaries are accessed
Protected paths:
~/.aws/credentials
~/.ssh/id_rsa
~/.npmrc
~/.pypirc
.env
.env.local
~/.kube/config
~/.azure/
~/.gcp/
.vault-token
Acceptance criteria:
- Package reading fake credentials is blocked.
- Package executing network exfiltration is blocked or high-risk warned.
- Safe lifecycle scripts are not blocked unnecessarily.
- Isolated backend has strict timeout and cleanup behavior.
- Host credentials are never exposed.
Timeline: Sprint 7 Priority: High
Objective:
Enable PkgSafe in CI/CD workflows.
Features:
- GitHub Action
- SARIF output
- JSON output
- Fail-on-block mode
- Warn-only mode
- Dependency lockfile scanning
- Pull request annotation
Acceptance criteria:
- GitHub Action runs on PR.
- Risk findings appear in PR output.
- Critical blocked packages fail workflow.
- SARIF output can be uploaded to security tab.
Timeline: Sprint 8-10 Priority: Medium-High
Objective:
Expand from npm to Python ecosystem.
Features:
pkgsafe scan-pypi-package <name>requirements.txtscannerpyproject.tomlscanner- Wheel vs sdist detection
- setup/build backend risk scoring
- PyPI metadata resolver
- Python package trust score
Acceptance criteria:
- PkgSafe scans PyPI metadata.
- PkgSafe detects suspicious Python packaging behavior.
- Requirements files can be scanned.
- JSON output is consistent with npm scanner.
Timeline: Post-MVP Priority: Public interfaces first
Objective:
Make PkgSafe useful for organizations without putting private implementation in the public repository.
Features:
- Central policy file
- Team allowlist
- Team denylist
- Private registry support
- Audit logs
- Exportable local audit evidence
- Integration interfaces for downstream governance tooling
- GitHub organization policy
Acceptance criteria:
- Platform team can define standard policy.
- Developers can run locally with org policy.
- CI/CD can enforce same policy.
- Audit evidence can be exported.
Timeline: Post-MVP Priority: Medium
Objective:
Improve adoption through IDE and editor workflows.
Features:
- VS Code extension
- Dependency suggestion validation
- Inline package trust warning
- Package hover cards
- Install command interception
- MCP-first architecture
- Local REST API
Acceptance criteria:
- Developer gets warning before adding suspicious package.
- IDE can call local PkgSafe service.
- No cloud account required for basic usage.
Timeline: Later Priority: Boundary-aware ecosystem growth
Objective:
Keep the public repository focused on the local-first OSS core while allowing downstream distributions to extend it through implementation-free public interfaces.
Open-source core:
- CLI scanner
- npm support
- local policy
- MCP server
- JSON output
Downstream extension policy:
- Public interfaces may be added when they are implementation-free.
- Private implementation belongs outside this public repository.
- Review
docs/architecture/open-core-boundary.mdbefore adding extension points.
Build the real npm registry scanner.
Implement:
pkgsafe scan-npm-package <package-name> [--version <version>] [--json]- Add npm registry client.
- Fetch package metadata.
- Resolve latest version.
- Extract tarball URL.
- Download tarball to cache.
- Safely extract tarball.
- Locate
package.json. - Reuse existing npm analyzer.
- Connect result to risk engine.
- Add JSON output.
- Add tests with mocked registry response.
- Add tests with local fixture tarball.
- Update README.
- Update CLI help text.
- Update release packaging.
- Command works for real npm packages.
- Tests pass.
- Documentation updated.
- Binary builds successfully.
- JSON output is stable enough for MCP/CI usage.
Initial distribution:
- GitHub releases
.tar.gzfor Linux.tar.gzfor macOS.zipfor Windows- SHA256 checksums
Later distribution:
- Homebrew tap
- npm wrapper package
- Docker image
- GitHub Action
- Winget
- Chocolatey
- apt/yum packages
Use semantic versioning.
0.1.x MVP scanner
0.2.x npm registry scanner
0.3.x OSV support
0.4.x MCP hardening
0.5.x isolated behavior analysis
1.0.0 stable npm + MCP + CI release
Recommended model:
- CLI
- npm scanner
- static analysis
- policy engine
- JSON output
- MCP server
- GitHub Action
The public repo may expose OSS-safe extension interfaces. Downstream distributions may provide their own implementations outside this repository.
This model keeps the public footprint restricted to OSS core behavior and implementation-free contracts.
PkgSafe should not compete directly as a full SCA dashboard.
It should win on:
| Differentiator | Why It Matters |
|---|---|
| Pre-install scanning | Stops risk before install |
| Local-first CLI | Works in developer workflow |
| MCP support | Protects AI coding agents |
| Isolated behavior roadmap | Detects malicious intent |
| Explainable decisions | Developers trust the tool |
| Offline-friendly cache | Useful in enterprise networks |
| Portable binary | Easy rollout |
| Policy-as-code | Platform engineering friendly |
PkgSafe should eventually become:
- A local package firewall for developers
- A dependency safety engine for AI coding agents
- A CI/CD package trust gate
- A governance evidence generator for platform teams
- A commercial enterprise policy layer for open-source dependency control
The long-term platform opportunity is to make PkgSafe part of a broader Niyam governance ecosystem, where AI agents, developer tools, CI/CD pipelines, and enterprise platforms call the same policy engine before risky actions are executed.
We have a Go CLI project called PkgSafe.
Goal:
Implement real npm registry package scanning.
Current baseline:
- CLI exists under cmd/pkgsafe
- Local npm analyzer exists
- Risk engine exists
- Policy structure exists
- MCP stub exists
- Tests pass
Implement the next MVP milestone:
Command:
pkgsafe scan-npm-package <package-name> [--version <version>] [--json]
Requirements:
1. Fetch npm metadata from https://registry.npmjs.org/<package-name>
2. Resolve latest version if --version is not provided.
3. Read dist.tarball URL for the selected version.
4. Download tarball into local cache.
5. Extract tarball safely into a temporary directory.
6. Locate package/package.json inside extracted tarball.
7. Reuse existing npm analyzer to inspect package.json.
8. Detect lifecycle scripts:
- preinstall
- install
- postinstall
- prepare
9. Detect suspicious script patterns:
- curl
- wget
- Invoke-WebRequest
- base64
- eval
- child_process
- .env
- .npmrc
- .aws
- .ssh
- .kube
- token
- secret
10. Return allow/warn/block decision using existing risk engine.
11. Support human-readable and JSON output.
12. Add unit tests using mocked npm registry responses and local fixture tarballs.
13. Do not implement isolated behavior execution yet.
14. Do not add a cloud backend.
15. Keep package boundaries clean and testable.
Expected command examples:
pkgsafe scan-npm-package axios
pkgsafe scan-npm-package lodash --json
pkgsafe scan-npm-package some-package --version 1.2.3
Acceptance criteria:
- Existing tests continue to pass.
- New tests cover latest version resolution.
- New tests cover tarball extraction.
- New tests cover package with postinstall script.
- New tests cover package with credential path reference.
- JSON output includes package, version, ecosystem, score, decision, and reasons.
PkgSafe is not another dashboard. It is a local package firewall for the AI-assisted development era.
It protects the moment that matters most:
Before the package is installed.
Before the lifecycle script runs.
Before credentials are exposed.
Before the dependency enters source control.
Before the AI agent makes a risky install decision.
That is the wedge.