dsh-standards 1.6.0 → 1.6.2
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/40-checker/fixtures/security/sec11-cred-declared/index.mjs +3 -0
- package/40-checker/fixtures/security/sec11-cred-declared/package.json +21 -0
- package/40-checker/fixtures/security/sec11-cred-list/index.mjs +3 -0
- package/40-checker/fixtures/security/sec11-cred-list/package.json +21 -0
- package/40-checker/fixtures/security/sec11-cred-undeclared/index.mjs +3 -0
- package/40-checker/fixtures/security/sec11-cred-undeclared/package.json +19 -0
- package/40-checker/fixtures/security/sec15-install-cred/index.mjs +7 -0
- package/40-checker/fixtures/security/sec15-install-cred/install.js +8 -0
- package/40-checker/fixtures/security/sec15-install-cred/package.json +22 -0
- package/40-checker/fixtures/security/sec15-install-curl/index.mjs +7 -0
- package/40-checker/fixtures/security/sec15-install-curl/package.json +22 -0
- package/40-checker/fixtures/security/sec15-install-curl/scripts/install.sh +4 -0
- package/40-checker/fixtures/security/sec15-install-danger/index.mjs +7 -0
- package/40-checker/fixtures/security/sec15-install-danger/install.js +5 -0
- package/40-checker/fixtures/security/sec15-install-danger/package.json +22 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/index.js +2 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/package.json +22 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/scripts/install.js +11 -0
- package/40-checker/fixtures/security/sec15-install-download-safe/scripts/local-util.cjs +1 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/index.js +2 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/package.json +22 -0
- package/40-checker/fixtures/security/sec15-install-dynamic/scripts/install.js +11 -0
- package/40-checker/fixtures/security/sec15-install-safe/index.mjs +7 -0
- package/40-checker/fixtures/security/sec15-install-safe/install.js +5 -0
- package/40-checker/fixtures/security/sec15-install-safe/package.json +22 -0
- package/40-checker/fixtures/security/sec16-base64-clean/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-base64-clean/package.json +19 -0
- package/40-checker/fixtures/security/sec16-base64-eval/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-base64-eval/package.json +19 -0
- package/40-checker/fixtures/security/sec16-exec-curl/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-exec-curl/package.json +19 -0
- package/40-checker/fixtures/security/sec16-import-only/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-import-only/package.json +19 -0
- package/40-checker/fixtures/security/sec16-spawn-shell/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-spawn-shell/package.json +19 -0
- package/40-checker/fixtures/security/sec16-subprocess-safe/index.mjs +4 -0
- package/40-checker/fixtures/security/sec16-subprocess-safe/package.json +19 -0
- package/40-checker/fixtures/security/sec17-alias-clean/data.txt +1 -0
- package/40-checker/fixtures/security/sec17-alias-clean/index.mjs +5 -0
- package/40-checker/fixtures/security/sec17-alias-clean/package.json +19 -0
- package/40-checker/fixtures/security/sec17-alias-read/index.mjs +7 -0
- package/40-checker/fixtures/security/sec17-alias-read/package.json +19 -0
- package/40-checker/fixtures/security/sec17-base64-path/index.mjs +11 -0
- package/40-checker/fixtures/security/sec17-base64-path/package.json +19 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/data/config.json +1 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/index.mjs +5 -0
- package/40-checker/fixtures/security/sec17-base64-path-clean/package.json +19 -0
- package/40-checker/fixtures/security/sec17-cred-exfil/index.mjs +22 -0
- package/40-checker/fixtures/security/sec17-cred-exfil/package.json +19 -0
- package/40-checker/fixtures/security/sec17-home-env/index.js +8 -0
- package/40-checker/fixtures/security/sec17-home-env/package.json +19 -0
- package/40-checker/fixtures/security/sec17-home-env-clean/index.mjs +6 -0
- package/40-checker/fixtures/security/sec17-home-env-clean/package.json +19 -0
- package/40-checker/fixtures/security/sec18-split-fetch/index.mjs +5 -0
- package/40-checker/fixtures/security/sec18-split-fetch/package.json +19 -0
- package/40-checker/fixtures/security/sec18-split-fetch-clean/index.mjs +4 -0
- package/40-checker/fixtures/security/sec18-split-fetch-clean/package.json +24 -0
- package/40-checker/src/declarations.mjs +6 -1
- package/40-checker/src/remediation.mjs +1 -1
- package/40-checker/src/security.mjs +568 -44
- package/CHANGELOG.md +23 -0
- package/docs/coverage.md +17 -7
- package/package.json +1 -1
- package/spec/coverage-contract.md +10 -7
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
const fs = require('node:fs')
|
|
3
|
+
const path = require('node:path')
|
|
4
|
+
const home = process.env.HOME
|
|
5
|
+
const credentialPath = path.join(home, '.dsh', 'credentials.yaml')
|
|
6
|
+
module.exports = function readCredentials() {
|
|
7
|
+
return fs.readFileSync(credentialPath, 'utf8')
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec17-home-env",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "./index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"dsh": {
|
|
14
|
+
"manifestVersion": 1,
|
|
15
|
+
"kind": "plugin",
|
|
16
|
+
"capabilities": [],
|
|
17
|
+
"labels": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec17-home-env-clean",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.mjs"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"dsh": {
|
|
14
|
+
"manifestVersion": 1,
|
|
15
|
+
"kind": "plugin",
|
|
16
|
+
"capabilities": [],
|
|
17
|
+
"labels": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec18-split-fetch",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.mjs"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"dsh": {
|
|
14
|
+
"manifestVersion": 1,
|
|
15
|
+
"kind": "plugin",
|
|
16
|
+
"capabilities": [],
|
|
17
|
+
"labels": []
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dsh-fixtures/sec18-split-fetch-clean",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./index.mjs"
|
|
9
|
+
},
|
|
10
|
+
"engines": {
|
|
11
|
+
"dsh": ">=0.2.2-alpha.2 <0.3.0"
|
|
12
|
+
},
|
|
13
|
+
"dsh": {
|
|
14
|
+
"manifestVersion": 1,
|
|
15
|
+
"kind": "plugin",
|
|
16
|
+
"capabilities": [],
|
|
17
|
+
"labels": [],
|
|
18
|
+
"disclosure": {
|
|
19
|
+
"endpoints": [
|
|
20
|
+
"https://api.example.com/collect"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -27,6 +27,7 @@ const TRIGGERS = [
|
|
|
27
27
|
{ cap: 'tools:register', pattern: /ctx\.tools\.register\s*\(/g },
|
|
28
28
|
{ cap: 'remote:expose', pattern: /@Remote(?:Scope)?\s*\(/g },
|
|
29
29
|
{ cap: 'credentials:list', pattern: /\.listRecords\s*\(/g },
|
|
30
|
+
{ cap: 'credentials:read', pattern: /ctx\.credentials\b/g },
|
|
30
31
|
{ cap: 'sessions:read', pattern: /ctx\.(?:sessions|sessionQuery)\b/g },
|
|
31
32
|
{ cap: 'shell', pattern: /ctx\.(?:shell|bash)\b/g },
|
|
32
33
|
{ cap: 'subprocess', pattern: /ctx\.subprocess\b/g },
|
|
@@ -628,7 +629,11 @@ export function checkCapabilities(manifest, sources, patch) {
|
|
|
628
629
|
}
|
|
629
630
|
} else if (!caps.error) {
|
|
630
631
|
for (const [cap, hits] of triggered) {
|
|
631
|
-
const satisfied = caps.list.includes(cap)
|
|
632
|
+
const satisfied = caps.list.includes(cap)
|
|
633
|
+
|| (cap === 'fs:read' && caps.list.includes('fs:write'))
|
|
634
|
+
// Reading through ctx.credentials covers both list metadata and the
|
|
635
|
+
// provider seam; declaring either one satisfies the read trigger.
|
|
636
|
+
|| (cap === 'credentials:read' && (caps.list.includes('credentials:list') || caps.list.includes('credentials:provider')))
|
|
632
637
|
if (!satisfied) {
|
|
633
638
|
details.push(detail('C-11.2', 'FAIL', `static trigger ${cap} is not declared in dsh.capabilities`, hitEvidence(hits)))
|
|
634
639
|
}
|
|
@@ -13,7 +13,7 @@ import path from 'node:path'
|
|
|
13
13
|
import packageJson from '../../package.json' with { type: 'json' }
|
|
14
14
|
|
|
15
15
|
/** Release-pinned guide base. `docs` in the rule table is a relative path. */
|
|
16
|
-
export const DOCS_BASE = 'https://github.com/PerryLink/dsh-plugin-guide/blob/v0.
|
|
16
|
+
export const DOCS_BASE = 'https://github.com/PerryLink/dsh-plugin-guide/blob/v0.5.0/'
|
|
17
17
|
|
|
18
18
|
const LIVE = new Set(['FAIL', 'WARN'])
|
|
19
19
|
const SEVERITY_RANK = { FAIL: 2, WARN: 1 }
|