@bugb-technologies/bravos 1.12.0 → 1.14.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.
@@ -15,6 +15,11 @@
15
15
  # - BRAVOS_LICENCE as an Agents secret (Settings > Secrets and variables > Agents), so the paid
16
16
  # skills run in Copilot's session. Copilot does not see ordinary Actions secrets.
17
17
  # Assigning Copilot through the API is in public preview at GitHub and may change.
18
+ # Team view, off by default: set the repository variable BRAVOS_THREAT_ISSUES to on (Settings > Secrets and
19
+ # variables > Actions > Variables) and the threat-issues job opens one issue per critical or high threat still
20
+ # untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after it was committed. A confirmed threat keeps its issue,
21
+ # relabelled confirmed; it closes once the threat is refuted, fixed, accepted or removed. It needs no secret: the
22
+ # job's own token opens the issues.
18
23
  name: bravos nightly (GitHub Copilot)
19
24
 
20
25
  on:
@@ -93,3 +98,58 @@ jobs:
93
98
  agent_assignment: {target_repo: $repo, base_branch: $base, custom_instructions: "", custom_agent: "", model: ""}}' \
94
99
  | gh api --method POST -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" "repos/$REPO/issues" --input - \
95
100
  | jq -r '"Assigned to Copilot: " + .html_url'
101
+
102
+ # The team view, off by default: with the repository variable BRAVOS_THREAT_ISSUES set to on, one issue per critical
103
+ # or high @exposes claim still untested BRAVOS_THREAT_ISSUES_DAYS days (default 2) after its annotation was committed,
104
+ # relabelled confirmed when a test confirms it, and closed by a later run once the claim is refuted, fixed, accepted
105
+ # or removed; a claim untested again or due a retest reopens the issue the nightly closed. It reads the default
106
+ # branch as merged with guardlink and writes issues with gh and this job's own token; no agent runs here, and annotation
107
+ # text reaches gh only as arguments and --body-file from hooks/lib/threat-issues.mjs, never as a shell line.
108
+ threat-issues:
109
+ if: vars.BRAVOS_THREAT_ISSUES == 'on' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
110
+ runs-on: ubuntu-latest
111
+ timeout-minutes: 15
112
+ permissions:
113
+ contents: read
114
+ issues: write
115
+ defaults:
116
+ run:
117
+ shell: bash
118
+ steps:
119
+ - uses: actions/checkout@v4
120
+ with:
121
+ # guardlink blame reads when each claim was committed from the full history.
122
+ fetch-depth: 0
123
+ persist-credentials: false
124
+
125
+ - uses: actions/setup-node@v4
126
+ with:
127
+ node-version: 22
128
+
129
+ - name: Install guardlink
130
+ run: bash .bravos/hooks/lib/nightly-tools.sh annotate
131
+
132
+ - name: Issues for untested threats
133
+ env:
134
+ GH_TOKEN: ${{ github.token }}
135
+ REPO: ${{ github.repository }}
136
+ SERVER: ${{ github.server_url }}
137
+ SHA: ${{ github.sha }}
138
+ DAYS: ${{ vars.BRAVOS_THREAT_ISSUES_DAYS }}
139
+ run: |
140
+ model="$RUNNER_TEMP/bravos-issues-model.json"
141
+ ledger="$RUNNER_TEMP/bravos-issues-ledger.json"
142
+ blame="$RUNNER_TEMP/bravos-issues-blame.json"
143
+ if ! guardlink parse . > "$model" || ! jq -e '.exposures | arrays' "$model" > /dev/null; then
144
+ echo "::error::unknown: guardlink parse failed"
145
+ exit 1
146
+ fi
147
+ if ! guardlink hypothesis list --json > "$ledger" || ! jq -e '(.ledger == "present" or .ledger == "absent") and (.records | arrays)' "$ledger" > /dev/null; then
148
+ echo "::error::unknown: GuardLink hypothesis ledger unreadable"
149
+ exit 1
150
+ fi
151
+ if ! guardlink blame . --json > "$blame" || ! jq -e '.entries | arrays' "$blame" > /dev/null; then
152
+ echo "::error::unknown: guardlink blame failed"
153
+ exit 1
154
+ fi
155
+ node .bravos/hooks/lib/threat-issues.mjs "$model" "$ledger" "$blame"