Skip to content

Commit c4815e7

Browse files
kwschulzclaude
andcommitted
feat: initial release of har-capture v0.1.0
HAR file capture and PII sanitization library extracted from cable_modem_monitor. Features: - Zero-dependency core sanitization (HTML, HAR) - Format-preserving hashes for IPs, MACs, emails - CLI interface (sanitize, validate, capture) - PII leak detection and validation - Playwright-based browser capture (optional) - Configurable patterns and allowlists Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
0 parents  commit c4815e7

55 files changed

Lines changed: 7409 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
name: Bug report
3+
about: Report a bug in har-capture
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Description
10+
A clear description of the bug.
11+
12+
## Steps to Reproduce
13+
1.
14+
2.
15+
3.
16+
17+
## Expected Behavior
18+
What you expected to happen.
19+
20+
## Actual Behavior
21+
What actually happened.
22+
23+
## Environment
24+
- har-capture version:
25+
- Python version:
26+
- OS:
27+
28+
## Additional Context
29+
Any other context, error messages, or screenshots.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature request
3+
about: Suggest a new feature or enhancement
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Problem Statement
10+
What problem does this feature solve?
11+
12+
## Proposed Solution
13+
How would you like this to work?
14+
15+
## Alternatives Considered
16+
Any alternative solutions or workarounds you've considered.
17+
18+
## Additional Context
19+
Any other context, examples, or mockups.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Summary
2+
Brief description of changes.
3+
4+
## Changes
5+
-
6+
7+
## Testing
8+
- [ ] Tests pass locally (`pytest`)
9+
- [ ] Linting passes (`ruff check .`)
10+
- [ ] Type checking passes (`mypy src/`)
11+
12+
## Related Issues
13+
Related to #
14+
15+
## Checklist
16+
- [ ] Code follows project style guidelines
17+
- [ ] Self-review completed
18+
- [ ] Documentation updated (if applicable)
19+
- [ ] CHANGELOG.md updated (if applicable)

.github/workflows/ci.yml

Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
env:
15+
PYTHON_VERSION: "3.10"
16+
FORCE_COLOR: "1"
17+
18+
jobs:
19+
# ===========================================================================
20+
# Linting & Formatting
21+
# ===========================================================================
22+
lint:
23+
name: Lint & Format
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v4
27+
28+
- name: Set up Python
29+
uses: actions/setup-python@v5
30+
with:
31+
python-version: ${{ env.PYTHON_VERSION }}
32+
33+
- name: Install ruff
34+
run: pip install ruff
35+
36+
- name: Run ruff linter
37+
run: ruff check .
38+
39+
- name: Run ruff formatter
40+
run: ruff format --check .
41+
42+
# ===========================================================================
43+
# Type Checking
44+
# ===========================================================================
45+
typecheck:
46+
name: Type Check
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Set up Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: ${{ env.PYTHON_VERSION }}
55+
56+
- name: Install dependencies
57+
run: |
58+
pip install -e ".[dev,cli]"
59+
60+
- name: Run mypy
61+
run: mypy src/
62+
63+
# ===========================================================================
64+
# Tests
65+
# ===========================================================================
66+
test:
67+
name: Test (Python ${{ matrix.python-version }}, ${{ matrix.os }})
68+
runs-on: ${{ matrix.os }}
69+
strategy:
70+
fail-fast: false
71+
matrix:
72+
os: [ubuntu-latest, macos-latest, windows-latest]
73+
python-version: ["3.10", "3.11", "3.12", "3.13"]
74+
exclude:
75+
# Reduce matrix size - test oldest and newest on all platforms
76+
- os: macos-latest
77+
python-version: "3.11"
78+
- os: macos-latest
79+
python-version: "3.12"
80+
- os: windows-latest
81+
python-version: "3.11"
82+
- os: windows-latest
83+
python-version: "3.12"
84+
85+
steps:
86+
- uses: actions/checkout@v4
87+
88+
- name: Set up Python ${{ matrix.python-version }}
89+
uses: actions/setup-python@v5
90+
with:
91+
python-version: ${{ matrix.python-version }}
92+
93+
- name: Install dependencies
94+
run: |
95+
pip install -e ".[dev,cli]"
96+
97+
- name: Run tests with coverage
98+
run: |
99+
pytest --cov=har_capture --cov-report=xml --cov-report=term-missing
100+
101+
- name: Upload coverage to Codecov
102+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.10'
103+
uses: codecov/codecov-action@v4
104+
with:
105+
files: ./coverage.xml
106+
fail_ci_if_error: false
107+
verbose: true
108+
109+
# ===========================================================================
110+
# Security
111+
# ===========================================================================
112+
security:
113+
name: Security Scan
114+
runs-on: ubuntu-latest
115+
steps:
116+
- uses: actions/checkout@v4
117+
118+
- name: Set up Python
119+
uses: actions/setup-python@v5
120+
with:
121+
python-version: ${{ env.PYTHON_VERSION }}
122+
123+
- name: Install dependencies
124+
run: |
125+
pip install pip-audit
126+
127+
- name: Run pip-audit
128+
run: |
129+
pip install -e ".[full]"
130+
pip-audit
131+
132+
# ===========================================================================
133+
# Build
134+
# ===========================================================================
135+
build:
136+
name: Build Package
137+
runs-on: ubuntu-latest
138+
steps:
139+
- uses: actions/checkout@v4
140+
141+
- name: Set up Python
142+
uses: actions/setup-python@v5
143+
with:
144+
python-version: ${{ env.PYTHON_VERSION }}
145+
146+
- name: Install build tools
147+
run: pip install build twine
148+
149+
- name: Build package
150+
run: python -m build
151+
152+
- name: Check package
153+
run: twine check dist/*
154+
155+
- name: Upload artifacts
156+
uses: actions/upload-artifact@v4
157+
with:
158+
name: dist
159+
path: dist/
160+
161+
# ===========================================================================
162+
# Docs
163+
# ===========================================================================
164+
docs:
165+
name: Documentation
166+
runs-on: ubuntu-latest
167+
steps:
168+
- uses: actions/checkout@v4
169+
170+
- name: Check README renders
171+
run: |
172+
pip install "readme-renderer[md]"
173+
python -m readme_renderer README.md -o /dev/null
174+
175+
# ===========================================================================
176+
# All Checks Pass
177+
# ===========================================================================
178+
all-checks:
179+
name: All Checks Pass
180+
if: always()
181+
needs: [lint, typecheck, test, security, build, docs]
182+
runs-on: ubuntu-latest
183+
steps:
184+
- name: Check all jobs passed
185+
uses: re-actors/alls-green@release/v1
186+
with:
187+
jobs: ${{ toJSON(needs) }}

.github/workflows/publish.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
workflow_dispatch:
8+
inputs:
9+
test_pypi:
10+
description: 'Publish to Test PyPI instead'
11+
required: false
12+
default: false
13+
type: boolean
14+
15+
jobs:
16+
build:
17+
name: Build Package
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.10"
26+
27+
- name: Install build tools
28+
run: pip install build
29+
30+
- name: Build package
31+
run: python -m build
32+
33+
- name: Upload artifacts
34+
uses: actions/upload-artifact@v4
35+
with:
36+
name: dist
37+
path: dist/
38+
39+
publish-test:
40+
name: Publish to Test PyPI
41+
needs: build
42+
if: github.event.inputs.test_pypi == 'true'
43+
runs-on: ubuntu-latest
44+
environment: test-pypi
45+
permissions:
46+
id-token: write
47+
steps:
48+
- name: Download artifacts
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: dist
52+
path: dist/
53+
54+
- name: Publish to Test PyPI
55+
uses: pypa/gh-action-pypi-publish@release/v1
56+
with:
57+
repository-url: https://test.pypi.org/legacy/
58+
59+
publish:
60+
name: Publish to PyPI
61+
needs: build
62+
if: startsWith(github.ref, 'refs/tags/v') && github.event.inputs.test_pypi != 'true'
63+
runs-on: ubuntu-latest
64+
environment: pypi
65+
permissions:
66+
id-token: write
67+
steps:
68+
- name: Download artifacts
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: dist
72+
path: dist/
73+
74+
- name: Publish to PyPI
75+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)