Skip to content
GenpoaoinePublic

About

NAP (New Archive Protocol) is a small, defensive archive container format designed for developers interested in archive parsing, binary formats, and parser safety.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

NAP — New Archive Protocol (v2.2.1)

NAP (New Archive Protocol) is a small, defensive archive container format designed for developers interested in archive parsing, binary formats, and parser safety.

This project provides a complete specification and a reference implementation for NAP v2.2.1, the final stable version of the 2.x series.

NAP does not aim to compete with ZIP or RAR. Instead, it focuses on clarity, predictability, and safe parsing behavior.


What Makes NAP Different?

NAP was designed with a simple assumption:

Archive files are untrusted input.

Based on this, the format and parser follow a set of strict engineering rules.

Key Characteristics

  • Attribute-based records Each file is described as a record composed of typed attributes (TLV-style), inspired by NTFS.
  • Index-at-end layout The master file table (MFT) is stored at the end of the archive for fast listing and append-friendly writes.
  • Non-resident file data Large files are stored outside metadata and extracted using streaming I/O with constant memory usage.
  • Strict length validation All declared lengths are checked before use to prevent overreads, infinite loops, and malformed-record attacks.
  • Optional content encryption File contents may be encrypted while archive structure remains readable.

Repository Contents

This repository includes:

  • 📄 NAP v2.2.1 specification (format layout, records, attributes)
  • 🧩 Reference implementation in Python
  • 🛡️ Defensive parser logic designed to handle malformed archives safely
  • 🧪 Examples and test archives for experimentation

The code is intentionally kept readable to support learning and third-party reimplementation.


Security & Parsing Model

NAP v2.2.1 emphasizes parser robustness over cryptographic strength:

  • Archive structure is fully validated before extraction
  • Unknown attributes are safely skipped
  • Path traversal during extraction is explicitly blocked
  • Parsing errors fail fast and fail safely

Encryption in v2.2.1 provides confidentiality only and should not be considered cryptographically hardened.


Who Is This For?

NAP is useful if you are interested in:

  • Designing custom binary file formats
  • Writing safe archive parsers
  • Understanding how real-world archive vulnerabilities occur — and how to avoid them
  • Building experimental tooling on top of structured containers

This project is educational and experimental, not a production replacement for established archive tools.


Version Status

  • Current version: NAP v2.2.1
  • Status: Specification frozen
  • Backward compatibility: Not guaranteed across major versions

License

This project is open-source and intended for study, experimentation, and research.

Contributions, discussions, and third-party implementations are welcome.

About

NAP (New Archive Protocol) is a small, defensive archive container format designed for developers interested in archive parsing, binary formats, and parser safety.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors