Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 6 additions & 31 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,8 @@
{
"name": "Python 3",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"name": "NetGuardian Python 3.11",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bookworm",
"customizations": {
"codespaces": {
"openFiles": [
"README.md",
"app.py"
]
},
"vscode": {
"settings": {},
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance"
]
}
},
"updateContentCommand": "[ -f packages.txt ] && sudo apt update && sudo apt upgrade -y && sudo xargs apt install -y <packages.txt; [ -f requirements.txt ] && pip3 install --user -r requirements.txt; pip3 install --user streamlit; echo '✅ Packages installed and Requirements met'",
"postAttachCommand": {
"server": "streamlit run app.py --server.enableCORS false --server.enableXsrfProtection false"
},
"portsAttributes": {
"8501": {
"label": "Application",
"onAutoForward": "openPreview"
}
},
"forwardPorts": [
8501
]
}
"postCreateCommand": "python -m pip install uv==0.13.7 && uv sync --locked",
"postAttachCommand": "uv run --locked streamlit run app.py --server.address 127.0.0.1",
"forwardPorts": [8501],
"portsAttributes": {"8501": {"label": "NetGuardian", "onAutoForward": "notify"}}
}
18 changes: 18 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.git
.venv
web
__pycache__
**/__pycache__
*.db
*.db-*
.env
agent/config.local.json

# Local validation artifacts may contain reports, credentials and downloaded tools.
.pytest_cache
.ruff_cache
.mypy_cache
*.log
Felix.jpg

.netguardian-local/
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
* text=auto
*.py text eol=lf
*.md text eol=lf
*.toml text eol=lf
*.yml text eol=lf
*.json text eol=lf
*.lock text eol=lf
*.jpg binary
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Baseline checks
on: [push, pull_request]
permissions:
contents: read
jobs:
checks:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install uv==0.13.7
- run: uv sync --locked
- run: uv run --locked python -m scripts.export_openapi --check
- run: uv run --locked ruff check .
- run: uv run --locked ruff format --check .
- run: uv run --locked python -m compileall -q app.py diagnostics.py probe_core service agent migrations tests
- run: uv run --locked pytest -q
- run: uv run --locked pytest integration/test_tls.py integration/test_process_cleanup.py integration/test_agent_lock.py integration/test_agent_workflow.py integration/test_admission_runtime.py integration/test_windows_job.py integration/test_dns_runtime.py -q
web:
runs-on: ubuntu-latest
defaults:
run:
working-directory: web
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
version: 11.25.0
- uses: actions/setup-node@v4
with:
node-version: '24'
- run: pnpm install --frozen-lockfile
- run: pnpm test
- run: pnpm generate:api
- run: git diff --exit-code -- lib/api-schema.d.ts
- run: pnpm typecheck
- run: pnpm build

postgres:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:17
env:
POSTGRES_USER: netguardian
POSTGRES_PASSWORD: integration-only
POSTGRES_DB: netguardian_test
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U netguardian -d netguardian_test"
--health-interval 5s --health-timeout 5s --health-retries 10
env:
NETGUARDIAN_TEST_POSTGRES_URL: postgresql+psycopg://netguardian:integration-only@127.0.0.1:5432/netguardian_test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- run: python -m pip install uv==0.13.7
- run: uv sync --locked
- run: uv run --locked pytest integration -q
47 changes: 47 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.venv/
__pycache__/
.pytest_cache/
.ruff_cache/
.streamlit/secrets.toml

*.db
*.db-journal
*.db-wal
*.db-shm
.env
agent/config.local.json

.netguardian-local/

# Local environments, credentials and build output
venv/
node_modules/
.next/
.env.*
!.env.example
!.env.*.example
*.sqlite
*.sqlite3
*.sqlite-wal
*.sqlite-shm
*.sqlite-journal
*.sqlite3-wal
*.sqlite3-shm
*.sqlite3-journal
*.log
*.py[cod]
*.tsbuildinfo
.cache/
.coverage
.coverage.*
htmlcov/
build/
dist/
out/
*.tmp
*.temp
*.pem
*.p12
*.pfx
*.key
!tests/fixtures/tls/server.key
5 changes: 5 additions & 0 deletions .streamlit/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[browser]
gatherUsageStats = false

[server]
address = "127.0.0.1"
8 changes: 8 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Repository collaboration rules

- Communicate with the user in Simplified Chinese, including analysis, plans, progress, explanations, test results and final responses.
- Keep source identifiers (variables, functions, classes) and API paths in conventional English.
- Product UI, README, formal technical documentation and Git commit messages should normally be in English for international users.
- Important technical terms may remain in English; explain them in Chinese when communicating with the user.
- Preserve these standing rules in future Codex sessions. Merge additions rather than replacing existing instructions.
- Do not push to GitHub, create remote pull requests or deploy without explicit user authorization.
14 changes: 14 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM python:3.11-slim
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1 UV_LINK_MODE=copy
WORKDIR /app
RUN pip install --no-cache-dir uv==0.13.7
COPY pyproject.toml uv.lock ./
RUN uv sync --locked --no-dev
COPY probe_core ./probe_core
COPY service ./service
COPY agent ./agent
COPY migrations ./migrations
COPY alembic.ini ./
RUN useradd --create-home --uid 10001 netguardian
USER netguardian
CMD ["/app/.venv/bin/uvicorn", "service.api:app_factory", "--factory", "--host", "0.0.0.0", "--port", "8000"]
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2026 NetGuardian contributors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
10 changes: 10 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Licensing scope

NetGuardian project code and documentation are provided under the MIT license in
LICENSE, as selected by the repository owner. Third-party dependencies and downloaded
models retain their own licenses; they are not relicensed by this repository.

The legacy portrait asset `Felix.jpg` has unresolved redistribution provenance.
It is excluded from the project's MIT licensing declaration pending owner
confirmation and excluded from the API/worker Docker build context. Keeping the
original file locally does not establish permission to redistribute the portrait.
Loading
Loading