Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

docs(security): SECURITY.md on private reporting, and the untrusted-PR review profile

eyalgolan451a3fda15fa
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d73704041..948fddad3 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -61,7 +61,7 @@ AI-assisted work is welcome. Say so in the pull request: which parts, and how yo
## Security
-Never commit keys, tokens or `.env` files. Secret scanning and push protection are on. To report a vulnerability, use **Security → Report a vulnerability** on the repository page (GitHub private reporting); don't open a public issue.
+Never commit keys, tokens or `.env` files. Secret scanning and push protection are on. To report a vulnerability, use **Security → Report a vulnerability** on the repository page (GitHub private reporting); don't open a public issue. What is in scope and what to expect: [SECURITY.md](SECURITY.md). How the maintainer reviews outside pull requests without running their code: [docs/UNTRUSTED_PR_REVIEW.md](docs/UNTRUSTED_PR_REVIEW.md).
## Conduct
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 000000000..9c803d3da
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,43 @@
+# Security policy
+
+## Supported versions
+
+Statecraft: Israel is pre-release and ships from `main`. Only the latest commit on `main` is supported.
+
+## Reporting a vulnerability
+
+Do not open a public issue for a security problem. Use GitHub's private vulnerability reporting: open the repository's
+**Security** tab and choose **Report a vulnerability**
+(https://github.com/eyalgolan/statecraft-israel/security/advisories/new). Only you and the maintainers can see it.
+
+Please include what the issue is and what an attacker gets from it, the steps to reproduce, the commit SHA you
+tested, and your OS and browser (for the WebGL build) or Unity and .NET versions.
+
+## What to expect
+
+Acknowledgement within 5 business days, and an assessment with a rough fix timeline within 15. This is a
+single-maintainer project: those are targets, not a contract. There is no bug bounty. You are credited in the advisory
+and the changelog unless you ask otherwise.
+
+## Scope
+
+In scope:
+
+- The WebGL and desktop builds, including save files (`SaveGame`) and the page flags they read (`?golden`, `?smoke`).
+- The content loader: a crafted file under `content/` or `StreamingAssets/` that crashes or hangs the game or escapes
+ its folder.
+- The repository's CI and scripts (`.github/`, `scripts/`, `tools/`): anything that lets a pull request reach a secret,
+ write to the repository, or run code with more than read access.
+- A credential, token or personal data committed to this repository.
+
+Out of scope:
+
+- Vulnerabilities in Unity, .NET, browsers or third-party packages with no exploitable path through this project
+ (report them upstream).
+- Running a build or a tool you modified yourself.
+
+## Credentials
+
+This repository holds no credentials and never should. Tools that need one (for example `promo/gen.py`) read it from an
+environment variable. If you find one in this repository or its history, report it privately as above. It will be
+revoked at its provider; history is not rewritten.
diff --git a/docs/UNTRUSTED_PR_REVIEW.md b/docs/UNTRUSTED_PR_REVIEW.md
new file mode 100644
index 000000000..920b564a8
--- /dev/null
+++ b/docs/UNTRUSTED_PR_REVIEW.md
@@ -0,0 +1,49 @@
+# Reviewing an outside pull request safely
+
+An outside pull request is untrusted input aimed at a machine that holds the maintainer's credentials (GitHub, Unity,
+ElevenLabs, AI agents). In this repository, opening or testing a pull request **runs its code**:
+
+- **Unity** compiles and runs every script under `unity/Assets/Editor/` (and `[InitializeOnLoad]` code anywhere in
+ `Assets/`) as soon as the project is opened or imported. Opening the PR's branch in the editor is running it.
+- **`dotnet build` / `dotnet test`** run MSBuild targets from every `.csproj` and from `Directory.Build.props`.
+- **`uv run`** installs the dependencies a script declares inline and runs the script. `pytest` runs `conftest.py`
+ at import.
+
+So: **read the diff before running anything, and never run a pull request's code on your own machine before the review
+verdict.** CI runs the PR's code on GitHub's machines with a read-only token and no secrets; that is where it belongs.
+
+**Any diff under `.github/` can make every required check green.** CI runs the workflow file from the pull request
+itself, so a PR that edits `.github/workflows/ci.yml` can turn `Changelog`, `Repo policy` or any other check into a job
+that always passes. Green checks on such a PR mean nothing; read the `.github/` diff first, and the CODEOWNERS review is
+the real gate.
+
+## The profile
+
+```sh
+# 1. A throwaway checkout of only the pull request, in an empty directory:
+rm -rf /tmp/sc-review && mkdir -p /tmp/sc-review && cd /tmp/sc-review
+git clone --depth 50 https://github.com/eyalgolan/statecraft-israel.git repo
+cd repo && git fetch origin pull/<PR#>/head:pr && git checkout pr
+
+# 2. Read the diff first, especially build and editor surfaces:
+git diff origin/main...pr --stat
+git diff origin/main...pr -- '*.csproj' 'sim/Directory.Build.props' 'unity/Assets/Editor/**' '.github/**' 'scripts/**' 'tools/**'
+
+# 3. To run anything, run it in a container with no credentials and no network:
+docker run --rm -it --network none --cap-drop ALL --security-opt no-new-privileges \
+ -v "$PWD":/work:ro -w /work mcr.microsoft.com/dotnet/sdk:10.0 bash
+```
+
+Rules:
+
+1. **No credential volumes.** The container gets the checkout only: no `~/.config/gh`, no `~/.claude`, no Unity
+ licence, no `.env` file.
+2. **No network** (`--network none`). An injected payload's first move is usually to phone home.
+3. **AI review only on a throwaway credential.** If you ask an AI agent to review the PR, run it inside the container
+ with a separate, low-limit key made for that review, never your own session. Treat its verdict as text you read,
+ never as a command you run.
+4. **Never open the PR's `unity/` folder in your Unity editor** until the diff has been read and approved. Unity edit-mode
+ tests for an outside PR are run by the maintainer after merge-readiness, on a branch the maintainer has read.
+5. **No AI agent and no secret in CI for pull requests**, and never `pull_request_target` with a checkout of the PR's code.
+
+This protects the review, not the judgement: merging is still a human decision on what was read.
diff --git a/scripts/oss/tests/test_policies.py b/scripts/oss/tests/test_policies.py
index 7028efd54..c35ec7f16 100644
--- a/scripts/oss/tests/test_policies.py
+++ b/scripts/oss/tests/test_policies.py
@@ -11,3 +11,27 @@ def test_decisions_record_d2_decided_and_d10_d11_open_for_the_owner():
text = read("docs/oss/DECISIONS.md")
assert "- [x] D2" in text and "inbound = outbound" in text
assert "- [ ] D10" in text and "d42bd6b" in text and "- [ ] D11" in text and "Published before checked" in text
+
+
+def test_security_policy_uses_private_reporting_only():
+ text = read("SECURITY.md")
+ assert "security/advisories/new" in text and "@" not in text.replace("@eyalgolan", "")
+ assert "revoked at its provider; history is not rewritten" in text
+
+
+def test_contributing_links_security_and_untrusted_review():
+ text = read("CONTRIBUTING.md")
+ assert "(SECURITY.md)" in text and "docs/UNTRUSTED_PR_REVIEW.md" in text
+
+
+def test_contributing_has_no_cla_and_names_every_sensitive_tag():
+ text = read("CONTRIBUTING.md")
+ assert "There is no CLA and no sign-off" in text
+ for tag in ("holocaust", "terror", "massacre", "war-casualties"):
+ assert f"`{tag}`" in text, tag
+
+
+def test_untrusted_pr_review_forbids_running_pr_code_and_warns_about_github_diffs():
+ text = read("docs/UNTRUSTED_PR_REVIEW.md")
+ assert "--network none" in text and "Assets/Editor" in text and "Directory.Build.props" in text
+ assert "Any diff under `.github/` can make every required check green" in text