@pho9ubenaa/siro 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -30
- package/README.md +47 -37
- package/dist/cli.mjs +122 -298
- package/dist/index.d.mts +127 -396
- package/dist/index.mjs +3 -4
- package/dist/node-io-BdyNbvzO.mjs +2211 -0
- package/package.json +13 -16
- package/dist/node-io-CUcMwlGH.mjs +0 -2578
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.0]
|
|
4
|
+
|
|
5
|
+
### Breaking Changes
|
|
6
|
+
|
|
7
|
+
- **One remediation per check**: replace binding `fix`/`fixKind` and finding `fix`/`fixable`/`manualSteps` with automatic operations or manual instructions in `remediation`. JSON output uses schema 2.
|
|
8
|
+
- **Explicit library configuration**: `lint` evaluates without executing repository configuration. Pass extensions inside `config`; use `loadConfig` to opt into trusted code execution. `LintCommandOptions` adds reporting to `LintOptions`.
|
|
9
|
+
- **Validated extension boundaries**: parsed values and `getByPath()` results are `unknown`. Rules, bindings, reporters, and configuration maps require ordinary or null-prototype objects. Path constructors reject invalid roots and parent traversal.
|
|
10
|
+
- **Simpler bindings and exports**: remove `fileGlob`, separate automatic/advisory binding types, `requireConfigKey.extraFix`, `KeyAssignment`, and internal implementation exports. `RuleContext.readConfig` shares parsed inputs across checks; a violation can identify an additional input file.
|
|
11
|
+
|
|
12
|
+
### Fixes
|
|
13
|
+
|
|
14
|
+
- Keep version- and environment-dependent defaults at the configured severity until their conditions can be established.
|
|
15
|
+
- Align npm 12 script-policy precedence, URL restrictions, release-age values, and lockfile guidance with the cited upstream policy.
|
|
16
|
+
- Read Aube `strictDepBuilds` from `.npmrc`, combine it with workspace `jailBuilds`, and report and propose changes in the correct files. Correct advisory/trust defaults, paranoid overrides, and supported lockfiles.
|
|
17
|
+
- Honor pnpm `ignoreScripts` and Bun's boolean auto-install disable. Keep store, provenance, and frozen-install guidance within what configuration alone establishes.
|
|
18
|
+
- Correct npm/Aube exact-save precedence and Deno registry import checks, including tags, missing versions, partial versions, and subpaths.
|
|
19
|
+
- Match supported Deno and Yarn release-age formats; reject malformed ages and exclusions while preserving valid exclusions in remediation.
|
|
20
|
+
- Honor Deno's configured lockfile path and flag disabled or malformed lock settings. Report unsupported `deno.jsonc` explicitly.
|
|
21
|
+
- Reject invalid consumed manifest fields, non-mapping JSON/YAML roots, empty JSON, invalid extension results, and inaccessible or non-directory targets with actionable errors.
|
|
22
|
+
- Preserve severity overrides for prototype-named rules and compute exit decisions before custom reporters run. Require manual review when remediation would overwrite a settings container or leave a security bypass active.
|
|
23
|
+
- Validate repeated, missing, unknown, and non-boolean CLI options consistently. Match Node support against the package engine range.
|
|
24
|
+
- Limit the declared Node.js support range to the maintained majors exercised by CI.
|
|
25
|
+
- Reject cyclic YAML aliases and excessive alias expansion without repeatedly traversing unused nested anchors.
|
|
26
|
+
|
|
27
|
+
### Refactoring
|
|
28
|
+
|
|
29
|
+
- Consolidate CLI parsing on Node's argument tokenizer and remove the direct `cac` dependency. Keep configuration validation and parsed-file caching at their input boundaries.
|
|
30
|
+
- Replace custom script loaders, rule scaffolding, layer restrictions, and selective hook machinery with native Node scripts and direct verification commands.
|
|
31
|
+
- Generate rule inputs, default severities, and version notes from live bindings. Replace the duplicated version matrix with concise policy sources and interpretation limits.
|
|
32
|
+
- Remove private OSS research from the public repository and replace the single-package dependency catalog with exact versions in `package.json`.
|
|
33
|
+
- Build before every test command so executable CLI and public API cases cannot silently skip. Run full verification in CI and before release staging; require the tag to match the package version and stage exactly one packed artifact.
|
|
34
|
+
|
|
35
|
+
### Security and documentation
|
|
36
|
+
|
|
37
|
+
- Pin GitHub Actions to full commit SHAs, disable persisted checkout credentials, and configure Dependabot updates.
|
|
38
|
+
- Add security reporting guidance, a threat model, and a concrete configuration example. Clarify executable configuration, static-analysis limits, migration, and package verification.
|
|
39
|
+
|
|
3
40
|
## [0.3.0]
|
|
4
41
|
|
|
5
42
|
### Features
|
|
@@ -52,36 +89,7 @@ Initial public release. 27 rules across 6 package managers (npm, pnpm, yarn, bun
|
|
|
52
89
|
- **`--pm` flag**: target a specific package manager.
|
|
53
90
|
- **`--json` flag**: shortcut for `--reporter json`.
|
|
54
91
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
- `advisory-check` — aube `security.advisoryCheck`
|
|
58
|
-
- `approved-git-repos` — yarn `npmScopes.*.approvedGitRepos`
|
|
59
|
-
- `audit-suppression` — yarn `npmAuditExclude`
|
|
60
|
-
- `block-auto-install` — pnpm `autoInstallPeers`, aube `peerDependencies.autoInstall`
|
|
61
|
-
- `block-exotic-subdeps` — aube `blockExoticSubdeps`
|
|
62
|
-
- `bun-security-scanner` — bun `install.security`
|
|
63
|
-
- `checksum-verification` — pnpm `verifyStoreIntegrity`, aube `checksumVerification`
|
|
64
|
-
- `commit-lockfile` — npm `lockfileVersion` (lockfile committed to git)
|
|
65
|
-
- `dependency-overrides` — pnpm `pnpm.overrides`, aube `overrides`
|
|
66
|
-
- `disable-lifecycle-scripts` — npm `ignore-scripts`, pnpm `strictDepBuilds`, yarn `enableScripts`, bun `install.ignoreScripts`, deno `deno.json#/tasks`, aube `jailBuilds`
|
|
67
|
-
- `enforce-strict-ssl` — npm/yarn/pnpm/bun/aube `strict-ssl`
|
|
68
|
-
- `files-field` — npm `files` in package.json
|
|
69
|
-
- `frozen-lockfile` — npm `ci` enforcement, pnpm `frozen-lockfile`, yarn `freezeLockfile`, aube `preferFrozenLockfile`
|
|
70
|
-
- `frozen-store` — pnpm `store.frozen`
|
|
71
|
-
- `hardened-mode` — yarn `enableHardenedMode`
|
|
72
|
-
- `minimum-release-age` — pnpm `fetchRetries`, aube `minimumReleaseAge`
|
|
73
|
-
- `named-registries` — pnpm `registries.*.registry`
|
|
74
|
-
- `paranoid-mode` — aube `paranoid`
|
|
75
|
-
- `patched-dependencies` — pnpm `patchedDependencies`
|
|
76
|
-
- `pin-exact-versions` — npm `save-exact`, pnpm `save-exact`, deno `deno.json#/imports`
|
|
77
|
-
- `provenance` — npm/pnpm `publishConfig.provenance`
|
|
78
|
-
- `publish-access` — npm/pnpm `publishConfig.access`
|
|
79
|
-
- `publishable` — package.json `private`
|
|
80
|
-
- `store-server` — pnpm `store.server`
|
|
81
|
-
- `strict-allow-scripts` — aube `strictAllowScripts`
|
|
82
|
-
- `strict-release-age` — aube `strictReleaseAge`
|
|
83
|
-
- `strict-store-integrity` — pnpm `store.integrity`
|
|
84
|
-
- `trust-policy` — aube `trustPolicy`
|
|
92
|
+
Earlier implementations remain available in the release tags. See the [rule reference](docs/rules.md) for current policies.
|
|
85
93
|
|
|
86
94
|
### Tooling
|
|
87
95
|
|
package/README.md
CHANGED
|
@@ -4,36 +4,52 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@pho9ubenaa/siro)
|
|
5
5
|
[](https://github.com/pHo9UBenaA/siro/blob/main/LICENSE)
|
|
6
6
|
|
|
7
|
-
> Security best-practices linter for the npm ecosystem — npm, pnpm, yarn, bun, deno, aube.
|
|
7
|
+
> Security best-practices linter for the npm ecosystem — npm, pnpm, yarn, bun, deno, [aube](https://github.com/aubepkg/aube).
|
|
8
8
|
|
|
9
9
|
[Getting started](docs/getting-started.md) ·
|
|
10
10
|
[Rules](docs/rules.md) ·
|
|
11
11
|
[Comparison](docs/comparison.md) ·
|
|
12
12
|
[Configuration](docs/configuration.md)
|
|
13
13
|
|
|
14
|
-
`siro` **
|
|
15
|
-
and
|
|
16
|
-
|
|
14
|
+
`siro` is **inspired by** the community-maintained [npm security best practices](https://github.com/bodadotsh/npm-security-best-practices)
|
|
15
|
+
and turns those recommendations into something you can run: it **lints** repos for supply-chain risks,
|
|
16
|
+
graded `error` / `warn` / `info`, and emits machine-readable remediation so an editor or agent skill
|
|
17
|
+
can apply the fixes. The rule selection and severities reflect siro's own opinions; it is not
|
|
18
|
+
affiliated with the upstream doc.
|
|
17
19
|
|
|
18
20
|
```sh
|
|
19
|
-
npx @pho9ubenaa/siro lint
|
|
20
|
-
npx @pho9ubenaa/siro lint --reporter json # machine-readable
|
|
21
|
+
npx @pho9ubenaa/siro lint # report best-practice violations in the current repo
|
|
22
|
+
npx @pho9ubenaa/siro lint --reporter json # machine-readable remediation (see docs/json-output.md)
|
|
21
23
|
```
|
|
22
24
|
|
|
25
|
+
## A concrete example
|
|
26
|
+
|
|
27
|
+
For maintainers and CI owners, siro makes package-manager policy gaps visible during review. For example, change an unsafe npm script setting:
|
|
28
|
+
|
|
29
|
+
```diff
|
|
30
|
+
# .npmrc
|
|
31
|
+
-ignore-scripts=false
|
|
32
|
+
+ignore-scripts=true
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Run `siro lint --pm npm --project-type application` before and after the edit. The `disable-lifecycle-scripts` error clears when this setting is enabled; other findings remain until addressed. Review required build scripts before changing their execution policy.
|
|
36
|
+
|
|
37
|
+
The CLI reads `siro.config.*` as executable code. Review repository configuration before running it, particularly in CI. See the [threat model](docs/threat-model.md) and [security reporting policy](SECURITY.md).
|
|
38
|
+
|
|
23
39
|
## Features
|
|
24
40
|
|
|
25
|
-
- **
|
|
41
|
+
- **Rules across six managers.** 27 rules covering lifecycle scripts, version pinning, lockfiles
|
|
26
42
|
(`commit`/`frozen`), release age, publish provenance, `files`/`publishConfig`, SSL enforcement,
|
|
27
43
|
checksum verification, exotic subdependency blocking, audit suppression review, store integrity,
|
|
28
44
|
Bun's security scanner API, and Yarn 4's hardened-mode — each mapped to the right setting per
|
|
29
45
|
package manager (`.npmrc`, `pnpm-workspace.yaml`, `.yarnrc.yml`, `bunfig.toml`, `deno.json`,
|
|
30
46
|
`aube-workspace.yaml`, `package.json`).
|
|
31
|
-
- **PM-aware severities.** When a manager's documented default
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- **Machine-readable remediation.**
|
|
35
|
-
|
|
36
|
-
|
|
47
|
+
- **PM-aware severities.** When a manager's documented default satisfies a rule across every
|
|
48
|
+
supported version and target environment, the finding is demoted to `info`. Installed versions
|
|
49
|
+
and CI conditions are not checked, so defaults that depend on either retain the rule's severity.
|
|
50
|
+
- **Machine-readable remediation.** A finding can carry automatic key operations or manual
|
|
51
|
+
instructions. Review proposed changes and rerun the linter after editing.
|
|
52
|
+
See [docs/json-output.md](docs/json-output.md).
|
|
37
53
|
- **Lint with severities.** `error` fails CI by default; `--severity warn` tightens the gate.
|
|
38
54
|
- **Reporters.** `pretty` (default), `json` for CI, `github` for PR annotations; register your own.
|
|
39
55
|
- **Configurable.** Drop a `siro.config.ts` to disable rules, override severities, restrict PMs,
|
|
@@ -44,50 +60,44 @@ See the [rule reference](docs/rules.md) for what each check does and why, and th
|
|
|
44
60
|
|
|
45
61
|
## Versioning policy
|
|
46
62
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
version, the finding's message carries a `(available since pnpm 10.16.0; default safe since pnpm 11.0.0 (1440 minutes))`
|
|
53
|
-
suffix as documentation — but siro does not branch on it. If your project pins an older PM, the
|
|
54
|
-
right move is usually to upgrade; the lint output stays the same either way.
|
|
55
|
-
|
|
56
|
-
See [version matrix](docs/version-matrix.md) for the per-rule × per-PM version table
|
|
57
|
-
that backs those suffixes.
|
|
63
|
+
siro evaluates the recorded policy snapshot in [docs/policy-sources.md](docs/policy-sources.md).
|
|
64
|
+
It detects package-manager names, not effective runtime versions. Version annotations describe
|
|
65
|
+
verified upstream facts. A version-dependent safe-default annotation prevents an unverified
|
|
66
|
+
severity downgrade; it does not prove that the current version satisfies the rule. See
|
|
67
|
+
[configuration](docs/configuration.md) for defaults, applicability, and limits.
|
|
58
68
|
|
|
59
69
|
## Usage
|
|
60
70
|
|
|
61
71
|
```
|
|
62
72
|
siro <lint|check> [path] [options]
|
|
63
73
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
--pm <npm|pnpm|yarn|bun|deno|aube> Target a specific package manager (auto-detected; required if detection finds nothing)
|
|
75
|
+
--project-type <application|package> Select application or published-package policy (default auto)
|
|
76
|
+
--reporter <pretty|json|github> Output format (default pretty)
|
|
77
|
+
--severity <error|warn|info> Show and fail on findings at or above this level
|
|
78
|
+
--json Shortcut for --reporter json
|
|
79
|
+
--version, --help
|
|
70
80
|
```
|
|
71
81
|
|
|
72
82
|
`check` is an alias of `lint` (same flags, same exit codes) — provided so `siro check` reads naturally in CI scripts.
|
|
73
83
|
|
|
74
|
-
Exit codes: `0`
|
|
84
|
+
Exit codes: `0` no findings at/above threshold · `1` findings at/above threshold · `2` usage or configuration error · `70` uncaught exception (a siro bug or a throwing reporter/custom rule).
|
|
75
85
|
|
|
76
86
|
## How is this different from `npm audit` / `osv-scanner`?
|
|
77
87
|
|
|
78
88
|
Different layer of the supply-chain pipeline; you want both.
|
|
79
89
|
|
|
80
|
-
| Tool
|
|
81
|
-
|
|
|
82
|
-
| `npm audit` · osv-scanner · Snyk · Dependabot | **Known CVEs** in your installed dependency tree | GHSA / OSV.dev / vendor feeds |
|
|
83
|
-
| `siro`
|
|
90
|
+
| Tool | What it checks | Where the data comes from |
|
|
91
|
+
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
92
|
+
| `npm audit` · [osv-scanner](https://github.com/google/osv-scanner) · Snyk · Dependabot | **Known CVEs** in your installed dependency tree | GHSA / OSV.dev / vendor feeds |
|
|
93
|
+
| `siro` | **Your install pipeline's configuration** — postinstall scripts, version ranges, lockfile policy, publish provenance, files allow-list, etc. | Static analysis of `.npmrc`, `pnpm-workspace.yaml`, `.yarnrc.yml`, `bunfig.toml`, `deno.json`, `aube-workspace.yaml`, `package.json` |
|
|
84
94
|
|
|
85
|
-
`npm audit`
|
|
95
|
+
`npm audit` reports known vulnerabilities. `siro` reports supported configuration gaps that can increase exposure to malicious dependencies. Neither a clean result nor a cooldown window guarantees safety. Run both in CI.
|
|
86
96
|
|
|
87
97
|
## Contributing
|
|
88
98
|
|
|
89
99
|
Adding a rule or a package manager is a localized change — see
|
|
90
|
-
[contributing
|
|
100
|
+
[docs/contributing.md](docs/contributing.md).
|
|
91
101
|
|
|
92
102
|
## License
|
|
93
103
|
|