# Security

## Reporting a vulnerability

Report it privately, through GitHub:
[Report a vulnerability](https://github.com/nightworksio/php-mutation-gate/security/advisories/new)
on this repository's *Security* tab. Where you cannot use GitHub, email
<info@nightworks.io>.

Do not open a public issue or pull request for a vulnerability.

## What happens next

- Your report is acknowledged within three working days.
- A fix is published as a GitHub security advisory, with a CVE.

## Supported versions

The latest minor release of the current major version gets security fixes.
Once a new major version is released, the previous major's last minor gets
security fixes for six months.

| Version             | Security fixes |
| ------------------- | -------------- |
| `main` (`dev-main`) | yes            |

A fix lands on `main`, and a project requiring `dev-main` takes it with
`composer update nightworksio/mutation-gate`.

## Verifying a release

Each release publishes `mutation-gate.phar` with `mutation-gate.phar.asc`,
its detached signature by the release key:

|             |                                                      |
| ----------- | ---------------------------------------------------- |
| Fingerprint | `5EAA 6082 E57F F4C5 42A2  EA66 B757 A4B1 1361 16D2` |
| User ID     | NightWorksIO Releases <info@nightworks.io>           |
| Algorithm   | ed25519, signing only                                |

The key signs nothing else, and only the release workflow, in the `release`
environment that deploys from `vX.Y.Z` tags alone, can use it. The job that holds
it runs no Composer: it signs the PHAR another job built, holding no secret,
once the PHAR's SHA-256 is the one that job named. The public key is
[`resources/action/release-key.asc`](https://github.com/nightworksio/php-mutation-gate/blob/HEAD/resources/action/release-key.asc). Import
it, then check that `gpg` names this fingerprint:

```sh
curl -fsSL https://raw.githubusercontent.com/nightworksio/php-mutation-gate/main/resources/action/release-key.asc | gpg --import
gpg --verify mutation-gate.phar.asc mutation-gate.phar
```

The PHAR and the container image also carry GitHub's build provenance, which
needs no key:

```sh
gh attestation verify mutation-gate.phar --repo nightworksio/php-mutation-gate
gh attestation verify oci://ghcr.io/nightworksio/mutation-gate:<version> --repo nightworksio/php-mutation-gate
```

## Scope

In scope is what this repository ships:

- the Composer package `nightworksio/mutation-gate`, with its first-party
  plugins under `plugins/`;
- the GitHub Action and the reusable workflow;
- the proof ledger's trust boundaries: a run that may not write the default
  branch's proofs must not be able to plant one that the default branch's run
  trusts
  ([ADR-0007](https://nightworksio.github.io/php-mutation-gate/decisions/0007-a-proof-is-keyed-by-everything-its-verdict-reads/));
- the gate's own secrets: where a job's documented setup hands a credential to
  the project's code, as when it runs the tests with it in the environment.

A vulnerability in Pest, Infection or another dependency belongs to that
project. Where the gate's use of a dependency is what makes it exploitable,
report it here.
