Skip to content

Commit edab53e

Browse files
committed
chore(security): resolve code-scanning and Dependabot findings
- ci.yml: drop unused checks:write and pull-requests:write from the test and test-macos jobs. The actions that justified them (junit-report, test-reporter) are no longer present, so the permissions and their comments were stale; the jobs now run with contents:read only. - Apply the refurb idiom fixes flagged by code scanning across 15 files (dict()/list() to .copy(), chained comparisons, operator.itemgetter, a list comprehension, and fluent-interface chaining). Behavior-preserving. - Bump vscode dev dependencies: @babel/core to 7.29.7 and js-yaml to 4.2.0 to clear the npm advisories (arbitrary file read; merge-key DoS).
1 parent 3c6f8d8 commit edab53e

18 files changed

Lines changed: 166 additions & 158 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,14 +1305,6 @@ jobs:
13051305
timeout-minutes: 90
13061306
permissions:
13071307
contents: read
1308-
# Required by mikepenz/action-junit-report to create check-run
1309-
# annotations surfaced in the PR Checks tab.
1310-
checks: write
1311-
# Required by ctrf-io/github-test-reporter to post the test-result
1312-
# summary comment on the PR that triggered the run. The action no-
1313-
# ops gracefully on push events; the workflow-level Step Summary
1314-
# is always populated.
1315-
pull-requests: write
13161308
env:
13171309
# Single source of truth for the shard count. The `--shard i/N`
13181310
# denominator below and the per-shard slice both key off this; bump
@@ -1531,7 +1523,6 @@ jobs:
15311523
timeout-minutes: 90
15321524
permissions:
15331525
contents: read
1534-
checks: write
15351526
env:
15361527
# Per-push macOS runs only shard 1 of this many - a deterministic
15371528
# ~1/4 subset of the file list. ci-macos-nightly.yml runs the full

docs/operations/ci-topology.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ This report lists the workflow graph surfaces reviewers need to inspect when CI
183183
| .github/workflows/ci-gate-stub.yml | workflow: {"contents": "read"}<br>ci-gate: {"contents": "read"} | - |
184184
| .github/workflows/ci-macos-nightly.yml | workflow: {"contents": "read"}<br>open-failure-issue: {"contents": "read", "issues": "write"}<br>test-macos-nightly: {"checks": "write", "contents": "read"} | GITHUB_TOKEN |
185185
| .github/workflows/ci-weekly-digest.yml | digest: {"contents": "read", "issues": "write"} | - |
186-
| .github/workflows/ci.yml | workflow: {"contents": "read"}<br>actionlint: {"contents": "read"}<br>adapter-integration: {"contents": "read"}<br>adapter-integration-macos: {"contents": "read"}<br>autofix: {"contents": "write"}<br>bandit: {"contents": "read"}<br>beartype: {"contents": "read"}<br>ci-gate: {"contents": "read"}<br>close-ci-issues: {"contents": "read", "issues": "write"}<br>coverage-report: {"contents": "read"}<br>dead-code: {"contents": "read"}<br>determine-changes: {"contents": "read"}<br>diff-coverage: {"contents": "read"}<br>dist-size: {"contents": "read"}<br>install-smoke-pipx: {"contents": "read"}<br>install-smoke-uv: {"contents": "read"}<br>lineage-gate: {"contents": "read"}<br>lint: {"contents": "read"}<br>mutmut-diff: {"contents": "read"}<br>pip-audit: {"contents": "read"}<br>pr-summary: {"pull-requests": "write"}<br>property-tests: {"contents": "read"}<br>pyright-strict-zone: {"contents": "read"}<br>repo-hygiene: {"contents": "read"}<br>schemathesis-smoke: {"contents": "read"}<br>semgrep: {"contents": "read"}<br>snapshot-tests: {"contents": "read"}<br>spelling: {"contents": "read"}<br>test: {"checks": "write", "contents": "read", "pull-requests": "write"}<br>test-macos: {"checks": "write", "contents": "read"}<br>typecheck: {"contents": "read"} | CODECOV_TOKEN, GITHUB_TOKEN |
186+
| .github/workflows/ci.yml | workflow: {"contents": "read"}<br>actionlint: {"contents": "read"}<br>adapter-integration: {"contents": "read"}<br>adapter-integration-macos: {"contents": "read"}<br>autofix: {"contents": "write"}<br>bandit: {"contents": "read"}<br>beartype: {"contents": "read"}<br>ci-gate: {"contents": "read"}<br>close-ci-issues: {"contents": "read", "issues": "write"}<br>coverage-report: {"contents": "read"}<br>dead-code: {"contents": "read"}<br>determine-changes: {"contents": "read"}<br>diff-coverage: {"contents": "read"}<br>dist-size: {"contents": "read"}<br>install-smoke-pipx: {"contents": "read"}<br>install-smoke-uv: {"contents": "read"}<br>lineage-gate: {"contents": "read"}<br>lint: {"contents": "read"}<br>mutmut-diff: {"contents": "read"}<br>pip-audit: {"contents": "read"}<br>pr-summary: {"pull-requests": "write"}<br>property-tests: {"contents": "read"}<br>pyright-strict-zone: {"contents": "read"}<br>repo-hygiene: {"contents": "read"}<br>schemathesis-smoke: {"contents": "read"}<br>semgrep: {"contents": "read"}<br>snapshot-tests: {"contents": "read"}<br>spelling: {"contents": "read"}<br>test: {"contents": "read"}<br>test-macos: {"contents": "read"}<br>typecheck: {"contents": "read"} | CODECOV_TOKEN, GITHUB_TOKEN |
187187
| .github/workflows/cifuzz-pr.yml | workflow: {"contents": "read"}<br>cifuzz: {"contents": "read"} | GITHUB_TOKEN |
188188
| .github/workflows/cleanup-runs.yml | workflow: {"contents": "read"}<br>cleanup: {"actions": "write"} | GITHUB_TOKEN |
189189
| .github/workflows/cluster-e2e.yml | workflow: {"contents": "read"} | - |

packages/vscode/package-lock.json

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

src/bernstein/cli/commands/cost.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -935,7 +935,7 @@ def _read_envelopes_from_yaml(yaml_path: Path) -> dict[str, dict[str, Any]]:
935935
for name, payload in envelopes_block.items():
936936
if isinstance(payload, dict):
937937
payload_d = cast("dict[str, Any]", payload)
938-
out[name] = dict(payload_d)
938+
out[name] = payload_d.copy()
939939
return out
940940

941941

src/bernstein/cli/commands/telemetry_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def telemetry_status(home: Path | None) -> None:
143143
dsn = os.environ.get(sidechannel.DSN_ENV) or "(unset)"
144144
from bernstein.core.telemetry.share import resolve_share_endpoint
145145

146-
share_endpoint_configured = resolve_share_endpoint(dict(os.environ)) is not None
146+
share_endpoint_configured = resolve_share_endpoint(os.environ.copy()) is not None
147147
lines: list[str] = [
148148
f"enabled: {str(state.enabled).lower()}",
149149
f"source: {state.source.value}",

src/bernstein/cli/commands/verify_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ def _verify_determinism(
643643

644644
fingerprint = fp.compute()
645645

646-
if expect is None and baseline_run_id is None:
646+
if expect is None is baseline_run_id:
647647
# Bare mode: observe-only, byte-identical to the original surface.
648648
# The entry count is only displayed in this branch, so the second WAL
649649
# scan stays scoped here rather than running for every gated call.

src/bernstein/cli/commands/worktrees_cmd.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def gc_cmd(workdir: Path, yes: bool, dry_run: bool, force_unsaved: bool) -> None
318318
console.print("[green]No reapable worktrees - nothing to do.[/green]")
319319
return
320320

321-
targets = list(reapable)
321+
targets = reapable.copy()
322322
if force_unsaved:
323323
targets.extend(unsaved)
324324

src/bernstein/cli/ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def from_dict(cls, data: str | dict[str, Any]) -> AgentInfo:
156156
role=str(data.get("role", "")),
157157
model=str(data.get("model", "")),
158158
status=str(data.get("status", "idle")),
159-
task_ids=list(cast("list[str]", data.get("task_ids") or [])),
159+
task_ids=cast("list[str]", data.get("task_ids") or []).copy(),
160160
runtime_s=float(data.get("runtime_s", 0.0)),
161161
abort_reason=str(data.get("abort_reason", "")),
162162
abort_detail=str(data.get("abort_detail", "")),

src/bernstein/core/approval/gate.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,7 @@ def load_approval_config(workdir: Path | None = None) -> ApprovalConfig:
9696
return ApprovalConfig()
9797
if not isinstance(raw, dict):
9898
return ApprovalConfig()
99-
raw_mapping = cast("dict[str, Any]", raw)
100-
raw_section: object = raw_mapping.get("approvals")
99+
raw_section: object = cast("dict[str, Any]", raw).get("approvals")
101100
if not isinstance(raw_section, dict):
102101
return ApprovalConfig()
103102
section = cast("dict[str, Any]", raw_section)

src/bernstein/core/config/home.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,7 @@ def _load(self) -> dict[str, Any]:
208208

209209
def load_raw(self) -> dict[str, object]:
210210
"""Return raw persisted global settings without default expansion."""
211-
data = self._load()
212-
return dict(data)
211+
return self._load().copy()
213212

214213
def _save(self, data: dict[str, Any]) -> None:
215214
"""Persist data to config.yaml, creating home dir if needed."""

0 commit comments

Comments
 (0)