Skip to content

chore: Repo audit — security/CI hardening, framework fixes, docs consistency + snippet CI guard (2.2)#299

Merged
MCGPPeters merged 8 commits into
mainfrom
audit/fixes
Jun 1, 2026
Merged

chore: Repo audit — security/CI hardening, framework fixes, docs consistency + snippet CI guard (2.2)#299
MCGPPeters merged 8 commits into
mainfrom
audit/fixes

Conversation

@MCGPPeters

@MCGPPeters MCGPPeters commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

What

Repo-wide audit follow-through, grouped into six focused commits: CI/security hardening, repo hygiene, framework security/correctness fixes, documentation-vs-code consistency fixes, a new documentation-snippet compile CI guard, and the 2.2 release bump.

Why

The audit surfaced a script-injection sink, unpinned actions, a server-side data race, a Cross-Site-WebSocket-Hijacking gap, a visual-regression gate that silently passed, and widespread doc/code drift (wrong namespaces, renamed APIs, stale ADRs). These are correctness/security issues for a framework published to NuGet, so they're fixed here and a CI guard is added so doc drift can't silently return.

Changes

Security / CI hardening

  • Fix PR-title script injection; route attacker-controlled fields through env:
  • SHA-pin third-party actions; replace deprecated returntocorp/semgrep-action
  • Least-privilege permissions: on all workflows; concurrency guards; stagger colliding nightly crons

Framework security / correctness

  • HandlerRegistryConcurrentDictionary (removes server render/event/subscription data race)
  • CSWSH: Origin allowlist on the WebSocket upgrade (AbiesServerOptions.AllowedWebSocketOrigins)
  • Default security headers + opt-in CSP on the HTML host; debugger warns outside Development
  • Visual-regression harness fails on missing baseline in CI/strict mode

Documentation + CI guard

  • Corrected namespaces, Program members, HTML DSL names, signatures; reconciled ADR-007/013/021/024/026; TUnit migration; broken-link fixes
  • tools/DocSnippetCheck compiles C# fences tagged compile against the real assemblies (docs-snippets.yml); 31 canonical examples tagged

Hygiene + release

  • Removed stray binaries/scratch artifacts; tightened .gitignore; bump version.json to 2.2 + CHANGELOG

Testing

  • Release build: 0 warnings (non-WASM); Picea.Abies.Server.Kestrel.Tests 54/54 (Debug)
  • DocSnippetCheck: 31 compiled, 0 failed; verified it fails on an injected input_/type_ drift probe

Note: this is intentionally a large, repo-wide audit PR, so the size gate fails by design.

🤖 Generated with Claude Code

MCGPPeters and others added 6 commits June 1, 2026 20:48
…ege)

- Route attacker-controlled PR fields through env: blocks (script injection)
- SHA-pin third-party actions; replace deprecated returntocorp/semgrep-action
- Add least-privilege permissions blocks to all workflows
- Stagger colliding 02:00 nightly crons; add concurrency guards
- Build js-framework-benchmark submodule recursively; drop stray DOTNET_NUGET_AUDIT=false

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Remove tracked scratch/trace dumps and unreferenced root screenshots
- Truncate root beast-mode.agent.md to its intended redirect stub
- Ignore rclone binaries and one-off scratch files

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- HandlerRegistry: ConcurrentDictionary to remove server render/event/subscription race
- WebSocket: Origin allowlist (AbiesServerOptions.AllowedWebSocketOrigins) blocks CSWSH
- HTML host: default security headers + opt-in CSP via AbiesServerOptions
- Debugger: warn when active outside Development
- Visual harness: missing baseline in CI/strict mode fails instead of silently passing
- Enable IsAotCompatible on Server/Browser/UI packable projects

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- Fix namespaces (Picea.Abies.*/Picea), Program member set, HTML DSL names
- Fix Commands/Subscriptions/RenderMode/Option usage and signatures in examples
- Reconcile ADR-007/013/021/024/026 with the implementation
- Migrate testing docs to TUnit; fix broken internal links; align package versions

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- tools/DocSnippetCheck compiles C# fences tagged `compile` against real Abies/Picea assemblies
- docs-snippets.yml workflow (opt-in, least-privilege, concurrency-guarded)
- Document the convention in CONTRIBUTING

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 18:48
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@MCGPPeters MCGPPeters changed the title Repo audit: security/CI hardening, framework fixes, doc consistency + snippet CI guard (2.2) chore: repo audit — security/CI hardening, framework fixes, docs consistency + snippet CI guard (2.2) Jun 1, 2026
Comment on lines +348 to +352
foreach (var allowed in allowlist)
{
if (string.Equals(origin, allowed, StringComparison.OrdinalIgnoreCase))
return true;
}
Comment on lines +273 to +285
foreach (var variable in StrictModeVariables)
{
var value = Environment.GetEnvironmentVariable(variable);
if (string.IsNullOrWhiteSpace(value))
{
continue;
}

if (value is "1" or "true" or "TRUE" or "True")
{
return true;
}
}
Comment on lines +313 to +314
?? Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".nuget", "packages");
string nugetRoot = Environment.GetEnvironmentVariable("NUGET_PACKAGES")
?? Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".nuget", "packages");
string piceaDll = Path.Combine(nugetRoot, "picea", piceaVer, "lib", "net10.0", "Picea.dll");
if (have.Add(name))
{
try { refs.Add(MetadataReference.CreateFromFile(dll)); }
catch { /* skip native/unmanaged */ }

private static string ResolvePiceaVersion(string repoRoot)
{
string csproj = Path.Combine(repoRoot, "Picea.Abies", "Picea.Abies.csproj");
private static List<string> CollectMarkdownFiles(string repoRoot)
{
var files = new List<string>();
string docs = Path.Combine(repoRoot, "docs");
string docs = Path.Combine(repoRoot, "docs");
if (Directory.Exists(docs))
files.AddRange(Directory.EnumerateFiles(docs, "*.md", SearchOption.AllDirectories));
string readme = Path.Combine(repoRoot, "README.md");
var dir = new DirectoryInfo(Directory.GetCurrentDirectory());
while (dir is not null)
{
if (File.Exists(Path.Combine(dir.FullName, "Picea.Abies.sln")))
dir = new DirectoryInfo(AppContext.BaseDirectory);
while (dir is not null)
{
if (File.Exists(Path.Combine(dir.FullName, "Picea.Abies.sln")))
…efer Server AOT

- dotnet format fixes on Endpoints.cs
- Visual harness strict mode now requires ABIES_VISUAL_STRICT (was inferred from CI,
  which made the baseline-less gate fail by construction)
- Revert IsAotCompatible on Picea.Abies.Server (reflection-based JSON in Session.cs)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@MCGPPeters MCGPPeters changed the title chore: repo audit — security/CI hardening, framework fixes, docs consistency + snippet CI guard (2.2) chore: Repo audit — security/CI hardening, framework fixes, docs consistency + snippet CI guard (2.2) Jun 1, 2026
@MCGPPeters MCGPPeters merged commit 3d5838c into main Jun 1, 2026
41 of 45 checks passed
@MCGPPeters MCGPPeters deleted the audit/fixes branch June 1, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants