<!--
SPDX-License-Identifier: Apache-2.0
SPDX-FileCopyrightText: 2025,2026 ndaal Gesellschaft für Sicherheit in der Informationstechnik mbH & Co KG, Cologne
SPDX-FileCopyrightText: Author: Pierre Gronau <Pierre.Gronau@ndaal.eu>
-->

# Changelog

All notable changes to `mimetype-cli` are documented
in this file.

The format is based on
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/)
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.1.2] - 2026-05-26

### Added

- Capability-secure filesystem layer per `skills/rust-path-security`:
  - New `cap-std` / `cap-tempfile` dependencies.
  - New `mimetype_cli::path_security::safe_join` primitive — lexical
    path-traversal defence that returns `None` for absolute paths, NUL
    injection, and any `..` sequence that would escape the base.
  - New `mimetype_cli::fs::DataDir` wrapper around `cap_std::fs::Dir`;
    the single place in the crate that calls
    `cap_std::ambient_authority()`.
- New regression suite `tests/test_path_security.rs` with 56 named
  vectors plus 4 exhaustive property-style sequences (every traversal
  depth `1..=64`; every balanced pop length `1..=16`; NUL at every byte
  position of a benign filename). Vector tag prefixes map to the
  upstream sources:
  - `cs_*` — `bytecodealliance/cap-std` upstream tests.
  - `owasp_*` — OWASP "Path Traversal" cheat sheet (CWE-22), including
    NUL-truncation (CVE-2007-0883 family) and Windows / UNC / drive-
    letter shapes.
  - `mt_*` — mimetype-cli-specific input surfaces (`--output-dir`,
    recursive-walk entries).
  - `unicode_*` — combining marks, RTL override, fullwidth full stop,
    zero-width joiner, homoglyph slash.

### Changed

- Crate version bumped from `0.1.1` to `0.1.2`.
- `src/main.rs` file and directory handling migrated to `DataDir`:
  - `detect_file()` split into the pure `detect_from_bytes()` (no I/O)
    and a `DataDir::read`-driven caller. Bytes flow through the
    capability boundary; the detection logic is independently testable.
  - `collect_files()` replaced by `open_and_walk()`, which opens the
    operator-supplied path (or its parent for single-file inputs) as a
    `DataDir` and uses `DataDir::walk()` / `DataDir::for_each_file()`
    for enumeration. Symlinks are not followed by either, so a
    recursive scan cannot escape the capability boundary.
  - `write_report_files()` now takes `&DataDir`; SARIF and Markdown
    reports are emitted via `DataDir::write` against an
    `open_or_create`-d `--output-dir`. Pre-existing symlinks at the
    target names are refused by the kernel.

### Verified

- New `cargo test --test test_path_security` — 56 tests pass.
- New `cargo test --lib fs::` — 5 `DataDir` round-trip tests pass.
- Full `cargo test --workspace --all-features` passes on the migrated
  code path.

## [0.1.1] - 2026-05-26

### Changed

- Bumped crate version from `0.1.0` to `0.1.1`.
- Bumped `colored` dependency from `2` to `3`
  (3.1.1 on the lockfile).
- Bumped `infer` dependency from `0.16` to `0.19`
  (magic-byte detection — adds new file-format
  signatures upstream).
- Bumped `phf` dependency from `0.11` to `0.13`.
- Bumped `phf_codegen` build dependency from `0.11`
  to `0.13`.

### Verified

- `cargo check --workspace` passes against the
  refreshed lockfile.
- `cargo +nightly fuzz run <target> -- -max_total_time=60`
  exercised against every target under
  `fuzz/fuzz_targets/` (10 targets) after the
  dependency bump.

## [0.1.0] - 2026 (initial public release)

### Added

- Magic-byte MIME detection via `infer`
  (~70 formats).
- Content sniffing for text formats: JSON, XML,
  YAML, HTML, SVG, TOML, shebangs, common
  programming languages.
- Extension lookup via `mime_guess` (2500+ types).
- Reverse lookup: find extensions for a given
  MIME type.
- Output formats: plain text, JSON, Markdown, and
  SARIF 2.1.0.
- Auto-generated `report.sarif` and `report.md`
  on every file scan.
- CSAF 2.1 advisory tooling under `csaf/`.
- Fuzz suite (`cargo-fuzz`, libFuzzer) with 10
  targets covering content sniffing, extension
  lookup, magic-byte detection, JSON/Markdown
  output, round-trip conversion, shebang parsing,
  TOML detection, and HTML detection.
- Kani model-checking harnesses.
- Full test suite (`assert_cmd`, `predicates`,
  `proptest`).

[0.1.2]: https://github.com/ndaal/mimetype-cli/releases/tag/v0.1.2
[0.1.1]: https://github.com/ndaal/mimetype-cli/releases/tag/v0.1.1
[0.1.0]: https://github.com/ndaal/mimetype-cli/releases/tag/v0.1.0
