@sebastienrousseau/dotfiles 0.2.500 → 0.2.501

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.
Files changed (204) hide show
  1. package/CHANGELOG.md +77 -0
  2. package/README.md +82 -44
  3. package/docs/.vitepress/reports/localization-readability-audit.md +4 -0
  4. package/docs/AI.md +8 -2
  5. package/docs/CNAME +1 -0
  6. package/docs/COPYRIGHT +1 -1
  7. package/docs/NAMING_CONVENTIONS.md +7 -0
  8. package/docs/README.md +4 -0
  9. package/docs/_config.yml +59 -0
  10. package/docs/adr/ADR-001-ci-cd-pipeline.md +17 -0
  11. package/docs/adr/ADR-002-shell-performance.md +9 -0
  12. package/docs/adr/ADR-003-security-first.md +18 -0
  13. package/docs/adr/ADR-004-cli-architecture.md +14 -0
  14. package/docs/adr/ADR-005-chezmoi-choice.md +10 -0
  15. package/docs/adr/ADR-006-shell-selection.md +9 -0
  16. package/docs/adr/ADR-007-multi-shell-parity.md +10 -1
  17. package/docs/adr/ADR-008-alias-system-architecture.md +10 -0
  18. package/docs/adr/ADR-009-wallpaper-driven-theming.md +131 -0
  19. package/docs/adr/ADR-010-starship-transient-prompt.md +144 -0
  20. package/docs/adr/ADR-011-nushell-tier3-keep.md +144 -0
  21. package/docs/adr/README.md +7 -0
  22. package/docs/architecture/ARCHITECTURE.md +4 -0
  23. package/docs/architecture/INTEROP.md +8 -0
  24. package/docs/architecture/REPO_LAYOUT.md +5 -1
  25. package/docs/architecture/WALKTHROUGH.md +4 -0
  26. package/docs/architecture/fleet-deployment.md +4 -0
  27. package/docs/archive/EUXIS_2026_REVIEW.md +11 -3
  28. package/docs/archive/LEGACY_ROADMAP.md +45 -27
  29. package/docs/archive/MILESTONE_v0.2.493.md +4 -0
  30. package/docs/archive/PLAN.md +46 -8
  31. package/docs/archive/REPO_AUDIT.md +8 -0
  32. package/docs/guides/INSTALL.md +4 -0
  33. package/docs/guides/NEOVIM_IDE_GUIDE.md +9 -0
  34. package/docs/guides/THEMING.md +8 -0
  35. package/docs/guides/TROUBLESHOOTING.md +28 -0
  36. package/docs/guides/WSL2_NIX_TROUBLESHOOTING.md +70 -1
  37. package/docs/index.md +6 -2
  38. package/docs/interop/A2A.md +7 -0
  39. package/docs/interop/POWERSHELL.md +102 -0
  40. package/docs/manual/00-introduction.md +5 -1
  41. package/docs/manual/01-concepts/01-architecture.md +4 -0
  42. package/docs/manual/01-concepts/02-trust-model.md +6 -2
  43. package/docs/manual/01-concepts/03-theme-engine.md +4 -0
  44. package/docs/manual/01-concepts/04-fleet.md +7 -1
  45. package/docs/manual/01-concepts/05-self-healing.md +8 -1
  46. package/docs/manual/02-tutorials/01-first-install.md +5 -0
  47. package/docs/manual/02-tutorials/02-add-wallpaper.md +5 -0
  48. package/docs/manual/02-tutorials/03-create-profile.md +6 -0
  49. package/docs/manual/02-tutorials/04-encrypt-secret.md +6 -0
  50. package/docs/manual/02-tutorials/05-deploy-fleet.md +5 -1
  51. package/docs/manual/03-reference/01-dot-cli.md +4 -0
  52. package/docs/manual/03-reference/02-config-files.md +8 -2
  53. package/docs/manual/03-reference/03-environment.md +4 -0
  54. package/docs/manual/03-reference/04-templates.md +7 -1
  55. package/docs/manual/03-reference/05-feature-flags.md +10 -0
  56. package/docs/manual/04-cookbook/01-recipes.md +4 -0
  57. package/docs/manual/04-cookbook/02-troubleshooting.md +32 -0
  58. package/docs/manual/04-cookbook/03-faq.md +8 -0
  59. package/docs/manual/05-appendices/A-platform-matrix.md +4 -0
  60. package/docs/manual/05-appendices/B-security-checklist.md +6 -0
  61. package/docs/manual/05-appendices/C-glossary.md +4 -0
  62. package/docs/manual/05-appendices/D-bibliography.md +5 -1
  63. package/docs/manual/05-appendices/E-license.md +4 -0
  64. package/docs/manual/_toc.yml +1 -1
  65. package/docs/manual/command-index.md +4 -0
  66. package/docs/manual/concept-index.md +4 -0
  67. package/docs/operations/ATTESTATION.md +5 -0
  68. package/docs/operations/CI_CADENCE.md +107 -0
  69. package/docs/operations/CI_COMPOSITES.md +156 -0
  70. package/docs/operations/COMPLETIONS.md +123 -0
  71. package/docs/operations/COVERAGE.md +148 -0
  72. package/docs/operations/DRIFT.md +107 -0
  73. package/docs/operations/MAINTENANCE.md +5 -1
  74. package/docs/operations/MIGRATION.md +14 -6
  75. package/docs/operations/OPERATIONS.md +24 -0
  76. package/docs/operations/PERFORMANCE.md +133 -0
  77. package/docs/operations/RELIABILITY.md +6 -0
  78. package/docs/operations/ROADMAP.md +36 -18
  79. package/docs/operations/TESTING.md +4 -0
  80. package/docs/operations/TRACEABILITY.md +4 -0
  81. package/docs/operations/TRUSTED_AGENT_WORKSTATION.md +4 -0
  82. package/docs/operations/VERSION_SYNC.md +54 -5
  83. package/docs/reference/ALIASES.md +7 -0
  84. package/docs/reference/ALIASES_CHEATSHEET.md +5 -1
  85. package/docs/reference/ALIASES_DEPRECATIONS.md +5 -1
  86. package/docs/reference/FEATURES.md +4 -0
  87. package/docs/reference/FONTS.md +4 -0
  88. package/docs/reference/PROFILES.md +4 -0
  89. package/docs/reference/SCREENSHOTS.md +4 -0
  90. package/docs/reference/SCRIPTS.md +4 -0
  91. package/docs/reference/SUPPORT_MATRIX.md +10 -4
  92. package/docs/reference/THEMES.md +4 -0
  93. package/docs/reference/TOOLS.md +4 -0
  94. package/docs/reference/UTILS.md +16 -12
  95. package/docs/security/AI_ACT_COMPLIANCE.md +4 -0
  96. package/docs/security/AUDIT_BYPASS.md +103 -0
  97. package/docs/security/AUTOMATION_SECRETS.md +4 -0
  98. package/docs/security/CI_EGRESS_ALLOWLIST.md +127 -0
  99. package/docs/security/COMPLIANCE.md +5 -0
  100. package/docs/security/DEPS_DEV_EXCEPTIONS.md +86 -0
  101. package/docs/security/ENCRYPTION.md +5 -0
  102. package/docs/security/FMEA.md +4 -0
  103. package/docs/security/HISTORY_FILTERING.md +132 -0
  104. package/docs/security/INCIDENT_RESPONSE.md +4 -0
  105. package/docs/security/INSTALL_VERIFICATION.md +122 -0
  106. package/docs/security/KEYS.md +4 -0
  107. package/docs/security/KEY_ROTATION.md +4 -0
  108. package/docs/security/MCP_POLICY.md +9 -0
  109. package/docs/security/POLICY_RELEASES.md +4 -0
  110. package/docs/security/README.md +4 -0
  111. package/docs/security/SCORECARD.md +80 -0
  112. package/docs/security/SECRETS.md +12 -0
  113. package/docs/security/SECURITY.md +4 -0
  114. package/docs/security/SECURITY_CHECKLIST.md +11 -0
  115. package/docs/security/SHELL_EXEMPTIONS.md +145 -0
  116. package/docs/security/SOUP_REGISTER.md +4 -0
  117. package/docs/security/THREAT_MODEL.md +10 -0
  118. package/docs/security/VERIFICATION_VALIDATION.md +5 -1
  119. package/docs/themes/README.md +4 -0
  120. package/docs/themes/VISUAL_INTEGRITY_REPORT.md +4 -0
  121. package/dot_config/ai/identity.md +3 -0
  122. package/dot_config/ai/patterns/architect.md +2 -0
  123. package/dot_config/ai/patterns/hardener.md +2 -0
  124. package/dot_config/ai/patterns/refactor.md +2 -0
  125. package/dot_config/alacritty/alacritty.toml.tmpl +3 -3
  126. package/dot_config/atuin/config.toml.tmpl +47 -0
  127. package/dot_config/dotfiles/agent-card.json +1 -1
  128. package/dot_config/dotfiles/boot/README.md +2 -0
  129. package/dot_config/dotfiles/grub/README.md +2 -0
  130. package/dot_config/dotfiles/lock/README.md +2 -0
  131. package/dot_config/fish/conf.d/init.fish.tmpl +21 -0
  132. package/dot_config/fish/functions/_cached_eval.fish +84 -11
  133. package/dot_config/fish/functions/_cached_eval_clear.fish +17 -0
  134. package/dot_config/foot/foot.ini.tmpl +3 -3
  135. package/dot_config/fuzzel/fuzzel.ini.tmpl +2 -2
  136. package/dot_config/ghostty/config.tmpl +3 -3
  137. package/dot_config/git/hooks/executable_commit-msg +146 -0
  138. package/dot_config/goose/config.yaml +2 -2
  139. package/dot_config/gtk-3.0/gtk.css.tmpl +2 -2
  140. package/dot_config/gtk-3.0/settings.ini.tmpl +2 -2
  141. package/dot_config/gtk-4.0/gtk.css.tmpl +2 -2
  142. package/dot_config/gtk-4.0/settings.ini.tmpl +2 -2
  143. package/dot_config/kitty/kitty.conf.tmpl +3 -3
  144. package/dot_config/mise/config.toml +1 -1
  145. package/dot_config/niri/config.kdl.tmpl +2 -2
  146. package/dot_config/nushell/cached_eval.nu +80 -0
  147. package/dot_config/nushell/env.nu.tmpl +21 -13
  148. package/dot_config/shell/00-core-paths.sh.tmpl +1 -0
  149. package/dot_config/shell/05-core-safety.sh +1 -0
  150. package/dot_config/shell/10-secrets.sh +1 -0
  151. package/dot_config/shell/40-fzf-defaults.sh.tmpl +1 -0
  152. package/dot_config/shell/40-ls-colors.sh +1 -0
  153. package/dot_config/shell/50-logic-functions-core.sh.tmpl +1 -0
  154. package/dot_config/shell/50-logic-functions.sh.tmpl +1 -0
  155. package/dot_config/shell/51-logic-functions-extra.sh.tmpl +1 -0
  156. package/dot_config/shell/90-ux-aliases.sh.tmpl +1 -0
  157. package/dot_config/shell/91-ux-aliases-lazy.sh.tmpl +1 -0
  158. package/dot_config/shell/README.md +25 -8
  159. package/dot_config/starship.toml.tmpl +2 -2
  160. package/dot_config/tmux/tmux.conf.tmpl +3 -3
  161. package/dot_config/user-dirs.dirs +1 -0
  162. package/dot_config/vscode/settings.json.tmpl +2 -2
  163. package/dot_config/waybar/config.jsonc.tmpl +2 -2
  164. package/dot_config/waybar/style.css.tmpl +2 -2
  165. package/dot_config/wezterm/wezterm.lua.tmpl +3 -3
  166. package/dot_config/zsh/dot_zshrc.tmpl +154 -17
  167. package/dot_config/zsh/rc.d/00-alias-shims.zsh +28 -6
  168. package/dot_config/zsh/rc.d/30-options.zsh.tmpl +26 -6
  169. package/dot_local/bin/executable_bm +2 -0
  170. package/dot_local/bin/executable_dot +9 -2
  171. package/dot_local/bin/executable_dot-load-benchmark +1 -1
  172. package/dot_local/bin/executable_notify +2 -0
  173. package/dot_local/bin/executable_open +2 -0
  174. package/dot_local/bin/executable_tour +4 -2
  175. package/dot_local/bin/executable_up +3 -1
  176. package/install.sh +12 -4
  177. package/package.json +1 -1
  178. package/scripts/ci/check-dangerous-chmod.sh +19 -0
  179. package/scripts/ci/check-deps-dev.sh +236 -0
  180. package/scripts/ci/check-insecure-tls.sh +61 -0
  181. package/scripts/ci/check-regression-traceability.sh +67 -0
  182. package/scripts/ci/check-shell-preamble.sh +106 -0
  183. package/scripts/ci/run-coverage.sh +362 -0
  184. package/scripts/ci/validate-chezmoidata.sh +25 -0
  185. package/scripts/diagnostics/doctor.sh +173 -5
  186. package/scripts/diagnostics/drift-dashboard.sh +177 -13
  187. package/scripts/diagnostics/health.sh +21 -4
  188. package/scripts/diagnostics/perf.sh +304 -77
  189. package/scripts/diagnostics/workstation-attestation.sh +6 -1
  190. package/scripts/dot/commands/agent.sh +14 -5
  191. package/scripts/dot/commands/ai.sh +75 -10
  192. package/scripts/dot/lib/bento.sh +2 -1
  193. package/scripts/dot/lib/log.sh +6 -0
  194. package/scripts/dot/lib/platform.sh +1 -0
  195. package/scripts/dot/lib/ui.sh +11 -0
  196. package/scripts/dot/lib/utils.sh +5 -0
  197. package/scripts/git-hooks/pre-commit-audit.sh +1 -1
  198. package/scripts/git-hooks/pre-push +66 -3
  199. package/scripts/ops/heal-chezmoi.sh +41 -6
  200. package/scripts/qa/powershell-contract.ps1 +95 -0
  201. package/scripts/theme/merge-wallpaper.sh +4 -0
  202. package/scripts/theme/switch.sh +20 -10
  203. package/dot_config/atuin/config.toml +0 -40
  204. package/dot_local/bin/__pycache__/executable_dot-load-benchmark-ptycpython-312.pyc +0 -0
package/install.sh CHANGED
@@ -52,7 +52,7 @@ show_help() {
52
52
  Usage: install.sh [version] [options]
53
53
 
54
54
  Arguments:
55
- version The version (tag or branch) to install (default: v0.2.500)
55
+ version The version (tag or branch) to install (default: v0.2.501)
56
56
 
57
57
  Options:
58
58
  --help Show this help message
@@ -64,7 +64,7 @@ EOF
64
64
  }
65
65
 
66
66
  main() {
67
- local version="v0.2.500"
67
+ local version="v0.2.501"
68
68
  local version_set=0
69
69
  local minimal=0
70
70
  local _cleanup_files=()
@@ -72,20 +72,28 @@ main() {
72
72
 
73
73
  for arg in "$@"; do
74
74
  case "$arg" in
75
- --help)
75
+ -h | --help)
76
76
  show_help
77
77
  exit 0
78
78
  ;;
79
79
  --silent) export DOTFILES_SILENT=1 ;;
80
80
  --force) export DOTFILES_NONINTERACTIVE=1 ;;
81
81
  --minimal) minimal=1 ;;
82
- --*)
82
+ -*)
83
+ # Catch single-dash and double-dash unknowns the same way.
83
84
  error "Unknown option: $arg"
84
85
  ;;
85
86
  *)
86
87
  if [[ $version_set -eq 1 ]]; then
87
88
  error "Multiple versions specified: $version and $arg"
88
89
  fi
90
+ # Validate the positional looks like a semver (with or without
91
+ # leading v). Reject garbage early so an unknown positional
92
+ # like `foobar` doesn't trigger a 30s+ network download attempt.
93
+ # Caught by the install.sh fuzz harness (#881).
94
+ if [[ ! "$arg" =~ ^v?[0-9]+\.[0-9]+\.[0-9]+([-+][a-zA-Z0-9.-]+)?$ ]]; then
95
+ error "Unrecognized positional argument '$arg' — expected a semver version (e.g. v0.2.501)."
96
+ fi
89
97
  version="$arg"
90
98
  version_set=1
91
99
  ;;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sebastienrousseau/dotfiles",
3
- "version": "0.2.500",
3
+ "version": "0.2.501",
4
4
  "description": "The Trusted Shell Platform — Universal dotfiles managed by Chezmoi. Features Bash & Zsh for macOS, Linux & WSL. Rust modern tooling & enterprise-grade security.",
5
5
  "main": "install.sh",
6
6
  "bin": {
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
3
+ # =============================================================================
4
+ # check-dangerous-chmod.sh — block `chmod 777` / `chmod 666` patterns
5
+ # from landing in shell scripts.
6
+ #
7
+ # Invoked as a pre-commit local hook (no filename args; scans the repo).
8
+ # Extracted from `config/pre-commit-config.yaml` under #866.
9
+ # =============================================================================
10
+
11
+ set -euo pipefail
12
+
13
+ PATTERN='^[[:space:]]*chmod[[:space:]]+(-R[[:space:]]+)?(777|666)'
14
+
15
+ if grep -rn --include='*.sh' -E "$PATTERN" . 2>/dev/null | grep -v '^Binary'; then
16
+ echo "ERROR: Dangerous chmod patterns found (777 or 666)." >&2
17
+ echo "Use the minimum permissions actually required; document any exception." >&2
18
+ exit 1
19
+ fi
@@ -0,0 +1,236 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
3
+ # =============================================================================
4
+ # check-deps-dev.sh — Validate direct dependencies against the deps.dev
5
+ # Insights API. Catches supply-chain risk a Grype-only scan misses:
6
+ # stale-but-CVE-free packages, unattested artifacts, and packages with
7
+ # advisories that haven't yet been mapped to a CVE.
8
+ #
9
+ # Scans:
10
+ # * `package.json` — direct `dependencies` + `devDependencies` (npm).
11
+ # * `pyproject.toml` — direct `[project.dependencies]` (Python).
12
+ # * `.github/workflows/*.yml` — `uses:` action references (GitHub Actions).
13
+ #
14
+ # Skips ecosystems with no matching manifest.
15
+ #
16
+ # Exit codes:
17
+ # 0 no advisories found (or all under threshold).
18
+ # 1 one or more direct deps have advisories at or above the threshold.
19
+ # 2 prerequisites missing (jq / curl / python3).
20
+ #
21
+ # Closes part of #877.
22
+ # =============================================================================
23
+
24
+ set -uo pipefail
25
+
26
+ REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel 2>/dev/null || pwd)}"
27
+ THRESHOLD="${DEPS_DEV_SEVERITY_THRESHOLD:-HIGH}" # LOW | MEDIUM | HIGH | CRITICAL
28
+ DEPS_DEV_BASE="${DEPS_DEV_BASE:-https://api.deps.dev/v3}"
29
+ EXCEPTIONS_FILE="$REPO_ROOT/docs/security/DEPS_DEV_EXCEPTIONS.md"
30
+ SARIF_OUT="${DEPS_DEV_SARIF_OUT:-}"
31
+
32
+ # Strict mode: bail on prerequisites.
33
+ for cmd in jq curl python3; do
34
+ if ! command -v "$cmd" >/dev/null 2>&1; then
35
+ echo "::warning::check-deps-dev: $cmd not available — skipping." >&2
36
+ exit 0
37
+ fi
38
+ done
39
+
40
+ # -----------------------------------------------------------------------------
41
+ # Helpers
42
+ # -----------------------------------------------------------------------------
43
+
44
+ # severity_rank — map deps.dev severity strings to integers so we can
45
+ # compare against THRESHOLD numerically.
46
+ severity_rank() {
47
+ case "${1:-}" in
48
+ CRITICAL) echo 4 ;;
49
+ HIGH) echo 3 ;;
50
+ MEDIUM | MODERATE) echo 2 ;;
51
+ LOW) echo 1 ;;
52
+ *) echo 0 ;;
53
+ esac
54
+ }
55
+
56
+ THRESHOLD_RANK=$(severity_rank "$THRESHOLD")
57
+
58
+ # is_excepted — check if a (system, name) pair has an active exception
59
+ # entry in DEPS_DEV_EXCEPTIONS.md. Exceptions look like:
60
+ # `npm:lodash` (expires 2026-12-31): <reason>
61
+ is_excepted() {
62
+ local system="$1" name="$2"
63
+ [[ -f "$EXCEPTIONS_FILE" ]] || return 1
64
+ grep -Eq "^\s*\`${system}:${name}\`" "$EXCEPTIONS_FILE"
65
+ }
66
+
67
+ # fetch_advisories — query deps.dev for advisories on a (system, name,
68
+ # version) triple. Prints one advisory-key per line; empty if none.
69
+ fetch_advisories() {
70
+ local system="$1" name="$2" version="$3"
71
+ local encoded_name
72
+ encoded_name=$(python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe=""))' "$name")
73
+ local url="$DEPS_DEV_BASE/systems/$system/packages/$encoded_name/versions/$version"
74
+ curl -fsSL --max-time 15 "$url" 2>/dev/null |
75
+ jq -r '.advisoryKeys[]?.id // empty' 2>/dev/null ||
76
+ true
77
+ }
78
+
79
+ # fetch_advisory_severity — given an advisory ID, return its highest
80
+ # severity rating. Returns empty string when the API doesn't expose
81
+ # severity (older advisories sometimes lack it).
82
+ fetch_advisory_severity() {
83
+ local advisory_id="$1"
84
+ local encoded
85
+ encoded=$(python3 -c 'import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1], safe=""))' "$advisory_id")
86
+ curl -fsSL --max-time 15 "$DEPS_DEV_BASE/advisories/$encoded" 2>/dev/null |
87
+ jq -r '.severity[]?.type // empty' 2>/dev/null |
88
+ head -1 ||
89
+ true
90
+ }
91
+
92
+ # -----------------------------------------------------------------------------
93
+ # Manifest readers
94
+ # -----------------------------------------------------------------------------
95
+
96
+ # Each reader prints one "system\tname\tversion" line per direct dep.
97
+
98
+ read_npm() {
99
+ local pkg="$REPO_ROOT/package.json"
100
+ [[ -f "$pkg" ]] || return 0
101
+ jq -r '
102
+ [.dependencies // {}, .devDependencies // {}]
103
+ | add // {}
104
+ | to_entries[]
105
+ | "NPM\t\(.key)\t\(.value | sub("^[~^>=<]+"; ""))"
106
+ ' "$pkg"
107
+ }
108
+
109
+ read_pypi() {
110
+ local pyproj="$REPO_ROOT/pyproject.toml"
111
+ [[ -f "$pyproj" ]] || return 0
112
+ python3 - "$pyproj" <<'PY'
113
+ import sys
114
+ try:
115
+ import tomllib
116
+ except ImportError:
117
+ try:
118
+ import tomli as tomllib # type: ignore
119
+ except ImportError:
120
+ sys.exit(0)
121
+ data = tomllib.load(open(sys.argv[1], "rb"))
122
+ deps = data.get("project", {}).get("dependencies", [])
123
+ for spec in deps:
124
+ # spec is like "requests>=2.28.0"; pull name + version.
125
+ name = spec.split("[")[0].split(">")[0].split("<")[0].split("=")[0].strip()
126
+ version = ""
127
+ for op in (">=", "<=", "==", ">", "<"):
128
+ if op in spec:
129
+ version = spec.split(op, 1)[1].strip().split(",")[0]
130
+ break
131
+ print(f"PYPI\t{name}\t{version}")
132
+ PY
133
+ }
134
+
135
+ read_actions() {
136
+ local f
137
+ for f in "$REPO_ROOT"/.github/workflows/*.yml; do
138
+ [[ -f "$f" ]] || continue
139
+ # Match `uses: owner/repo@<40-hex-sha> # vX.Y.Z`
140
+ grep -Eo 'uses:[[:space:]]+[a-zA-Z0-9._-]+/[a-zA-Z0-9._/-]+@[a-f0-9]{40}[[:space:]]*#[[:space:]]*v[0-9.]+' "$f" |
141
+ sed -E 's/uses:[[:space:]]+([^@]+)@[a-f0-9]{40}[[:space:]]+#[[:space:]]+v([0-9.]+).*/GITHUB_ACTIONS\t\1\t\2/' ||
142
+ true
143
+ done | sort -u
144
+ }
145
+
146
+ # -----------------------------------------------------------------------------
147
+ # Main scan
148
+ # -----------------------------------------------------------------------------
149
+
150
+ findings=()
151
+ total_scanned=0
152
+
153
+ scan_one() {
154
+ local system="$1" name="$2" version="$3"
155
+ [[ -z "$name" || -z "$version" ]] && return 0
156
+ total_scanned=$((total_scanned + 1))
157
+
158
+ if is_excepted "$system" "$name"; then
159
+ echo " - skip $system:$name@$version (excepted)" >&2
160
+ return 0
161
+ fi
162
+
163
+ local advs
164
+ advs=$(fetch_advisories "$system" "$name" "$version")
165
+ [[ -z "$advs" ]] && return 0
166
+
167
+ while IFS= read -r adv; do
168
+ [[ -z "$adv" ]] && continue
169
+ local sev
170
+ sev=$(fetch_advisory_severity "$adv")
171
+ local rank
172
+ rank=$(severity_rank "$sev")
173
+ if ((rank >= THRESHOLD_RANK)); then
174
+ findings+=("$system:$name@$version :: $adv ($sev)")
175
+ echo "::warning::deps.dev advisory $sev: $system $name $version → $adv" >&2
176
+ fi
177
+ done <<<"$advs"
178
+ }
179
+
180
+ echo "Scanning manifests under $REPO_ROOT ..." >&2
181
+
182
+ # 1. npm
183
+ while IFS=$'\t' read -r system name version; do
184
+ scan_one "$system" "$name" "$version"
185
+ done < <(read_npm)
186
+
187
+ # 2. pypi
188
+ while IFS=$'\t' read -r system name version; do
189
+ scan_one "$system" "$name" "$version"
190
+ done < <(read_pypi)
191
+
192
+ # 3. GitHub Actions (best-effort — deps.dev coverage is partial)
193
+ while IFS=$'\t' read -r system name version; do
194
+ scan_one "$system" "$name" "$version"
195
+ done < <(read_actions)
196
+
197
+ echo "Scanned $total_scanned direct dependencies." >&2
198
+
199
+ # Optional SARIF emission for Code Scanning upload.
200
+ if [[ -n "$SARIF_OUT" ]]; then
201
+ python3 - "$SARIF_OUT" "${findings[@]+"${findings[@]}"}" <<'PY'
202
+ import json, sys
203
+ out = sys.argv[1]
204
+ findings = sys.argv[2:]
205
+ runs = [{
206
+ "tool": {"driver": {
207
+ "name": "check-deps-dev",
208
+ "version": "1.0.0",
209
+ "informationUri": "https://deps.dev",
210
+ }},
211
+ "results": [
212
+ {
213
+ "ruleId": "deps-dev-advisory",
214
+ "level": "error",
215
+ "message": {"text": f},
216
+ }
217
+ for f in findings
218
+ ],
219
+ }]
220
+ with open(out, "w") as fp:
221
+ json.dump({"version": "2.1.0", "$schema": "https://json.schemastore.org/sarif-2.1.0.json", "runs": runs}, fp)
222
+ print(f"SARIF written: {out}")
223
+ PY
224
+ fi
225
+
226
+ if [[ "${#findings[@]}" -gt 0 ]]; then
227
+ echo "" >&2
228
+ echo "::error::${#findings[@]} dep(s) flagged at or above ${THRESHOLD}." >&2
229
+ printf ' %s\n' "${findings[@]}" >&2
230
+ echo "" >&2
231
+ echo "Document exceptions at docs/security/DEPS_DEV_EXCEPTIONS.md with expiry dates." >&2
232
+ exit 1
233
+ fi
234
+
235
+ echo "deps.dev validation: clean." >&2
236
+ exit 0
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
3
+ # =============================================================================
4
+ # check-insecure-tls.sh — block `curl -k` / `curl --insecure` /
5
+ # `wget --no-check-certificate` patterns from landing.
6
+ #
7
+ # Invoked as a pre-commit local hook (no filename args; scans the repo).
8
+ # Extracted from `config/pre-commit-config.yaml` under #866 so the line
9
+ # is yamllint-clean and the matcher can be tested in isolation.
10
+ #
11
+ # Matcher uses awk for proper tokenization (the previous inline grep
12
+ # regex false-positive'd `-k` inside package names like `-keyring`).
13
+ # =============================================================================
14
+
15
+ set -euo pipefail
16
+
17
+ ROOT="${1:-.}"
18
+
19
+ # Awk body intentionally lives in a variable. The $i / $NF / FILENAME /
20
+ # NR references inside are awk's own field/record variables — NOT shell
21
+ # variables — so the whole body must stay literal (single-quoted). The
22
+ # SC2016 suppression is the canonical signal to readers + linters that
23
+ # this is intentional.
24
+ # shellcheck disable=SC2016
25
+ AWK_BODY='
26
+ # Each input line tokenized on whitespace. Flag if the line uses
27
+ # curl/wget and a known insecure flag appears as a standalone token.
28
+ {
29
+ has_curl = 0; has_wget = 0
30
+ bad = ""
31
+ for (i = 1; i <= NF; i++) {
32
+ tok = $i
33
+ if (tok == "curl") has_curl = 1
34
+ if (tok == "wget") has_wget = 1
35
+ if (has_curl && (tok == "-k" || tok == "--insecure" || tok ~ /^--insecure=/)) {
36
+ bad = tok
37
+ }
38
+ if (has_wget && (tok == "--no-check-certificate" || tok ~ /^--no-check-certificate=/)) {
39
+ bad = tok
40
+ }
41
+ }
42
+ if (bad != "") printf "%s:%d:%s\n", FILENAME, NR, bad
43
+ }
44
+ '
45
+
46
+ matches=$(
47
+ grep -rln \
48
+ --include='*.sh' --include='*.bash' --include='*.zsh' --include='*.tmpl' \
49
+ --exclude-dir='.git' \
50
+ --exclude='check-insecure-tls.sh' \
51
+ -E '\b(curl|wget)\b' \
52
+ "$ROOT" 2>/dev/null |
53
+ xargs -I{} awk "$AWK_BODY" {} 2>/dev/null
54
+ )
55
+
56
+ if [[ -n "$matches" ]]; then
57
+ echo "ERROR: Insecure TLS patterns found." >&2
58
+ echo "$matches" >&2
59
+ echo "Remove the flag or, if absolutely required, pin the cert and document the why." >&2
60
+ exit 1
61
+ fi
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
3
+ # =============================================================================
4
+ # check-regression-traceability.sh — enforce a `# Regression for:` header on
5
+ # every file under `tests/regression/`, with one of three accepted forms:
6
+ #
7
+ # # Regression for: GH-1234
8
+ # # Regression for: <7-or-more-char-sha-prefix>
9
+ # # Regression for: pre-history
10
+ #
11
+ # The first two are required for any test introduced as part of fixing a
12
+ # known issue or shipping a known commit. The third is an explicit "we
13
+ # couldn't trace it" marker — still trackable, just not auto-resolvable.
14
+ #
15
+ # Invocation:
16
+ # * pre-commit local hook (files passed as args)
17
+ # * standalone: ./scripts/ci/check-regression-traceability.sh
18
+ # =============================================================================
19
+
20
+ set -euo pipefail
21
+
22
+ PATTERN='^# *Regression for: *(GH-[0-9]+|[0-9a-f]{7,40}|pre-history)\b'
23
+
24
+ check_one() {
25
+ local f="$1"
26
+ [[ -f "$f" ]] || return 0
27
+
28
+ # Only check files under tests/regression/
29
+ case "$f" in
30
+ tests/regression/*) ;;
31
+ */tests/regression/*) ;;
32
+ *) return 0 ;;
33
+ esac
34
+
35
+ if ! head -15 "$f" | grep -Eq "$PATTERN"; then
36
+ echo "MISSING trace header: $f"
37
+ return 1
38
+ fi
39
+ }
40
+
41
+ fail=0
42
+ if [[ $# -gt 0 ]]; then
43
+ for f in "$@"; do
44
+ check_one "$f" || fail=1
45
+ done
46
+ else
47
+ while IFS= read -r f; do
48
+ check_one "$f" || fail=1
49
+ done < <(git ls-files "tests/regression/*.sh")
50
+ fi
51
+
52
+ if [[ $fail -ne 0 ]]; then
53
+ cat >&2 <<'MSG'
54
+
55
+ Every file under tests/regression/ must include a trace header within
56
+ the first 15 lines, in one of these forms:
57
+
58
+ # Regression for: GH-1234 (preferred — link to GitHub issue)
59
+ # Regression for: <sha-prefix> (link to introducing commit)
60
+ # Regression for: pre-history (no traceable origin)
61
+
62
+ Why: regressions pinned years ago without context are forensic dead-ends
63
+ when they fire. See docs/operations/TESTING.md and #868.
64
+
65
+ MSG
66
+ exit 1
67
+ fi
@@ -0,0 +1,106 @@
1
+ #!/usr/bin/env bash
2
+ # Copyright (c) 2015-2026 Dotfiles. All rights reserved.
3
+ # =============================================================================
4
+ # check-shell-preamble.sh — Enforce `set -euo pipefail` (bash) / `set -eu` (sh)
5
+ # on every executable shell script in the repo.
6
+ #
7
+ # Skip-rules:
8
+ # * Sourced libraries that declare themselves as such via a "Sourced by ..."
9
+ # header comment in the first 15 lines.
10
+ # * Explicit opt-out via `# preamble:skip` marker in the first 15 lines
11
+ # (used by completion files, init fragments, and other library code that
12
+ # is loaded into the caller's shell context).
13
+ # * Files under tests/ (the test runner sets shell options for its children).
14
+ #
15
+ # Invocation:
16
+ # * pre-commit local hook (files passed as args)
17
+ # * standalone: ./scripts/ci/check-shell-preamble.sh # full repo
18
+ # ./scripts/ci/check-shell-preamble.sh file.sh # explicit
19
+ # =============================================================================
20
+
21
+ set -euo pipefail
22
+
23
+ check_one() {
24
+ local f="$1"
25
+
26
+ [[ -f "$f" ]] || return 0
27
+
28
+ local shebang
29
+ shebang="$(head -1 "$f" 2>/dev/null || true)"
30
+
31
+ # Only check files with a bash or sh shebang.
32
+ case "$shebang" in
33
+ *bash*) ;;
34
+ *sh) ;;
35
+ *) return 0 ;;
36
+ esac
37
+
38
+ # Skip files declaring themselves as sourced libraries or opting out.
39
+ if head -15 "$f" | grep -Eq '^# *(Sourced by |preamble:skip|shellcheck source-only)'; then
40
+ return 0
41
+ fi
42
+
43
+ # Skip the test suite — tests are sourced by tests/framework/test_runner.sh
44
+ # which manages shell options for its children.
45
+ case "$f" in
46
+ tests/*) return 0 ;;
47
+ # Bulk-sourced fragments. These directories contain hundreds of
48
+ # alias / function / PATH snippets that are sourced into the
49
+ # caller's shell context — adding `set -e` locally would corrupt
50
+ # the caller. Path-skipped en masse rather than annotated per-file
51
+ # (would be 300+ marker comments).
52
+ .chezmoitemplates/aliases/*) return 0 ;;
53
+ .chezmoitemplates/functions/*) return 0 ;;
54
+ .chezmoitemplates/paths/*) return 0 ;;
55
+ # dot_config/shell/* and scripts/dot/lib/* are also sourced but
56
+ # have explicit `# Sourced by` headers as of #854 (defense in
57
+ # depth — the lint also accepts them on header alone).
58
+ dot_local/bin/executable_dot_completion) return 0 ;; # zsh completion, sourced into shell
59
+ esac
60
+
61
+ # Required preamble lives within the first 50 lines (after optional docstring).
62
+ local preamble_re
63
+ case "$shebang" in
64
+ *bash*)
65
+ preamble_re='^[[:space:]]*set[[:space:]]+-([eu]+o[[:space:]]+pipefail|euo[[:space:]]+pipefail|eu[[:space:]]*$)'
66
+ ;;
67
+ *sh)
68
+ preamble_re='^[[:space:]]*set[[:space:]]+-eu[o]?'
69
+ ;;
70
+ esac
71
+
72
+ if ! head -50 "$f" | grep -Eq "$preamble_re"; then
73
+ echo "MISSING preamble: $f"
74
+ return 1
75
+ fi
76
+ }
77
+
78
+ fail=0
79
+ if [[ $# -gt 0 ]]; then
80
+ for f in "$@"; do
81
+ check_one "$f" || fail=1
82
+ done
83
+ else
84
+ # Full-repo scan
85
+ while IFS= read -r f; do
86
+ check_one "$f" || fail=1
87
+ done < <(git ls-files | grep -E '\.sh$|^dot_local/bin/executable_|^scripts/.+\.sh$')
88
+ fi
89
+
90
+ if [[ $fail -ne 0 ]]; then
91
+ cat >&2 <<'MSG'
92
+
93
+ Some shell scripts are missing the safety preamble.
94
+ * bash → `set -euo pipefail`
95
+ * sh → `set -eu`
96
+
97
+ If the file is a sourced library, add this header to its first 15 lines:
98
+ # Sourced by <parent>.sh; inherits set -euo pipefail
99
+
100
+ If the file is a shell init fragment / completion that must NOT enforce its own
101
+ options on the caller, add this marker instead:
102
+ # preamble:skip
103
+
104
+ MSG
105
+ exit 1
106
+ fi