Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

## Docs
- [ ] README / docs / ADR / CHANGELOG updated where needed
- [ ] `version` in `Cargo.toml` bumped per semver (publishes a release when merged)
- [ ] `version` in `Cargo.toml` bumped per semver (a release is cut separately, on demand)
- [ ] Dependency or lockfile changes reviewed
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@ on:
pull_request:
permissions: { contents: read }
jobs:
# Branching policy: pull requests come from <type>/<short-description> branches (or tool-created ones).
# GitHub rulesets cannot enforce branch names on personal repositories, so CI does.
branch-name:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- env: { HEAD_REF: "${{ github.head_ref }}" }
run: |
re='^((feat|fix|docs|ci|chore|refactor|test|perf|build|style|revert)/[a-z0-9._-]+|dependabot/.+|alert-autofix-[0-9]+|copilot/.+)$'
if ! printf '%s' "$HEAD_REF" | grep -Eq "$re"; then
echo "branch '$HEAD_REF' does not match <type>/<short-description> (types: feat fix docs ci chore refactor test perf build style revert)"; exit 1
fi
verify:
strategy:
fail-fast: false
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Pages
# On demand only: run it from the Actions tab (Run workflow). It publishes the site/ folder from main.
on:
push: { branches: [main], paths: [site/**, .github/assets/**, .github/workflows/pages.yml] }
workflow_dispatch:
permissions: { contents: read, actions: read, pages: write, id-token: write }
concurrency: { group: pages, cancel-in-progress: true }
jobs:
build:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Release
# Releases happen when the version in Cargo.toml changes on main (or on demand): the workflow tags v<version>,
# builds native binaries for five targets, packages them, and publishes a GitHub release.
# A pushed v* tag also works as a manual trigger.
# On demand only: run it from the Actions tab (Run workflow) on main. It tags v<version> from Cargo.toml, builds native
# binaries for five targets, packages them, and publishes a GitHub release. Does nothing if that release already exists.
on:
push:
branches: [main]
paths: [Cargo.toml]
tags: ["v*"]
workflow_dispatch:
inputs:
draft:
description: Publish as a draft release (review it on GitHub before it goes public)
type: boolean
default: false
permissions: { contents: read }
concurrency: { group: release, cancel-in-progress: false }
jobs:
Expand All @@ -23,8 +23,8 @@ jobs:
run: |
version=$(sed -n 's/^version *= *"\(.*\)"/\1/p' Cargo.toml | head -n1)
tag="v$version"
if [ "$GITHUB_REF_TYPE" = tag ] && [ "$GITHUB_REF_NAME" != "$tag" ]; then
echo "tag $GITHUB_REF_NAME does not match Cargo.toml ($tag)"; exit 1
if [ "$GITHUB_REF" != refs/heads/main ]; then
echo "releases are cut from main only (this run is on $GITHUB_REF)"; exit 1
fi
if gh release view "$tag" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
echo "release $tag already exists; nothing to do"; echo "release=false" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -91,5 +91,5 @@ jobs:
cp target/package/*.crate dist/
cd dist && sha256sum * > SHA256SUMS && cat SHA256SUMS
- name: Tag and publish the release
env: { GH_TOKEN: "${{ github.token }}" }
run: gh release create "${{ needs.plan.outputs.tag }}" dist/* --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "${{ needs.plan.outputs.tag }}" --generate-notes
env: { GH_TOKEN: "${{ github.token }}", DRAFT: "${{ inputs.draft && '--draft' || '' }}" }
run: gh release create "${{ needs.plan.outputs.tag }}" dist/* --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" --title "${{ needs.plan.outputs.tag }}" --generate-notes $DRAFT
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
MAJOR for a backwards-incompatible change to commands, options, output or configuration; MINOR for backwards-compatible
functionality; PATCH for fixes, documentation, CI and other changes that leave behaviour untouched. While the major
version is 0, anything may change, but still bump MINOR for breaking changes and PATCH otherwise.
Release tags are `vMAJOR.MINOR.PATCH` and must equal that field (the release workflow enforces it).
Releases are on demand (Actions β†’ Release); the tag `vMAJOR.MINOR.PATCH` comes from that field. Branches are named `<type>/<short-description>`.
- Never commit secrets or `.env` files. `.env.example` holds names and safe placeholders only.

## Approval boundaries
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ User-visible and operationally material changes. Release notes with every commit

## [Unreleased]

## [0.4.2] - 2026-11-28
### Changed
- Releases and the Pages site are published on demand from the Actions tab instead of automatically; the release workflow can create a draft.
- Branching policy documented; release tags are protected.

## [0.4.1] - 2026-11-28
### Changed
- Ignore stray build artifacts and private promotional files; track the shared Codex MCP config.
Expand Down Expand Up @@ -45,7 +50,8 @@ First published release (Node.js; versions before it were never tagged).
- `migadu catchall`, `migadu spam` and `migadu bcc`, driven through the admin panel's forms.
- Releases are tagged, built and published automatically when the version changes on `main`.

[Unreleased]: https://github.com/ifthenelse/migadu-cli/compare/v0.4.1...HEAD
[Unreleased]: https://github.com/ifthenelse/migadu-cli/compare/v0.4.2...HEAD
[0.4.2]: https://github.com/ifthenelse/migadu-cli/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/ifthenelse/migadu-cli/compare/v0.4.0...v0.4.1
[0.4.0]: https://github.com/ifthenelse/migadu-cli/compare/v0.3.4...v0.4.0
[0.3.4]: https://github.com/ifthenelse/migadu-cli/compare/v0.3.3...v0.3.4
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Applies to humans and coding agents alike.

## Workflow
1. Branch from `main` (or use a git worktree per task; never share one working copy between two agents).
1. Branch from `main`, named `<type>/<short-description>` (`feat/`, `fix/`, `docs/`, `ci/`, `chore/`, `refactor/`, `test/`); see the branching policy in [docs/deployment.md](docs/deployment.md) (or use a git worktree per task; never share one working copy between two agents).
2. Make a focused change; keep unrelated refactors out.
3. Run `scripts/verify` locally (needs [Rust](https://rustup.rs) 1.85 or newer). CI runs the same command on Linux, macOS and Windows and is the authoritative gate.
4. Open a pull request: shared and production code enters only through a PR with required checks.
Expand All @@ -19,7 +19,7 @@ Enable the template once: `git config commit.template .gitmessage.txt`.
- Description of the change and its reason; link to the related decision or ticket.
- `scripts/verify` green; tests added or updated for changed behaviour.
- Docs, ADR or changelog updated when behaviour, contracts or architecture change.
- `version` in `Cargo.toml` bumped following [semver 2.0.0](https://semver.org/) (see `AGENTS.md`); merging a version change publishes a release.
- `version` in `Cargo.toml` bumped following [semver 2.0.0](https://semver.org/) (see `AGENTS.md`). A release is published separately, on demand, by the maintainer.
- Dependency changes reviewed explicitly (new crates, version bumps, `Cargo.lock` diff).

## Review roles
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "migadu-cli"
version = "0.4.1"
version = "0.4.2"
edition = "2021"
rust-version = "1.85"
description = "Cross-platform CLI for the Migadu email hosting API, with password-manager credential lookup."
Expand Down
30 changes: 17 additions & 13 deletions docs/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,37 @@ publishing the project site.
## Environments and promotion path
| Environment | Purpose | Promotion from | Approval |
| --- | --- | --- | --- |
| Pull request | CI on the merge result: `verify` on 3 OSes (stable Rust) plus an MSRV build, CodeQL, Gitleaks, Semgrep, dependency review | feature branch | all 9 required checks green, conversations resolved |
| Pull request | CI on the merge result: `verify` on 3 OSes (stable Rust) plus an MSRV build, CodeQL, Gitleaks, Semgrep, dependency review | feature branch | the required checks green (`verify` on 3 OSes, `msrv`, `branch-name`, `codeql`, `secrets`, `pentest`), conversations resolved |
| `main` | Always releasable | pull request | squash or rebase merge (linear history), no direct pushes, applies to admins |
| GitHub Pages | Project site at `https://ifthenelse.github.io/migadu-cli/` | `main`, when `site/**` or `.github/assets/**` change | automatic (`pages.yml`) |
| GitHub Release | Downloadable archives, source package, checksums | a change to the version in `Cargo.toml` on `main` | merging the pull request that bumps the version |
| GitHub Pages | Project site at `https://ifthenelse.github.io/migadu-cli/` | `main`, on demand | the maintainer runs the **Pages** workflow from the Actions tab (`pages.yml`) |
| GitHub Release | Downloadable archives, source package, checksums | `main`, on demand | the maintainer runs the **Release** workflow from the Actions tab (`release.yml`) |

There is no custom domain; the site lives at the GitHub Pages project URL.
There is no custom domain; the site lives at the GitHub Pages project URL, which is also the repository's homepage link.

## Branching policy
- `main` is the only long-lived branch and is protected: changes arrive by pull request only, the required checks (`verify` on 3 OSes, `msrv`, `branch-name`, `codeql`, `secrets`, `pentest`) must pass on a branch that is up to date with `main`, conversations must be resolved, history stays linear (squash merge is the only merge method), and force pushes and deletions are blocked, for administrators too.
- Work happens on short-lived branches named `<type>/<short-description>` (`feat/`, `fix/`, `docs/`, `ci/`, `chore/`, `refactor/`, `test/`, plus `dependabot/` and `alert-autofix-`, which the tools create). Branches are deleted automatically after merge. GitHub rulesets cannot enforce branch names on a personal repository, so the `branch-name` CI job does.
- Release tags `v*` are protected: they cannot be moved or deleted. Only the Release workflow creates them.

## Release
The version has one source: `version` in `Cargo.toml` (`Cargo.lock` follows it), and it follows [Semantic Versioning 2.0.0](https://semver.org/). Every pull request bumps it:
MAJOR for a backwards-incompatible change to commands, options, output or configuration, MINOR for backwards-compatible
functionality, PATCH for fixes, documentation and CI. While the major version is 0, bump MINOR for breaking changes.

1. Bump `version` in `Cargo.toml` in the pull request that makes the change (run `cargo build` so `Cargo.lock` follows), and merge it into `main`.
2. When a push to `main` changes `Cargo.toml`, `.github/workflows/release.yml` runs by itself (it can also be started
by hand from the Actions tab, or by pushing a `v<version>` tag). Its jobs:
- **plan:** reads the version, derives the tag `v<version>`, and stops quietly if a release with that tag already exists.
A pushed tag that differs from `Cargo.toml` fails.
1. Bump `version` in `Cargo.toml` in the pull request that makes the change (run `cargo build` so `Cargo.lock` follows), and merge it into `main`. Merging does not publish anything.
2. When you want to release, open **Actions β†’ Release β†’ Run workflow**, choose `main`, and optionally tick *draft* to review the release on
GitHub before it goes public. The jobs:
- **plan:** refuses to run on any branch other than `main`, reads the version, derives the tag `v<version>`, and stops quietly if a release with that tag already exists.
- **verify:** runs `scripts/verify` (format, clippy, tests).
- **build:** compiles natively on each operating system, in release mode with `--locked`: `darwin-arm64`, `darwin-x64`
(cross-built on the Arm runner), `linux-x64`, `linux-arm64` and `windows-x64`. It smoke-tests every binary the runner can
execute (prints help, never echoes a test secret) and archives each with `LICENSE` and `README.md` (`.tar.gz`, or `.zip`
for Windows).
- **publish:** adds the source package from `cargo package` and `SHA256SUMS`, then creates the tag on the merged commit
and the GitHub release with generated notes. This is the only job with write permission.
- **publish:** adds the source package from `cargo package` and `SHA256SUMS`, then creates the tag on the commit and the GitHub release with generated notes. This is the only job with write permission.

Versions that were merged but never released simply have no tag. The next release carries their changes.

Because the trigger is a changed `Cargo.toml`, a merged pull request that bumps the version is published automatically.
Pull requests that do not change the version publish nothing. Tags created by the workflow itself do not start a second run.
To publish the site, run **Actions β†’ Pages β†’ Run workflow** on `main`; it deploys the `site/` folder.

Binaries are about 1.4 MB, statically linked against rustls, and need no runtime. Linux binaries link the system C library
and are built on Ubuntu 22.04 for wide compatibility. See [ADR 0006](adr/0006-rewrite-in-rust.md).
Expand Down
2 changes: 1 addition & 1 deletion docs/security/threat-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and the release pipeline. Migadu's own systems are out of scope.
| Mailboxes and domains on the account | Operator mistake, scripted bug | `delete`, `catchall set`, panel writes | CLI ↔ Migadu | Accidental deletion or clearing | Deletes and clearing need `--yes`; panel writes are verified by re-reading and fail loudly; no bulk commands | A user can still pass `--yes` in a loop |
| Panel HTML | Migadu (markup change) or a network attacker | Responses from `admin.migadu.com` | CLI ↔ panel | A changed page makes the parser submit wrong fields | HTTPS only; forms are re-read after writing; unknown or missing forms abort without writing; comments are stripped so hidden controls are not submitted | The parser is regex-based and tied to current markup |
| Transport | Network attacker | HTTPS to `api.migadu.com` and `admin.migadu.com` | CLI ↔ Migadu | Interception of the key | TLS via the platform's `fetch`; 30 s timeout | Trust in the system's certificate store |
| Release artefacts | Supply-chain attacker | GitHub Actions, dependencies, binaries | Repo ↔ users | Tampered binary or workflow | Two direct Rust dependencies (`ureq` with rustls, `serde_json`), locked in `Cargo.lock`; Dependabot watches them; actions pinned to commit SHAs; Dependabot with a 7-day cooldown; branch protection with required checks; release only when the version in `Cargo.toml` changes on `main`; SHA-256 checksums published | Binaries are unsigned and macOS ones are not notarised; the crates are trusted at their locked versions |
| Release artefacts | Supply-chain attacker | GitHub Actions, dependencies, binaries | Repo ↔ users | Tampered binary or workflow | Two direct Rust dependencies (`ureq` with rustls, `serde_json`), locked in `Cargo.lock`; Dependabot watches them; actions pinned to commit SHAs; Dependabot with a 7-day cooldown; branch protection with required checks; release only on demand from `main`, with `v*` tags protected against moves and deletion; SHA-256 checksums published | Binaries are unsigned and macOS ones are not notarised; the crates are trusted at their locked versions |
| Maintainer account | Account takeover | GitHub | GitHub ↔ maintainer | A malicious tag or workflow change | Branch protection applies to admins; CODEOWNERS; secret scanning and push protection | Depends on the maintainer's account security (2FA) |

## Accepted risks
Expand Down
Loading