# Security Policy

`mgf-tele-core` is a federation sibling of [`mgf-common`](https://pypi.org/project/mgf-common/),
shipping the vendor-neutral telematics seam (the `TelematicsProvider`
device-session ABC, codec-agnostic AVL frame types, a typed error
hierarchy, and a scripted mock). A vulnerability here may affect
every consumer that uses this library to ingest telematics data, so
we take security reports seriously.

## Supported versions

In the 0.x window, **only the latest MINOR receives security
patches.** Per [SemVer 0.x](https://semver.org/#spec-item-4) and
rule **AP-03** from `mgf-standard/docs/standards/API_DESIGN.md`,
each MINOR release MAY break the public API; we do not
branch-and-backport across minors.

| Version | Supported |
|---------|-----------|
| `0.1.x`  | ✅ — latest MINOR; security patches ship as `0.1.Y` |

## Reporting a vulnerability

**Please do not open a public issue or pull request** until we have
had a chance to triage and patch.

- **Email:** `bassam@magogi.org` with subject prefix
  `[mgf-tele-core security]`.
- **Codeberg private security advisory:** open a private
  vulnerability report at
  [the repository's Security tab](https://codeberg.org/magogi-admin/mgf-tele-core/security).

### What to include

- A description of the vulnerability and its impact.
- Steps to reproduce — a minimal failing test is ideal.
  For packet-parsing / frame-decoding issues, the exact bytes
  that triggered the failure matter.
- The version(s) of `mgf-tele-core`, `mgf-common`, and any
  per-vendor codec (`mgf-tele-teltonika`, …) affected.
- Python version + OS.

### What to expect

| Stage | Timeline |
|---|---|
| Acknowledgement | within 3 business days |
| Initial assessment + severity rating | within 7 business days |
| Patch + release | within 30 days for high-severity, 90 days for medium |
| Credit + public disclosure | coordinated with the reporter |

90-day default embargo. After expiry (or after a patch ships),
the vulnerability is disclosed in the [`CHANGELOG.md`](CHANGELOG.md)
entry for the fixing release.

## Scope

**In scope:**

- Code in `src/mgf/tele/core/` (the published `mgf-tele-core`
  package). Specifically: `receive_packet`'s contract that the
  raw bytes are always returned even on decode failure (a
  forensic-record boundary), and the `TelematicsError` hierarchy
  that consumers branch on to decide what to persist.
- Build / release infrastructure (`pyproject.toml`, the manual
  release flow specified in
  [`mgf-standard/docs/standards/RELEASING.md`](https://codeberg.org/magogi-admin/mgf_common/src/branch/main/docs/standards/RELEASING.md)).

**Out of scope:**

- Vulnerabilities in `mgf-common` itself — report to
  [`mgf-common/SECURITY.md`](https://codeberg.org/magogi-admin/mgf_common/src/branch/main/SECURITY.md).
- Vulnerabilities in a per-vendor codec package
  (`mgf-tele-teltonika`, `mgf-tele-queclink`, …) — report to that
  package's own `SECURITY.md`. `mgf-tele-core` defines the seam;
  it does not parse any vendor wire format itself.
- Hostile / malformed packet handling on the consumer side
  (failing to persist the forensic raw record, ingesting a
  record whose `parse_status` ≠ `"ok"`) — that's deployment
  hardening, not library scope.

## Hardening recommendations for consumers

Consumers of `mgf-tele-core` adopt the
[`mgf-standard/docs/standards/SECURITY_STANDARD.md`](https://codeberg.org/magogi-admin/mgf_common/src/branch/main/docs/standards/SECURITY_STANDARD.md)
engineering standard as their baseline.

Particular attention paid to:
- **Always persist the raw packet.** `receive_packet` returns the
  raw bytes even when `parse_status` ≠ `"ok"`. Persist that
  forensic record unconditionally — a future codec update may
  recover a packet today's parser rejects, and a dropped packet
  is unrecoverable evidence in an incident investigation.
- **Treat `parse_status` as a security boundary.** Only ingest
  `records` when `parse_status == "ok"`. A malformed or
  hostile packet must never silently flow into the domain layer
  as if it decoded cleanly.
- **Bound the session.** A `TelematicsProvider` session reads
  from an untrusted socket; consumers should apply read timeouts
  and per-session resource limits so a stalled or flooding
  tracker cannot exhaust the ingest process.

## A note on the standards

`mgf-tele-core` is a **federation sibling** under the
project-shape taxonomy from
[`mgf-standard/docs/standards/DOCUMENTATION.md`](https://codeberg.org/magogi-admin/mgf_common/src/branch/main/docs/standards/DOCUMENTATION.md) §2.0.
The cross-project engineering standards live in `mgf-common`;
this project inherits them. See
[`docs/standards/README.md`](docs/standards/README.md) for the
pointer.
