Skip to content

Commit 48d1c12

Browse files
authored
Release 1.225.0
See release notes.
2 parents 076fe37 + aa60b11 commit 48d1c12

2,208 files changed

Lines changed: 308796 additions & 118728 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/nextest.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ large-data-tests = { max-threads = 1 }
55
[profile.default]
66
# Default settings
77

8+
[profile.ci]
9+
# GitHub Actions runners have 4 vCPUs and 16GB RAM.
10+
# Limit parallelism to avoid OOM kills from too many concurrent test processes.
11+
test-threads = 2
12+
813
[[profile.default.overrides]]
914
filter = 'test(serial_tests)'
1015
test-group = 'serial-tests'

.docker/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Docker services
2+
3+
## Postgres (local testing)
4+
5+
Postgres integration tests run on Linux when a Postgres instance is available.
6+
7+
### Start Postgres and init schema
8+
9+
From the repo root:
10+
11+
```bash
12+
make init-services
13+
```
14+
15+
This starts the Postgres container (from this `docker-compose.yml`), waits for it, and applies the schema (`schema/sql/types.sql`, `tables.sql`, `functions.sql`, `partitions.sql`).
16+
17+
Credentials (default): user `nautilus`, password `pass`, database `nautilus`, port `5432`.
18+
19+
### Run Postgres tests
20+
21+
**Python:**
22+
23+
```bash
24+
make test-postgres
25+
```
26+
27+
Requires `make init-services` (or at least `make start-services` then `make init-db`) to have been run first.
28+
29+
**Rust:**
30+
31+
```bash
32+
POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_USERNAME=nautilus POSTGRES_PASSWORD=pass POSTGRES_DATABASE=nautilus \
33+
cargo test -p nautilus-infrastructure --features postgres -- --test-threads=1
34+
```
35+
36+
### Start Postgres only (no schema)
37+
38+
```bash
39+
docker compose -f .docker/docker-compose.yml up -d postgres
40+
```
41+
42+
Then from repo root: `make init-db` to apply the schema.
43+
44+
### Stop / purge
45+
46+
- `make stop-services` — stop containers (data preserved).
47+
- `make purge-services` — stop and remove volumes.

.docker/docker-compose.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ services:
99
PGDATA: /data/postgres
1010
volumes:
1111
- nautilus-database:/data/postgres
12+
security_opt:
13+
- no-new-privileges:true
1214
ports:
13-
- "5432:5432"
15+
- "127.0.0.1:5432:5432"
1416
networks:
1517
- nautilus-network
1618
restart: unless-stopped
@@ -26,16 +28,18 @@ services:
2628
security_opt:
2729
- no-new-privileges:true
2830
ports:
29-
- "${PGADMIN_PORT:-5051}:80"
31+
- "127.0.0.1:${PGADMIN_PORT:-5051}:80"
3032
networks:
3133
- nautilus-network
3234
restart: unless-stopped
3335

3436
redis:
3537
container_name: nautilus-redis
3638
image: redis
39+
security_opt:
40+
- no-new-privileges:true
3741
ports:
38-
- "6379:6379"
42+
- "127.0.0.1:6379:6379"
3943
restart: unless-stopped
4044
networks:
4145
- nautilus-network

.docker/jupyterlab.dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ RUN apt-get update && \
1313
rm -rf /var/lib/apt/lists/*
1414

1515
# Install UV
16-
COPY uv-version ./
17-
RUN UV_VERSION=$(cat uv-version) && curl -LsSf https://astral.sh/uv/$UV_VERSION/install.sh | sh
16+
COPY scripts/uv-version.sh scripts/
17+
COPY pyproject.toml ./
18+
RUN UV_VERSION=$(bash scripts/uv-version.sh) && curl -LsSf https://astral.sh/uv/$UV_VERSION/install.sh | sh
1819

1920
RUN uv pip install --system jupyterlab datafusion
2021

.docker/nautilus_trader.dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ RUN apt-get update && \
2525
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
2626

2727
# Install UV
28-
COPY uv-version ./
29-
RUN UV_VERSION=$(cat uv-version) && curl -LsSf https://astral.sh/uv/$UV_VERSION/install.sh | sh
28+
COPY scripts/uv-version.sh scripts/
29+
COPY pyproject.toml ./
30+
RUN UV_VERSION=$(bash scripts/uv-version.sh) && curl -LsSf https://astral.sh/uv/$UV_VERSION/install.sh | sh
3031

3132
# Install package requirements
3233
COPY uv.lock pyproject.toml build.py ./

.github/OVERVIEW.md

Lines changed: 128 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CI/CD, testing, publishing, and automation within the NautilusTrader repository.
99
## Composite actions (`.github/actions`)
1010

1111
- **cargo-tool-install**: installs cargo tools (cargo-deny, cargo-vet) with caching.
12-
- **common-setup**: prepares the environment (OS packages, Rust toolchain, Python, sccache, pre-commit).
12+
- **common-setup**: prepares the environment (OS packages, Rust toolchain, Rust cache, Python, pre-commit, swap space).
1313
- **common-test-data**: caches large test data under `tests/test_data/large`.
1414
- **common-wheel-build**: builds and installs Python wheels across Linux, macOS, and Windows for multiple Python versions.
1515
- **install-capnp**: installs the Cap'n Proto compiler with caching across Linux, macOS, and Windows.
@@ -18,8 +18,8 @@ CI/CD, testing, publishing, and automation within the NautilusTrader repository.
1818

1919
## Workflows (`.github/workflows`)
2020

21-
- **build.yml**: main CI pipeline - pre-commit, cargo-deny, Rust tests, Python tests, wheel builds, and artifact uploads.
22-
- **build-v2.yml**: CI pipeline for the v2 Rust-native system.
21+
- **build.yml**: main CI pipeline - plan, pre-commit, cargo-deny, Rust tests, Python tests, wheel builds, and artifact uploads. Uses Depot 8-core runners for Linux and Windows builds. Includes a plan step that skips builds on docs-only changes and skips Rust tests on Python-only changes.
22+
- **build-v2.yml**: CI pipeline for the v2 Rust-native system. Uses Depot 8-core runners for Linux builds.
2323
- **build-docs.yml**: dispatches documentation build on `master` and `nightly` pushes.
2424
- **cli-binaries.yml**: builds and publishes CLI binaries for multiple platforms.
2525
- **codeql-analysis.yml**: CodeQL security scans for Python and Rust on PRs and via cron.
@@ -45,24 +45,80 @@ CI/CD, testing, publishing, and automation within the NautilusTrader repository.
4545
### Dependency security
4646

4747
- **cargo-deny**: Rust dependency auditing for security advisories (RUSTSEC/GHSA), license compliance, banned crates, and supply chain integrity. Configuration in `deny.toml`.
48-
- **Dependency pinning**: Key tools (pre-commit, Python versions, Rust toolchain, cargo-nextest) are locked to fixed versions or SHAs.
48+
- **Dependency pinning**: Key tools (pre-commit, Python versions, Rust toolchain, cargo-nextest, uv) are locked to fixed versions or SHAs. The uv version is pinned via `required-version` in `pyproject.toml` and extracted by `scripts/uv-version.sh` for CI, Docker, and local builds.
49+
- **Dependency cooldown**: Python dependency resolution excludes packages published within the last 3 days (`exclude-newer = "3 days"` in `[tool.uv]`). This gives the community time to detect and quarantine compromised releases before they enter the lockfile.
4950
- **Code scanning**: CodeQL is enabled for continuous security analysis of Python and Rust code on all PRs and weekly via cron.
5051

5152
### Build integrity
5253

5354
- **Build attestations**: All published artifacts include cryptographic SLSA build provenance attestations, linking each artifact to a specific commit SHA. Verify via `gh attestation verify`.
5455
- **Immutable action pinning**: All third-party GitHub Actions are pinned to specific commit SHAs.
5556
- **Docker image pinning**: Base images in Dockerfiles and service containers in workflows are pinned to SHA256 digests to prevent supply-chain attacks via tag mutation.
56-
- **Caching**: Caches for sccache, pip/site-packages, pre-commit, and test data speed up workflows while preserving hermetic (reproducible) builds.
57+
- **Caching**: Rust target directory cache (`Swatinem/rust-cache`), pip/site-packages, pre-commit, and test data caches speed up workflows while preserving hermetic (reproducible) builds. Rust cache saves are restricted to push events to prevent PR cache pollution.
58+
- **Concurrency**: PR CI runs are cancelled when a new push arrives to the same PR. Push events to mainline branches are never cancelled.
59+
- **Runners**: Linux and Windows builds use Depot 8-core runners (32 GB RAM, 150 GB SSD). macOS builds use GitHub free runners. Lightweight jobs (plan, cargo-deny, cargo-vet, publish) use GitHub free runners. Custom runner labels are declared in `.github/actionlint.yaml`.
5760

5861
### Runtime hardening
5962

60-
- **Hardened runners**: Most workflows employ `step-security/harden-runner` with `egress-policy: audit` to reduce attack surface and monitor outbound traffic.
63+
- **Hardened runners**: All workflows employ `step-security/harden-runner` to reduce attack surface and
64+
monitor outbound traffic. All workflows default `egress-policy` to `block`. Set
65+
`STEP_SECURITY_EGRESS_POLICY=audit` only as a temporary rollback while expanding an allow list. Jobs that
66+
declare a GitHub Environment can override the repo or org value with an environment-scoped variable. The
67+
publish environments (`r2-develop`, `r2-nightly`, `release`) can use this override too. The
68+
`security-audit.yml` workflow also reads its allow list from GitHub Environments so it can validate
69+
branch changes before promoting the same settings to scheduled runs on the default branch.
70+
- **Fork PR handling**: `build.yml` falls back to `egress-policy: audit` for fork PRs. Forks cannot
71+
access repo or org variables, so the allow lists would be empty and block all network access. Fork PRs
72+
run with read-only permissions and no access to secrets, so audit mode is safe.
73+
74+
### Security gate override
75+
76+
The `security-gate-nightly` job runs `cargo audit` and `osv-scanner` to catch vulnerabilities
77+
before publishing. Occasionally, upstream events outside our control (transitive dependency
78+
advisories, crate yanks for non-security reasons) can block the nightly pipeline with no
79+
actionable fix on our side.
80+
81+
The repo-scoped variable `SECURITY_GATE_OVERRIDE` holds an ISO 8601 UTC timestamp
82+
(e.g. `2026-03-28T02:00:00Z`). When the current time is before the timestamp, the security
83+
gate is skipped. When the timestamp passes, the gate re-enables automatically with no manual
84+
reset. The variable will be left unset for normal operations.
85+
86+
A repo admin will thoroughly assess all flagged items before setting the timestamp, and will
87+
scope it to the minimum window needed for the blocked build to complete:
88+
89+
```
90+
date -u -d '+2 hours' --iso-8601=seconds # e.g. 2 hour window
91+
```
92+
93+
Modifying repo variables requires admin access. An attacker with that level of access can
94+
already disable workflows or push directly, so the override does not widen the attack surface.
95+
96+
`cargo audit` catches CVEs and unsound code advisories independent of yank status. A crate
97+
yanked for non-security reasons (MSRV mistakes, broken builds, accidental publishes) produces
98+
a warning but does not indicate a vulnerability.
6199

62100
### Allowed network endpoints
63101

64102
The `step-security/harden-runner` action restricts network access to approved endpoints.
65-
Common endpoints are maintained in the variable `COMMON_ALLOWED_ENDPOINTS`:
103+
All three variables are stored in GitHub as single-line, space-delimited values. The pinned
104+
`step-security/harden-runner` version does not enforce newline-delimited values correctly
105+
in `block` mode.
106+
107+
All workflows read these GitHub variables:
108+
109+
- `STEP_SECURITY_EGRESS_POLICY`: StepSecurity egress mode for the job. Workflows default to `block`. Set
110+
`audit` only as a temporary override while expanding an allow list.
111+
- `COMMON_ALLOWED_ENDPOINTS`: Endpoints needed by every job (GitHub API, Ubuntu packages, tooling).
112+
- `CI_ALLOWED_ENDPOINTS`: Extra endpoints shared by the main CI, nightly, docs, and release workflows.
113+
- `SECURITY_AUDIT_ALLOWED_ENDPOINTS`: Extra endpoints needed by the security audit jobs.
114+
115+
Some workflows add job-specific endpoints inline (e.g., `upload.pypi.org:443` for publishing,
116+
`auth.docker.io:443` and `registry-1.docker.io:443` for Docker builds).
117+
118+
Use the `security-audit` environment for the default branch and `master`. Use `security-audit-test` for
119+
branch tests such as `test-security`.
120+
121+
#### `COMMON_ALLOWED_ENDPOINTS`
66122

67123
```
68124
api.github.com:443 # GitHub API
@@ -80,10 +136,74 @@ media.githubusercontent.com:443 # GitHub media content
80136
archive.ubuntu.com:443 # Ubuntu package archives
81137
security.ubuntu.com:443 # Ubuntu security updates
82138
azure.archive.ubuntu.com:443 # Azure Ubuntu mirrors
139+
ports.ubuntu.com:443 # Ubuntu ports archives
140+
changelogs.ubuntu.com:443 # Ubuntu changelogs
141+
esm.ubuntu.com:443 # Ubuntu ESM (extended security)
142+
motd.ubuntu.com:443 # Ubuntu MOTD updates
83143
astral.sh:443 # UV/Ruff tooling
144+
proxy.golang.org:443 # Go module proxy (shfmt pre-commit hook)
145+
sum.golang.org:443 # Go checksum database
146+
storage.googleapis.com:443 # Go module downloads (via proxy)
147+
registry.npmjs.org:443 # npm packages (actionlint hook)
148+
api.snapcraft.io:443 # Ubuntu snap API (runner infra)
149+
```
150+
151+
#### `CI_ALLOWED_ENDPOINTS`
152+
153+
```
154+
artifactcache.actions.githubusercontent.com:443 # Actions cache
155+
github-releases.githubusercontent.com:443 # GitHub release downloads
156+
launch.actions.githubusercontent.com:443 # Actions launch
157+
results-receiver.actions.githubusercontent.com:443 # Actions results
158+
release-assets.githubusercontent.com:443 # Release assets
159+
hosted-compute-request-orchestrator-prod-iad-01.githubapp.com:443 # Runner orchestration
160+
hosted-compute-request-orchestrator-prod-iad-02.githubapp.com:443 # Runner orchestration
161+
hosted-compute-watchdog-prod-iad-01.githubapp.com:443 # Runner watchdog
162+
hosted-compute-watchdog-prod-iad-02.githubapp.com:443 # Runner watchdog
163+
packages.microsoft.com:443 # Microsoft packages
164+
sh.rustup.rs:443 # Rust toolchain installer
165+
static.rust-lang.org:443 # Rust toolchain downloads
166+
crates.io:443 # Rust crate registry
167+
index.crates.io:443 # Rust crate index
168+
static.crates.io:443 # Rust crate downloads
169+
pypi.org:443 # Python packages
170+
files.pythonhosted.org:443 # Python package files
171+
capnproto.org:443 # Cap'n Proto compiler
172+
packages.nautechsystems.io:443 # Nautech packages
173+
test-data.nautechsystems.io:443 # Nautech test data
174+
formulae.brew.sh:443 # Homebrew formulae
175+
community.chocolatey.org:443 # Chocolatey community
176+
chocolatey.org:443 # Chocolatey packages
177+
packages.chocolatey.org:443 # Chocolatey downloads
178+
archive.ubuntu.com:80 # Ubuntu archives (HTTP)
179+
security.ubuntu.com:80 # Ubuntu security (HTTP)
180+
azure.archive.ubuntu.com:80 # Azure Ubuntu (HTTP)
181+
ports.ubuntu.com:80 # Ubuntu ports (HTTP)
182+
fulcio.sigstore.dev:443 # Sigstore certificate authority
183+
rekor.sigstore.dev:443 # Sigstore transparency log
184+
codspeed.io:443 # CodSpeed benchmarking
84185
```
85186

86-
Job-specific endpoints (e.g., `pypi.org:443` for publishing jobs) are added inline within each workflow.
187+
#### `SECURITY_AUDIT_ALLOWED_ENDPOINTS`
188+
189+
```
190+
static.rust-lang.org:443 # Rust toolchain downloads
191+
crates.io:443 # Rust crate registry
192+
index.crates.io:443 # Rust crate index
193+
static.crates.io:443 # Rust crate downloads
194+
pypi.org:443 # Python packages
195+
files.pythonhosted.org:443 # Python package files
196+
api.osv.dev:443 # OSV vulnerability database
197+
release-assets.githubusercontent.com:443 # GitHub release assets
198+
```
199+
200+
#### Azure runner infrastructure
201+
202+
GitHub-hosted runners contact Azure infrastructure at fixed IPs that are allowed by default
203+
at the VM level and do not need to be in the allow lists:
204+
205+
- `168.63.129.16:80` -- Azure IMDS/wireserver (DHCP, DNS forwarding, health probes)
206+
- `168.63.129.16:53` -- Azure DNS resolver
87207

88208
**Action Update Policy**: When updating GitHub Actions, only use versions that have been released for at least 2 weeks.
89209
This allows time for the community to identify potential issues while maintaining security through timely updates.

.github/actionlint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
self-hosted-runner:
2+
labels:
3+
- depot-ubuntu-22.04-8
4+
- depot-ubuntu-22.04-arm-8
5+
- depot-windows-2022-8
6+
- depot-macos-14
7+
- depot-macos-15

0 commit comments

Comments
 (0)