How 4nk1t/newman works
Project type and purpose
• This is a small, standalone Python utility (“open-source tool”) whose sole purpose is to take an HTML Newman report as input, scan it for sensitive fields (pre-production/prod credentials or PII), redact those fields, and emit a new HTML report.
File structure
• Top level contains only:
• README.md – describes usage and configuration
• script.py – the entire implementation
• There are no separate “frontend” or “backend” layers, no database, no microservices—just a simple command-line script.
README for additional insights
• Dependencies: Python 3.x plus whatever’s in requirements.txt (likely an HTML parser such as BeautifulSoup or regex).
• Configuration: a hard-coded parameters array in script.py drives which field names get redacted.
• Usage pattern: CLI invocation with –i (input path) and –o (output path).
a. Main components
1. CLI Input Module (parses -i and -o)
2. File Reader (loads the input HTML)
3. Parser/DOM Builder (e.g., BeautifulSoup or regex)
4. Redaction Engine (iterates over parameters array, finds matching nodes/text, replaces value with “*****”)
5. File Writer (outputs the redacted HTML)
6. Configuration (the parameters array—treated as a data source)
b. Relationships & interactions
• CLI Input → File Reader → Parser → Redaction Engine → File Writer → Output File
• Redaction Engine references Configuration
• All components are contained within script.py, executed in sequence
c. Architectural patterns/principles
• Single-responsibility components (reading, parsing, redacting, writing)
• Data flow is strictly linear (no loops back to the user, no external service calls)
• Configurable redaction rules (parameters array) decoupled from logic
d. Key technologies/frameworks
• Python 3.x runtime
• HTML parsing library (e.g., BeautifulSoup from requirements.txt) or built-in regex
• Standard library modules: argparse (CLI), io/file I/O