@bugb-technologies/bravos 1.16.0 → 1.16.1

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/docs/UPGRADING.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
  After `npm install -g @bugb-technologies/bravos`, run **`bravos setup`** in a repository you work in: it brings this machine and that repository up to date. In repositories you work in with an agent you can skip even that: the agent runs it at the start of a session. From 1.12 on you do not have to watch for releases: Bravos tells you when a newer version is out, and after you install it the agent brings each repository up to date. The notes below say what else changes, newest first. (Before 1.9 the same was `bravos setup --tools -y` per machine and `bravos sync` per repository; both still work.)
4
4
 
5
+ ## 1.16.1
6
+
7
+ - **The workflows Bravos installs are hardened.** This covers the PR gate, the Claude, Codex and Copilot nightlies, and Copilot's setup steps. These are the same issues a SAST scan reports against them:
8
+ - **Every action is pinned to a commit,** with its version in a comment beside it. A moved tag can no longer change what runs.
9
+ - **No token is left in the checkout:** checkouts use `persist-credentials: false`. Copilot's setup is the exception, because Copilot pushes from it.
10
+ - **The nightly push stays authenticated another way.** The token is masked in the log and sent only to the two git commands that need it. It is never written to git config.
11
+ - **guardlink is pinned:** the PR gate and Copilot's setup install the pinned version (2.6.0) instead of whatever npm has that day.
12
+ - **Run `bravos setup`** in each repository that has these workflows, then commit the changed `.github/workflows` files.
13
+ - **It updates only the Bravos workflows you already have.** It never adds one you didn't choose.
14
+ - **A workflow you edited yourself is left as it is.** `bravos sync --ci --force` replaces it.
15
+
5
16
  ## 1.16.0
6
17
 
7
18
  - **"Identify all the threats" uses everything Bravos has.** A new skill, `bravos-threat-hunt`, runs when you ask to identify, find or list threats or vulnerabilities, for a security review or audit, or to threat-model the codebase:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bugb-technologies/bravos",
3
- "version": "1.16.0",
3
+ "version": "1.16.1",
4
4
  "description": "Skills pack and installer that make Claude Code and Codex power users of guardlink (threat-model-as-code) and cert-x-gen (pentest-as-code).",
5
5
  "keywords": [
6
6
  "security",
@@ -9,8 +9,8 @@
9
9
  # run `claude setup-token` once on your machine and store what it prints as the repo secret
10
10
  # CLAUDE_CODE_OAUTH_TOKEN. A repo that already set ANTHROPIC_API_KEY keeps working on that key;
11
11
  # delete that secret to run on your plan instead. Also enable Settings > Actions > General >
12
- # "Allow GitHub Actions to create and approve pull requests". Pin the actions to commit SHAs if
13
- # your organisation requires it.
12
+ # "Allow GitHub Actions to create and approve pull requests". Every action is pinned to a commit (its release in the comment beside it), and no checkout leaves the job's token on disk:
13
+ # the one step that pushes passes it to that push alone.
14
14
  # Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
15
15
  # variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
16
16
  # untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
@@ -49,8 +49,10 @@ jobs:
49
49
  BRAVOS_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
50
50
  BRAVOS_SCAN_TARGET: ${{ vars.BRAVOS_SCAN_TARGET }}
51
51
  steps:
52
- - uses: actions/checkout@v4
53
- - uses: actions/setup-node@v4
52
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
53
+ with:
54
+ persist-credentials: false
55
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
54
56
  with:
55
57
  node-version: 22
56
58
  - name: Check current scheduled consent
@@ -136,9 +138,11 @@ jobs:
136
138
  outputs:
137
139
  open: ${{ steps.gate.outputs.open }}
138
140
  steps:
139
- - uses: actions/checkout@v4
141
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
142
+ with:
143
+ persist-credentials: false
140
144
 
141
- - uses: actions/setup-node@v4
145
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
142
146
  with:
143
147
  node-version: 22
144
148
 
@@ -166,11 +170,12 @@ jobs:
166
170
  run:
167
171
  shell: bash
168
172
  steps:
169
- - uses: actions/checkout@v4
173
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
170
174
  with:
175
+ persist-credentials: false
171
176
  fetch-depth: 0
172
177
 
173
- - uses: actions/setup-node@v4
178
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
174
179
  with:
175
180
  node-version: 22
176
181
 
@@ -195,7 +200,7 @@ jobs:
195
200
  echo "coverage=$(jq -r '.summary.coverage.percent // "unknown"' "$RUNNER_TEMP/ci-before.json")" >> "$GITHUB_OUTPUT"
196
201
 
197
202
  - name: Annotate the next slice
198
- uses: anthropics/claude-code-action@v1
203
+ uses: anthropics/claude-code-action@d1f58ad5e6f4d2b79547e63e37c2116064135896 # v1.0.277
199
204
  with:
200
205
  claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
201
206
  anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
@@ -241,9 +246,15 @@ jobs:
241
246
  LEDGER: ${{ needs.replay.outputs.ledger }}
242
247
  PROOF_SUMMARY: ${{ needs.replay.outputs.summary || 'No completed replay summary. Check the replay job.' }}
243
248
  GH_TOKEN: ${{ github.token }}
249
+ SERVER: ${{ github.server_url }}
244
250
  START: ${{ steps.start.outputs.sha }}
245
251
  BEFORE: ${{ steps.start.outputs.coverage }}
246
252
  run: |
253
+ # The checkout kept no token on disk, so the agent above never saw one. The two git calls that reach the
254
+ # remote get it here as a header, for that call alone.
255
+ basic=$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 | tr -d '\n')
256
+ echo "::add-mask::$basic"
257
+ remote_auth="http.$SERVER/.extraheader=AUTHORIZATION: basic $basic"
247
258
  # Load the staging helper and verified ledger from trusted inputs after the agent exits.
248
259
  git show "$START:.bravos/hooks/lib/nightly-stage.mjs" > "$RUNNER_TEMP/nightly-stage.mjs"
249
260
  node "$RUNNER_TEMP/nightly-stage.mjs"
@@ -258,10 +269,10 @@ jobs:
258
269
  git config user.name "bravos-nightly[bot]"
259
270
  git config user.email "bravos-nightly@users.noreply.github.com"
260
271
  test "$(git rev-parse HEAD)" = "$START"
261
- test "$(git ls-remote --exit-code origin "refs/heads/$base" | cut -f1)" = "$START"
272
+ test "$(git -c "$remote_auth" ls-remote --exit-code origin "refs/heads/$base" | cut -f1)" = "$START"
262
273
  tree=$(git write-tree)
263
274
  commit=$(git commit-tree "$tree" -p "$START" -m "annotate: nightly coverage slice (${BEFORE}% -> ${after}%)")
264
- git -c core.hooksPath=/dev/null push origin "$commit:refs/heads/$branch"
275
+ git -c core.hooksPath=/dev/null -c "$remote_auth" push origin "$commit:refs/heads/$branch"
265
276
  {
266
277
  echo "Nightly coverage slice by bravos-annotate: ${BEFORE}% -> ${after}%."
267
278
  echo
@@ -290,13 +301,13 @@ jobs:
290
301
  run:
291
302
  shell: bash
292
303
  steps:
293
- - uses: actions/checkout@v4
304
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
294
305
  with:
295
306
  # guardlink blame reads when each claim was committed from the full history.
296
307
  fetch-depth: 0
297
308
  persist-credentials: false
298
309
 
299
- - uses: actions/setup-node@v4
310
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
300
311
  with:
301
312
  node-version: 22
302
313
 
@@ -6,8 +6,8 @@
6
6
  # The nightly is on the Team plan: add the repo secret BRAVOS_LICENCE (the token from
7
7
  # account.bugb.io/dashboard/license) so the agent's paid skills run; without it they say so and stop.
8
8
  # Needs the repo secret OPENAI_API_KEY, and Settings > Actions > General > "Allow GitHub
9
- # Actions to create and approve pull requests". Pin the actions to commit SHAs if your
10
- # organisation requires it.
9
+ # Actions to create and approve pull requests". Every action is pinned to a commit (its release in the comment beside it), and no checkout leaves the job's token on disk:
10
+ # the one step that pushes passes it to that push alone.
11
11
  # Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
12
12
  # variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
13
13
  # untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
@@ -44,8 +44,10 @@ jobs:
44
44
  BRAVOS_DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
45
45
  BRAVOS_SCAN_TARGET: ${{ vars.BRAVOS_SCAN_TARGET }}
46
46
  steps:
47
- - uses: actions/checkout@v4
48
- - uses: actions/setup-node@v4
47
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
48
+ with:
49
+ persist-credentials: false
50
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
49
51
  with:
50
52
  node-version: 22
51
53
  - name: Check current scheduled consent
@@ -131,9 +133,11 @@ jobs:
131
133
  outputs:
132
134
  open: ${{ steps.gate.outputs.open }}
133
135
  steps:
134
- - uses: actions/checkout@v4
136
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
137
+ with:
138
+ persist-credentials: false
135
139
 
136
- - uses: actions/setup-node@v4
140
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
137
141
  with:
138
142
  node-version: 22
139
143
 
@@ -161,11 +165,12 @@ jobs:
161
165
  run:
162
166
  shell: bash
163
167
  steps:
164
- - uses: actions/checkout@v4
168
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
165
169
  with:
170
+ persist-credentials: false
166
171
  fetch-depth: 0
167
172
 
168
- - uses: actions/setup-node@v4
173
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
169
174
  with:
170
175
  node-version: 22
171
176
 
@@ -190,7 +195,7 @@ jobs:
190
195
  echo "coverage=$(jq -r '.summary.coverage.percent // "unknown"' "$RUNNER_TEMP/ci-before.json")" >> "$GITHUB_OUTPUT"
191
196
 
192
197
  - name: Annotate the next slice
193
- uses: openai/codex-action@v1
198
+ uses: openai/codex-action@306c6a196a99dcc6582530c396a19d2672d5e9ec # v1.14
194
199
  with:
195
200
  openai-api-key: ${{ secrets.OPENAI_API_KEY }}
196
201
  permission-profile: ":workspace"
@@ -236,9 +241,15 @@ jobs:
236
241
  LEDGER: ${{ needs.replay.outputs.ledger }}
237
242
  PROOF_SUMMARY: ${{ needs.replay.outputs.summary || 'No completed replay summary. Check the replay job.' }}
238
243
  GH_TOKEN: ${{ github.token }}
244
+ SERVER: ${{ github.server_url }}
239
245
  START: ${{ steps.start.outputs.sha }}
240
246
  BEFORE: ${{ steps.start.outputs.coverage }}
241
247
  run: |
248
+ # The checkout kept no token on disk, so the agent above never saw one. The two git calls that reach the
249
+ # remote get it here as a header, for that call alone.
250
+ basic=$(printf 'x-access-token:%s' "$GH_TOKEN" | base64 | tr -d '\n')
251
+ echo "::add-mask::$basic"
252
+ remote_auth="http.$SERVER/.extraheader=AUTHORIZATION: basic $basic"
242
253
  # Load the staging helper and verified ledger from trusted inputs after the agent exits.
243
254
  git show "$START:.bravos/hooks/lib/nightly-stage.mjs" > "$RUNNER_TEMP/nightly-stage.mjs"
244
255
  node "$RUNNER_TEMP/nightly-stage.mjs"
@@ -253,10 +264,10 @@ jobs:
253
264
  git config user.name "bravos-nightly[bot]"
254
265
  git config user.email "bravos-nightly@users.noreply.github.com"
255
266
  test "$(git rev-parse HEAD)" = "$START"
256
- test "$(git ls-remote --exit-code origin "refs/heads/$base" | cut -f1)" = "$START"
267
+ test "$(git -c "$remote_auth" ls-remote --exit-code origin "refs/heads/$base" | cut -f1)" = "$START"
257
268
  tree=$(git write-tree)
258
269
  commit=$(git commit-tree "$tree" -p "$START" -m "annotate: nightly coverage slice (${BEFORE}% -> ${after}%)")
259
- git -c core.hooksPath=/dev/null push origin "$commit:refs/heads/$branch"
270
+ git -c core.hooksPath=/dev/null -c "$remote_auth" push origin "$commit:refs/heads/$branch"
260
271
  {
261
272
  echo "Nightly coverage slice by bravos-annotate: ${BEFORE}% -> ${after}%."
262
273
  echo
@@ -285,13 +296,13 @@ jobs:
285
296
  run:
286
297
  shell: bash
287
298
  steps:
288
- - uses: actions/checkout@v4
299
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
289
300
  with:
290
301
  # guardlink blame reads when each claim was committed from the full history.
291
302
  fetch-depth: 0
292
303
  persist-credentials: false
293
304
 
294
- - uses: actions/setup-node@v4
305
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
295
306
  with:
296
307
  node-version: 22
297
308
 
@@ -43,9 +43,11 @@ jobs:
43
43
  run:
44
44
  shell: bash
45
45
  steps:
46
- - uses: actions/checkout@v4
46
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
47
+ with:
48
+ persist-credentials: false
47
49
 
48
- - uses: actions/setup-node@v4
50
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
49
51
  with:
50
52
  node-version: 22
51
53
 
@@ -116,13 +118,13 @@ jobs:
116
118
  run:
117
119
  shell: bash
118
120
  steps:
119
- - uses: actions/checkout@v4
121
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
120
122
  with:
121
123
  # guardlink blame reads when each claim was committed from the full history.
122
124
  fetch-depth: 0
123
125
  persist-credentials: false
124
126
 
125
- - uses: actions/setup-node@v4
127
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
126
128
  with:
127
129
  node-version: 22
128
130
 
@@ -1,8 +1,9 @@
1
1
  # bravos:generated — written by `bravos init --ci`; `bravos sync --ci` refreshes it while this line stays.
2
2
  # The bravos-ship gate as a pull-request check, the same rulings as the opt-in pre-PR hook.
3
3
  # Deterministic: it runs guardlink only, spends no model, and needs no secret. A gate input that
4
- # fails or does not parse fails the job as "unknown", never passes. Pin the actions below to
5
- # commit SHAs if your organisation requires it.
4
+ # fails or does not parse fails the job as "unknown", never passes. Every action is pinned to a
5
+ # commit (its release in the comment beside it), the checkout keeps no token on disk, and guardlink
6
+ # is the version bravos pins (.bravos/hooks/lib/proof-tool-pins.json).
6
7
  name: bravos security gate
7
8
 
8
9
  on:
@@ -24,16 +25,18 @@ jobs:
24
25
  run:
25
26
  shell: bash
26
27
  steps:
27
- - uses: actions/checkout@v4
28
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
28
29
  with:
30
+ persist-credentials: false
29
31
  fetch-depth: 0
30
32
 
31
- - uses: actions/setup-node@v4
33
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
32
34
  with:
33
35
  node-version: 22
34
36
 
37
+ # The guardlink version bravos pins, installed by the same script as the nightlies, never whatever npm calls latest.
35
38
  - name: Install guardlink
36
- run: npm install -g guardlink
39
+ run: bash .bravos/hooks/lib/nightly-tools.sh annotate
37
40
 
38
41
  - name: Merge base
39
42
  id: base
@@ -292,7 +295,7 @@ jobs:
292
295
  # A fork's pull_request token cannot write security events; skip the upload there.
293
296
  - name: Upload SARIF
294
297
  if: github.event.pull_request.head.repo.full_name == github.repository
295
- uses: github/codeql-action/upload-sarif@v3
298
+ uses: github/codeql-action/upload-sarif@9418214df1f2c4b8128c770156c409013b07d6b9 # v3.39.3
296
299
  with:
297
300
  sarif_file: guardlink.sarif
298
301
  category: guardlink
@@ -25,11 +25,12 @@ jobs:
25
25
  permissions:
26
26
  contents: read
27
27
  steps:
28
- - uses: actions/checkout@v4
28
+ - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
29
29
 
30
- - uses: actions/setup-node@v4
30
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
31
31
  with:
32
32
  node-version: 22
33
33
 
34
+ # The guardlink version bravos pins, installed by the same script as the nightlies.
34
35
  - name: Install guardlink
35
- run: npm install -g guardlink
36
+ run: bash .bravos/hooks/lib/nightly-tools.sh annotate