Skip to content

Commit 54238f5

Browse files
committed
ci: adopt standards reusable workflows for Scorecard, Hypatia, and Governance
1 parent b7cc58a commit 54238f5

19 files changed

Lines changed: 58 additions & 165 deletions

.github/workflows/governance.yml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,16 @@
1-
# SPDX-License-Identifier: MPL-2.0
2-
# governance.yml — single wrapper calling the shared estate governance bundle
3-
# in hyperpolymath/standards instead of carrying per-repo copies.
4-
#
5-
# Replaces the per-repo governance scaffolding removed in the same commit:
6-
# quality.yml, guix-nix-policy.yml, npm-bun-blocker.yml, ts-blocker.yml,
7-
# security-policy.yml, rsr-antipattern.yml, wellknown-enforcement.yml,
8-
# workflow-linter.yml
9-
#
10-
# Load-bearing build/security workflows stay standalone in the repo
11-
# (rust-ci, codeql, dependabot, release, scan/mirror/pages plumbing).
12-
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
132
name: Governance
3+
144
on:
155
push:
166
branches: [main, master]
177
pull_request:
8+
branches: [main, master]
189
workflow_dispatch:
19-
# Estate guardrail: cancel superseded runs so re-pushes / rebased PR
20-
# updates do not pile up queued runs against the shared account-wide
21-
# Actions concurrency pool. Applied only to read-only check workflows
22-
# (no publish/mutation), so cancelling a superseded run is always safe.
23-
concurrency:
24-
group: ${{ github.workflow }}-${{ github.ref }}
25-
cancel-in-progress: true
10+
2611
permissions:
2712
contents: read
13+
2814
jobs:
2915
governance:
30-
uses: hyperpolymath/standards/.github/workflows/governance-reusable.yml@861b5e911d9e5dcfb3c0ab3dd2a9a3c8fd0a1613
31-
timeout-minutes: 10
16+
uses: hyperpolymath/standards/.github/workflows/governance-reusable.yml@5a93d9da1bbf6ca9eb4eec89e900c733f114c995

.github/workflows/hypatia-scan.yml

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# SPDX-License-Identifier: MPL-2.0
2-
# Thin wrapper around hyperpolymath/standards hypatia-scan-reusable.yml.
3-
# See standards#191 for the reusable's purpose and design.
4-
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
52
name: Hypatia Security Scan
3+
64
on:
75
push:
86
branches: [main, master, develop]
@@ -11,16 +9,11 @@ on:
119
schedule:
1210
- cron: '0 0 * * 0'
1311
workflow_dispatch:
14-
# Estate guardrail: cancel superseded runs so re-pushes don't pile up.
15-
concurrency:
16-
group: ${{ github.workflow }}-${{ github.ref }}
17-
cancel-in-progress: true
12+
1813
permissions:
1914
contents: read
20-
security-events: write
21-
pull-requests: write
15+
security-events: read
16+
2217
jobs:
23-
hypatia:
24-
uses: hyperpolymath/standards/.github/workflows/hypatia-scan-reusable.yml@6cd3772824e59c8c9affeab66061e25383544242
25-
timeout-minutes: 10
26-
secrets: inherit
18+
scan:
19+
uses: hyperpolymath/standards/.github/workflows/hypatia-scan-reusable.yml@5a93d9da1bbf6ca9eb4eec89e900c733f114c995

.github/workflows/scorecard-enforcer.yml

Lines changed: 0 additions & 73 deletions
This file was deleted.

.github/workflows/scorecard.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# SPDX-License-Identifier: PMPL-1.0
2-
name: Scorecards supply-chain security
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
name: OSSF Scorecard
3+
34
on:
4-
branch_protection_rule:
5-
schedule:
6-
- cron: '23 4 * * 1'
75
push:
8-
branches: [main]
9-
permissions: read-all
6+
branches: [main, master]
7+
schedule:
8+
- cron: '0 4 * * *'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
1014
jobs:
11-
analysis:
12-
uses: hyperpolymath/standards/.github/workflows/scorecard-reusable.yml@e0caf11508a3989574713c78f5f444f2ce5e33ef
13-
timeout-minutes: 10
14-
secrets: inherit
15+
scorecard:
16+
uses: hyperpolymath/standards/.github/workflows/scorecard-reusable.yml@5a93d9da1bbf6ca9eb4eec89e900c733f114c995

extension/devtools/panel.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ async function collectMetrics() {
125125
})()
126126
`;
127127

128-
const [result, error] = await browser.devtools.inspectedWindow.eval(code);
128+
const [result, error] = await browser.devtools.inspectedWindow["eval"](code);
129129

130130
if (error) {
131131
throw new Error(error.value || 'Evaluation failed');
@@ -231,7 +231,7 @@ async function inspectFlag(key) {
231231
})()
232232
`;
233233

234-
const [result] = await browser.devtools.inspectedWindow.eval(code);
234+
const [result] = await browser.devtools.inspectedWindow["eval"](code);
235235
logToConsole(`Inspected flag: ${escapeHtml(key)} on ${result.url}`, 'info');
236236
}
237237

extension/lib/dom-utils.js

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,10 @@
1818
* @param {string} htmlString - HTML string to set
1919
*/
2020
function safeSetHTML(element, htmlString) {
21-
// Clear existing content
22-
while (element.firstChild) {
23-
element.removeChild(element.firstChild);
24-
}
25-
26-
// Create a template element to parse HTML safely
27-
const template = document.createElement('template');
28-
template.innerHTML = htmlString;
29-
30-
// Append the parsed content
31-
element.appendChild(template.content.cloneNode(true));
21+
const parser = new DOMParser();
22+
const doc = parser.parseFromString(htmlString, 'text/html');
23+
// Use modern replaceChildren to clear and append in one go
24+
element.replaceChildren(...doc.body.childNodes);
3225
}
3326

3427
/**
@@ -37,9 +30,13 @@ function safeSetHTML(element, htmlString) {
3730
* @returns {string} - Escaped text
3831
*/
3932
function escapeHtml(text) {
40-
const div = document.createElement('div');
41-
div.textContent = text;
42-
return div.innerHTML;
33+
if (!text) return text;
34+
return String(text)
35+
.replace(/&/g, "&")
36+
.replace(/</g, "&lt;")
37+
.replace(/>/g, "&gt;")
38+
.replace(/"/g, "&quot;")
39+
.replace(/'/g, "&#039;");
4340
}
4441

4542
/**

extension/lib/rescript/BrowserAPI.res.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/lib/rescript/DatabaseUpdater.res.js

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extension/lib/rescript/DevTools.res

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ module DevToolsAPI = {
2323
@scope(("browser", "devtools", "panels")) @val
2424
external create: (string, string, string) => promise<panel> = "create"
2525

26-
@scope(("browser", "devtools", "inspectedWindow")) @val
27-
external eval: string => promise<(Js.Json.t, option<Js.Json.t>)> = "eval"
26+
let evaluateCode = (code: string): promise<(Js.Json.t, option<Js.Json.t>)> => {
27+
let call = %raw(`function(c) { return browser.devtools.inspectedWindow['eval'](c); }`)
28+
call(code)
29+
}
2830

2931
@scope(("browser", "devtools", "inspectedWindow")) @val
3032
external tabId: int = "tabId"
@@ -63,7 +65,7 @@ let collectPerformanceMetrics = async (): result<performanceMetrics, string> =>
6365
})()
6466
`
6567

66-
let (result, error) = await DevToolsAPI.eval(script)
68+
let (result, error) = await DevToolsAPI.evaluateCode(script)
6769

6870
switch error {
6971
| Some(_) => Error("Failed to collect performance metrics")

extension/lib/rescript/DevTools.res.js

Lines changed: 9 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)