agenthacker 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- agenthacker-0.1.0/.github/workflows/release.yml +55 -0
- agenthacker-0.1.0/.github/workflows/sdk.yml +85 -0
- agenthacker-0.1.0/.gitignore +55 -0
- agenthacker-0.1.0/.pre-commit-config.yaml +21 -0
- agenthacker-0.1.0/.secrets.baseline +187 -0
- agenthacker-0.1.0/CHANGELOG.md +106 -0
- agenthacker-0.1.0/CODE_OF_CONDUCT.md +133 -0
- agenthacker-0.1.0/CONTRIBUTING.md +55 -0
- agenthacker-0.1.0/LICENSE +201 -0
- agenthacker-0.1.0/NOTICE +6 -0
- agenthacker-0.1.0/PKG-INFO +403 -0
- agenthacker-0.1.0/README.md +363 -0
- agenthacker-0.1.0/SECURITY.md +56 -0
- agenthacker-0.1.0/docs/agent_integration.md +175 -0
- agenthacker-0.1.0/docs/customer_api_guide.md +490 -0
- agenthacker-0.1.0/docs/getting_started.md +249 -0
- agenthacker-0.1.0/docs/third_party_licenses.md +67 -0
- agenthacker-0.1.0/examples/quickstart.py +34 -0
- agenthacker-0.1.0/pyproject.toml +90 -0
- agenthacker-0.1.0/rule_catalog.json +363 -0
- agenthacker-0.1.0/scripts/check_rule_catalog.py +62 -0
- agenthacker-0.1.0/scripts/generate_rule_catalog.py +231 -0
- agenthacker-0.1.0/src/firewall_sdk/__init__.py +100 -0
- agenthacker-0.1.0/src/firewall_sdk/agent_helpers.py +128 -0
- agenthacker-0.1.0/src/firewall_sdk/alignment_check.py +113 -0
- agenthacker-0.1.0/src/firewall_sdk/anomaly.py +462 -0
- agenthacker-0.1.0/src/firewall_sdk/client.py +676 -0
- agenthacker-0.1.0/src/firewall_sdk/cloud_client.py +753 -0
- agenthacker-0.1.0/src/firewall_sdk/constants.py +21 -0
- agenthacker-0.1.0/src/firewall_sdk/context_summarizer.py +164 -0
- agenthacker-0.1.0/src/firewall_sdk/event_store.py +660 -0
- agenthacker-0.1.0/src/firewall_sdk/features.py +128 -0
- agenthacker-0.1.0/src/firewall_sdk/intent_gate.py +325 -0
- agenthacker-0.1.0/src/firewall_sdk/intent_guard.py +373 -0
- agenthacker-0.1.0/src/firewall_sdk/intent_splitter.py +114 -0
- agenthacker-0.1.0/src/firewall_sdk/invariant.py +113 -0
- agenthacker-0.1.0/src/firewall_sdk/lang.py +311 -0
- agenthacker-0.1.0/src/firewall_sdk/llm_guard.py +318 -0
- agenthacker-0.1.0/src/firewall_sdk/llm_judge.py +92 -0
- agenthacker-0.1.0/src/firewall_sdk/logger.py +273 -0
- agenthacker-0.1.0/src/firewall_sdk/output_guard.py +150 -0
- agenthacker-0.1.0/src/firewall_sdk/py.typed +0 -0
- agenthacker-0.1.0/src/firewall_sdk/scan_engine.py +569 -0
- agenthacker-0.1.0/src/firewall_sdk/schemas.py +25 -0
- agenthacker-0.1.0/src/firewall_sdk/tool_guard.py +67 -0
- agenthacker-0.1.0/src/firewall_sdk/trace.py +68 -0
- agenthacker-0.1.0/src/firewall_sdk/translate_guard.py +188 -0
- agenthacker-0.1.0/tests/__init__.py +0 -0
- agenthacker-0.1.0/tests/conftest.py +24 -0
- agenthacker-0.1.0/tests/firewall_sdk/__init__.py +0 -0
- agenthacker-0.1.0/tests/firewall_sdk/conftest.py +17 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_client.py +397 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_constants.py +42 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_event_store.py +629 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_features.py +109 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_import_isolation.py +44 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_lang.py +134 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_llm_guard.py +52 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_logger.py +322 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_multilingual_semantic.py +66 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_output_guard.py +139 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_public_api_surface.py +88 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_r08_collapsed_false_positives.py +71 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_scan_engine.py +209 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_tool_guard.py +85 -0
- agenthacker-0.1.0/tests/firewall_sdk/test_translate_guard.py +74 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
# Build the agenthacker wheel + sdist on a version tag and publish to PyPI via
|
|
4
|
+
# Trusted Publishing (OIDC) — no API token is stored in the repo.
|
|
5
|
+
#
|
|
6
|
+
# PREREQUISITE: configure a PyPI Trusted Publisher for this repo + this workflow
|
|
7
|
+
# filename + the `pypi` environment, and reserve the project name. Until then the
|
|
8
|
+
# publish step fails by design — nothing is published without the PyPI-side trust
|
|
9
|
+
# link. Release with `git tag vX.Y.Z && git push origin vX.Y.Z`. PyPI versions are
|
|
10
|
+
# immutable: never re-tag a released version.
|
|
11
|
+
|
|
12
|
+
on:
|
|
13
|
+
push:
|
|
14
|
+
tags:
|
|
15
|
+
- "v[0-9]+.[0-9]+.[0-9]+"
|
|
16
|
+
|
|
17
|
+
permissions:
|
|
18
|
+
contents: read
|
|
19
|
+
|
|
20
|
+
jobs:
|
|
21
|
+
build:
|
|
22
|
+
name: build distributions
|
|
23
|
+
runs-on: ubuntu-latest
|
|
24
|
+
steps:
|
|
25
|
+
- uses: actions/checkout@v4
|
|
26
|
+
- uses: actions/setup-python@v5
|
|
27
|
+
with:
|
|
28
|
+
python-version: "3.12"
|
|
29
|
+
- name: Build wheel + sdist
|
|
30
|
+
run: |
|
|
31
|
+
pip install build
|
|
32
|
+
python -m build --outdir dist
|
|
33
|
+
- name: Verify metadata
|
|
34
|
+
run: |
|
|
35
|
+
pip install twine
|
|
36
|
+
twine check dist/*
|
|
37
|
+
- uses: actions/upload-artifact@v4
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
|
|
42
|
+
publish:
|
|
43
|
+
name: publish to PyPI
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment: pypi
|
|
47
|
+
permissions:
|
|
48
|
+
id-token: write # required for Trusted Publishing (OIDC)
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/download-artifact@v4
|
|
51
|
+
with:
|
|
52
|
+
name: dist
|
|
53
|
+
path: dist/
|
|
54
|
+
- name: Publish to PyPI
|
|
55
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
# Continuous integration for the agenthacker SDK (import name firewall_sdk).
|
|
4
|
+
# Local-first, no AWS/backend needed.
|
|
5
|
+
|
|
6
|
+
on:
|
|
7
|
+
push:
|
|
8
|
+
branches: [main]
|
|
9
|
+
pull_request:
|
|
10
|
+
|
|
11
|
+
permissions:
|
|
12
|
+
contents: read
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
name: tests (py${{ matrix.python-version }})
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
strategy:
|
|
19
|
+
fail-fast: false
|
|
20
|
+
matrix:
|
|
21
|
+
python-version: ["3.11", "3.12"]
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
- uses: actions/setup-python@v5
|
|
25
|
+
with:
|
|
26
|
+
python-version: ${{ matrix.python-version }}
|
|
27
|
+
- name: Install with dev extras
|
|
28
|
+
run: pip install ".[dev]"
|
|
29
|
+
- name: Run unit tests
|
|
30
|
+
run: pytest tests/firewall_sdk -q
|
|
31
|
+
|
|
32
|
+
lint:
|
|
33
|
+
name: lint (ruff)
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
steps:
|
|
36
|
+
- uses: actions/checkout@v4
|
|
37
|
+
- uses: actions/setup-python@v5
|
|
38
|
+
with:
|
|
39
|
+
python-version: "3.12"
|
|
40
|
+
- run: pip install ruff==0.15.20
|
|
41
|
+
- name: ruff check
|
|
42
|
+
run: ruff check src/firewall_sdk
|
|
43
|
+
- name: ruff format --check
|
|
44
|
+
run: ruff format --check src/firewall_sdk
|
|
45
|
+
|
|
46
|
+
types:
|
|
47
|
+
name: types (mypy)
|
|
48
|
+
runs-on: ubuntu-latest
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
- uses: actions/setup-python@v5
|
|
52
|
+
with:
|
|
53
|
+
python-version: "3.12"
|
|
54
|
+
- name: Install (for import resolution) + mypy
|
|
55
|
+
run: |
|
|
56
|
+
pip install ".[dev]"
|
|
57
|
+
pip install mypy==2.1.0
|
|
58
|
+
- name: mypy
|
|
59
|
+
run: mypy --config-file pyproject.toml src/firewall_sdk
|
|
60
|
+
|
|
61
|
+
rules:
|
|
62
|
+
name: rule-catalog drift
|
|
63
|
+
runs-on: ubuntu-latest
|
|
64
|
+
steps:
|
|
65
|
+
- uses: actions/checkout@v4
|
|
66
|
+
- uses: actions/setup-python@v5
|
|
67
|
+
with:
|
|
68
|
+
python-version: "3.12"
|
|
69
|
+
- run: pip install .
|
|
70
|
+
- name: Check rule_catalog.json is in sync with the SDK source
|
|
71
|
+
run: python scripts/check_rule_catalog.py
|
|
72
|
+
|
|
73
|
+
secrets:
|
|
74
|
+
name: secret scan (detect-secrets)
|
|
75
|
+
runs-on: ubuntu-latest
|
|
76
|
+
steps:
|
|
77
|
+
- uses: actions/checkout@v4
|
|
78
|
+
- uses: actions/setup-python@v5
|
|
79
|
+
with:
|
|
80
|
+
python-version: "3.12"
|
|
81
|
+
- run: pip install detect-secrets==1.5.0
|
|
82
|
+
- name: detect-secrets (fail on any secret not in the baseline)
|
|
83
|
+
run: |
|
|
84
|
+
detect-secrets-hook --baseline .secrets.baseline \
|
|
85
|
+
$(git ls-files 'src/*' 'tests/*' 'examples/*' 'scripts/*' 'docs/*' '*.md')
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Environment / secrets — never commit real values
|
|
2
|
+
.env
|
|
3
|
+
.env.*
|
|
4
|
+
!.env.example
|
|
5
|
+
secrets.txt
|
|
6
|
+
secrets.json
|
|
7
|
+
*.secret
|
|
8
|
+
*credentials*.json
|
|
9
|
+
|
|
10
|
+
# Private keys / certs / keystores
|
|
11
|
+
*.pem
|
|
12
|
+
*.key
|
|
13
|
+
*.p12
|
|
14
|
+
*.pfx
|
|
15
|
+
*.keystore
|
|
16
|
+
id_rsa
|
|
17
|
+
id_rsa.*
|
|
18
|
+
id_ed25519
|
|
19
|
+
id_ed25519.*
|
|
20
|
+
|
|
21
|
+
# Python
|
|
22
|
+
__pycache__/
|
|
23
|
+
*.pyc
|
|
24
|
+
*.pyo
|
|
25
|
+
*.pyd
|
|
26
|
+
.venv/
|
|
27
|
+
venv/
|
|
28
|
+
env/
|
|
29
|
+
*.egg-info/
|
|
30
|
+
build/
|
|
31
|
+
dist/
|
|
32
|
+
|
|
33
|
+
# Test / coverage cache
|
|
34
|
+
.pytest_cache/
|
|
35
|
+
.coverage
|
|
36
|
+
htmlcov/
|
|
37
|
+
|
|
38
|
+
# Node / frontend build output
|
|
39
|
+
node_modules/
|
|
40
|
+
apps/dashboard-ui/dist/
|
|
41
|
+
|
|
42
|
+
# Editor / OS
|
|
43
|
+
.DS_Store
|
|
44
|
+
*.swp
|
|
45
|
+
*.swo
|
|
46
|
+
.idea/
|
|
47
|
+
.vscode/
|
|
48
|
+
|
|
49
|
+
# Local docker compose overrides — never ship one
|
|
50
|
+
docker-compose.override.yml
|
|
51
|
+
|
|
52
|
+
# Runtime logs / model cache
|
|
53
|
+
logs/
|
|
54
|
+
*.log
|
|
55
|
+
cache/
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Pre-commit hooks for the agenthacker SDK. Mirrors the merge gates in
|
|
2
|
+
# .github/workflows/sdk.yml so problems are caught before they reach CI.
|
|
3
|
+
#
|
|
4
|
+
# pip install pre-commit
|
|
5
|
+
# pre-commit install
|
|
6
|
+
# pre-commit run --all-files # one-off full pass
|
|
7
|
+
repos:
|
|
8
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
9
|
+
rev: v0.15.20
|
|
10
|
+
hooks:
|
|
11
|
+
- id: ruff # lint (autofix)
|
|
12
|
+
args: [--fix]
|
|
13
|
+
files: ^src/firewall_sdk/
|
|
14
|
+
- id: ruff-format # format
|
|
15
|
+
files: ^src/firewall_sdk/
|
|
16
|
+
|
|
17
|
+
- repo: https://github.com/Yelp/detect-secrets
|
|
18
|
+
rev: v1.5.0
|
|
19
|
+
hooks:
|
|
20
|
+
- id: detect-secrets
|
|
21
|
+
args: ["--baseline", ".secrets.baseline"]
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "1.5.0",
|
|
3
|
+
"plugins_used": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ArtifactoryDetector"
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"name": "AWSKeyDetector"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"name": "AzureStorageKeyDetector"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "Base64HighEntropyString",
|
|
15
|
+
"limit": 4.5
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"name": "BasicAuthDetector"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "CloudantDetector"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"name": "DiscordBotTokenDetector"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "GitHubTokenDetector"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "GitLabTokenDetector"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"name": "HexHighEntropyString",
|
|
34
|
+
"limit": 3.0
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "IbmCloudIamDetector"
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"name": "IbmCosHmacDetector"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"name": "IPPublicDetector"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "JwtTokenDetector"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "KeywordDetector",
|
|
50
|
+
"keyword_exclude": ""
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "MailchimpDetector"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "NpmDetector"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"name": "OpenAIDetector"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"name": "PrivateKeyDetector"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "PypiTokenDetector"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "SendGridDetector"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"name": "SlackDetector"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"name": "SoftlayerDetector"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "SquareOAuthDetector"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "StripeDetector"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "TelegramBotTokenDetector"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "TwilioKeyDetector"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"filters_used": [
|
|
90
|
+
{
|
|
91
|
+
"path": "detect_secrets.filters.allowlist.is_line_allowlisted"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
|
|
95
|
+
"min_level": 2
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"path": "detect_secrets.filters.heuristic.is_indirect_reference"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"path": "detect_secrets.filters.heuristic.is_likely_id_string"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"path": "detect_secrets.filters.heuristic.is_lock_file"
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"path": "detect_secrets.filters.heuristic.is_potential_uuid"
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"path": "detect_secrets.filters.heuristic.is_sequential_string"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"path": "detect_secrets.filters.heuristic.is_swagger_file"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"path": "detect_secrets.filters.heuristic.is_templated_secret"
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"results": {
|
|
126
|
+
"rule_catalog.json": [
|
|
127
|
+
{
|
|
128
|
+
"type": "Secret Keyword",
|
|
129
|
+
"filename": "rule_catalog.json",
|
|
130
|
+
"hashed_secret": "d321afb05515c38468450cffa15e3c068f829ada",
|
|
131
|
+
"is_verified": false,
|
|
132
|
+
"line_number": 343
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"tests/firewall_sdk/test_event_store.py": [
|
|
136
|
+
{
|
|
137
|
+
"type": "Basic Auth Credentials",
|
|
138
|
+
"filename": "tests/firewall_sdk/test_event_store.py",
|
|
139
|
+
"hashed_secret": "9d4e1e23bd5b727046a9e3b4b7db57bd8d6ee684",
|
|
140
|
+
"is_verified": false,
|
|
141
|
+
"line_number": 142
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"tests/firewall_sdk/test_features.py": [
|
|
145
|
+
{
|
|
146
|
+
"type": "Base64 High Entropy String",
|
|
147
|
+
"filename": "tests/firewall_sdk/test_features.py",
|
|
148
|
+
"hashed_secret": "3a6c8ddd26c465fdcddd7ac90485bfb54dac5ab8",
|
|
149
|
+
"is_verified": false,
|
|
150
|
+
"line_number": 72
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"type": "Secret Keyword",
|
|
154
|
+
"filename": "tests/firewall_sdk/test_features.py",
|
|
155
|
+
"hashed_secret": "3a6c8ddd26c465fdcddd7ac90485bfb54dac5ab8",
|
|
156
|
+
"is_verified": false,
|
|
157
|
+
"line_number": 72
|
|
158
|
+
}
|
|
159
|
+
],
|
|
160
|
+
"tests/firewall_sdk/test_r08_collapsed_false_positives.py": [
|
|
161
|
+
{
|
|
162
|
+
"type": "Base64 High Entropy String",
|
|
163
|
+
"filename": "tests/firewall_sdk/test_r08_collapsed_false_positives.py",
|
|
164
|
+
"hashed_secret": "ff6e59edbec3fcff133d7dba55b9c78cfe3be157",
|
|
165
|
+
"is_verified": false,
|
|
166
|
+
"line_number": 23
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"type": "Base64 High Entropy String",
|
|
170
|
+
"filename": "tests/firewall_sdk/test_r08_collapsed_false_positives.py",
|
|
171
|
+
"hashed_secret": "6ca34167f6574493bc816071212579678f9d4fd0",
|
|
172
|
+
"is_verified": false,
|
|
173
|
+
"line_number": 25
|
|
174
|
+
}
|
|
175
|
+
],
|
|
176
|
+
"tests/firewall_sdk/test_scan_engine.py": [
|
|
177
|
+
{
|
|
178
|
+
"type": "AWS Access Key",
|
|
179
|
+
"filename": "tests/firewall_sdk/test_scan_engine.py",
|
|
180
|
+
"hashed_secret": "25910f981e85ca04baf359199dd0bd4a3ae738b6",
|
|
181
|
+
"is_verified": false,
|
|
182
|
+
"line_number": 127
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"generated_at": "2026-07-02T01:36:09Z"
|
|
187
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to the Firewall SDK will be documented in this file.
|
|
4
|
+
|
|
5
|
+
Format follows [Keep a Changelog](https://keepachangelog.com/).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
### Packaging
|
|
10
|
+
|
|
11
|
+
- **Distribution renamed to `agenthacker`** for PyPI (`pip install agenthacker`).
|
|
12
|
+
The **import** name is unchanged — still `from firewall_sdk import Firewall`.
|
|
13
|
+
`pyproject.toml` maps the distribution to the `src/firewall_sdk` package
|
|
14
|
+
explicitly.
|
|
15
|
+
- Added a `py.typed` marker so type checkers pick up the SDK's inline types.
|
|
16
|
+
- Expanded package metadata: keywords, trove classifiers, and project URLs.
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Cloud HTTP timeout is now configurable via the `AGENTHACKER_HTTP_TIMEOUT`
|
|
21
|
+
environment variable, a `Firewall(http_timeout=...)` argument, or
|
|
22
|
+
`CloudClient(..., timeout=...)` (default unchanged at 3s). Raise it for
|
|
23
|
+
backends with cold-start latency, where the previous fixed 3s could time out
|
|
24
|
+
and fail open before the backend warmed.
|
|
25
|
+
- Backend throttling (HTTP 429) now emits a one-time warning per endpoint
|
|
26
|
+
(like 401/403) instead of a silent debug log, so a rate-limited — and thus
|
|
27
|
+
fail-open, unchecked — agent is visible in logs.
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- `configure_features` docstring example referenced `llm_guard`, which is not
|
|
32
|
+
one of the registry flags and would raise `ValueError`; it now uses real flags.
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
- New `lang.py` module — pure-stdlib script/language utilities used across the CP layers:
|
|
37
|
+
`dominant_scripts`, `is_mostly_non_latin`, `is_mixed_script`, `confusable_skeleton`,
|
|
38
|
+
`has_latin_confusables`, `script_risk`, `strip_invisible`, `invisible_char_stats`,
|
|
39
|
+
`has_foreign_segment`
|
|
40
|
+
- Invisible/zero-width Unicode normalization in the regex checkpoint — strips zero-width,
|
|
41
|
+
variation-selector, and Unicode tag-block characters before matching; any Unicode tag-block
|
|
42
|
+
character (U+E0000–U+E007F) is now a hard block (R-11) to defeat tag/emoji smuggling
|
|
43
|
+
- Homoglyph (Cyrillic/Greek → ASCII) skeleton pass so confusable-spoofed English attacks match
|
|
44
|
+
the existing regex (e.g. Cyrillic-spoofed "ignore previous instructions" → R-02)
|
|
45
|
+
- Code-switching / "sandwich" attack detection (`has_foreign_segment`) — a short non-dominant
|
|
46
|
+
script run buried in benign text now forces the cloud (Bedrock) judge
|
|
47
|
+
- `script_risk_factor()` and an opt-in `extra_factors` parameter on `check_user_risk` — a
|
|
48
|
+
capped soft behavioural-risk signal for non-Latin/mixed-script/homoglyph input (never a hard block)
|
|
49
|
+
- Optional translate-then-scan layer `translate_guard.py` (new `[translate]` extra) — off by
|
|
50
|
+
default, advisory; scans a translated copy for the literal English-phrase rule subset only
|
|
51
|
+
- `AGENTHACKER_API_URL` environment override in `cloud_client.configure()` / auto-configure so
|
|
52
|
+
the SDK can target a local or self-hosted backend
|
|
53
|
+
- Multilingual + obfuscation test coverage: `test_lang.py`, `test_multilingual_semantic.py`,
|
|
54
|
+
`test_translate_guard.py`, `test_llm_guard.py`, and zero-width/tag-block/homoglyph/CJK cases
|
|
55
|
+
added to `test_scan_engine.py` and `test_output_guard.py`
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
|
|
59
|
+
- Default semantic embedding model → `paraphrase-multilingual-MiniLM-L12-v2` (drop-in 384-dim);
|
|
60
|
+
override via `FIREWALL_EMBEDDING_MODEL`
|
|
61
|
+
- Default LLM Guard injection model → Meta `Llama-Prompt-Guard-2-86M` (multilingual); override via
|
|
62
|
+
`FIREWALL_LLM_GUARD_MODEL`; falls back to the English DeBERTa default (never crashes) when the
|
|
63
|
+
gated model or `HF_TOKEN` is unavailable
|
|
64
|
+
- Regex checkpoint now evaluates each rule against the original text plus the invisible-stripped
|
|
65
|
+
and homoglyph-skeleton variants (original text still reported in `ScanResult`)
|
|
66
|
+
- `IntentGate.scan_sync` routes non-Latin / mixed-script / foreign-segment input to the cloud
|
|
67
|
+
judge instead of trusting the English-primary local cosine pass
|
|
68
|
+
- `output_guard` S-01 prompt-leakage detection uses character n-gram shingles for no-space scripts
|
|
69
|
+
(CJK/Thai); Latin path unchanged
|
|
70
|
+
- LLM judge (`llm_judge.py`), alignment auditor (`alignment_check.py`), and the cloud Bedrock
|
|
71
|
+
classifier prompt (backend) made explicitly language-agnostic, with a code-switch/sandwich clause
|
|
72
|
+
- `__init__.py` exports `script_risk_factor`; `test_public_api_surface.py` expected surface synced
|
|
73
|
+
- Companion backend changes (outside this package): `apps/backend/db.py` adds a `DB_SSLMODE`
|
|
74
|
+
override for local/self-hosted Postgres (prod default unchanged)
|
|
75
|
+
|
|
76
|
+
### Fixed
|
|
77
|
+
|
|
78
|
+
- S-01 system-prompt-leakage detection silently disabled for no-space scripts (CJK/Thai) due to
|
|
79
|
+
whitespace word-splitting
|
|
80
|
+
- Homoglyph (Cyrillic/Greek lookalike) and invisible-character obfuscation bypassing the
|
|
81
|
+
English-only regex checkpoint
|
|
82
|
+
|
|
83
|
+
### Security
|
|
84
|
+
|
|
85
|
+
- Detect prompt-injection / jailbreak / out-of-scope / leakage attacks regardless of language,
|
|
86
|
+
transliteration, code-switching, homoglyph spoofing, or zero-width/tag-block/emoji-smuggling
|
|
87
|
+
obfuscation, across the regex, embedding, ML-classifier, LLM-judge, and output checkpoints
|
|
88
|
+
(defense-in-depth; all model/cloud layers remain fail-open)
|
|
89
|
+
|
|
90
|
+
## [0.1.0] - 2026-03-31
|
|
91
|
+
|
|
92
|
+
### Added
|
|
93
|
+
|
|
94
|
+
- Core scan engine with rules R-01 through R-16 (regex-based injection detection, topic scoping, encoding detection, adversarial suffix detection)
|
|
95
|
+
- Four checkpoint scan functions: `scan_input`, `scan_data_field`, `scan_tool_call`, `scan_output`
|
|
96
|
+
- `ScanResult` dataclass and `CLEAN` sentinel
|
|
97
|
+
- Tool guard with `allowed_tools` set and `id_resolver` callable interface
|
|
98
|
+
- Output guard with parameterized `entity_pattern` and `leakage_label` for cross-entity leakage detection
|
|
99
|
+
- LLM Guard integration (optional `[llm_guard]` extra) — semantic scanning via DeBERTa models
|
|
100
|
+
- Invariant Analyzer integration (optional `[invariant]` extra) — trace-level policy evaluation
|
|
101
|
+
- Trace normalization (Anthropic format to OpenAI-compatible format)
|
|
102
|
+
- Structured audit logger with HMAC-hashed email identifiers
|
|
103
|
+
- Agent helpers (provisional) — serialization, trace snapshots, refusal normalization
|
|
104
|
+
- Golden parity corpus validating behavioral equivalence across both agents
|
|
105
|
+
- API surface enforcement test (`test_public_api_surface.py`)
|
|
106
|
+
- `__all__` declarations on all public, semi-public, and provisional modules
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual
|
|
10
|
+
identity and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
14
|
+
|
|
15
|
+
## Our Standards
|
|
16
|
+
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
19
|
+
|
|
20
|
+
* Demonstrating empathy and kindness toward other people
|
|
21
|
+
* Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
* Giving and gracefully accepting constructive feedback
|
|
23
|
+
* Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
* Focusing on what is best not just for us as individuals, but for the overall
|
|
26
|
+
community
|
|
27
|
+
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
29
|
+
|
|
30
|
+
* The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
|
+
any kind
|
|
32
|
+
* Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
* Public or private harassment
|
|
34
|
+
* Publishing others' private information, such as a physical or email address,
|
|
35
|
+
without their explicit permission
|
|
36
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
37
|
+
professional setting
|
|
38
|
+
|
|
39
|
+
## Enforcement Responsibilities
|
|
40
|
+
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
45
|
+
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
50
|
+
|
|
51
|
+
## Scope
|
|
52
|
+
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official email address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
58
|
+
|
|
59
|
+
## Enforcement
|
|
60
|
+
|
|
61
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
**reports@agenthacker.ai**.
|
|
64
|
+
|
|
65
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
66
|
+
|
|
67
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
68
|
+
reporter of any incident.
|
|
69
|
+
|
|
70
|
+
## Enforcement Guidelines
|
|
71
|
+
|
|
72
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
73
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
74
|
+
|
|
75
|
+
### 1. Correction
|
|
76
|
+
|
|
77
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
78
|
+
unprofessional or unwelcome in the community.
|
|
79
|
+
|
|
80
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
81
|
+
clarity around the nature of the violation and an explanation of why the
|
|
82
|
+
behavior was inappropriate. A public apology may be requested.
|
|
83
|
+
|
|
84
|
+
### 2. Warning
|
|
85
|
+
|
|
86
|
+
**Community Impact**: A violation through a single incident or series of
|
|
87
|
+
actions.
|
|
88
|
+
|
|
89
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
90
|
+
interaction with the people involved, including unsolicited interaction with
|
|
91
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
92
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
93
|
+
like social media. Violating these terms may lead to a temporary or permanent
|
|
94
|
+
ban.
|
|
95
|
+
|
|
96
|
+
### 3. Temporary Ban
|
|
97
|
+
|
|
98
|
+
**Community Impact**: A serious violation of community standards, including
|
|
99
|
+
sustained inappropriate behavior.
|
|
100
|
+
|
|
101
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
102
|
+
communication with the community for a specified period of time. No public or
|
|
103
|
+
private interaction with the people involved, including unsolicited interaction
|
|
104
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
105
|
+
Violating these terms may lead to a permanent ban.
|
|
106
|
+
|
|
107
|
+
### 4. Permanent Ban
|
|
108
|
+
|
|
109
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
110
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
111
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
112
|
+
|
|
113
|
+
**Consequence**: A permanent ban from any sort of public interaction within the
|
|
114
|
+
community.
|
|
115
|
+
|
|
116
|
+
## Attribution
|
|
117
|
+
|
|
118
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
119
|
+
version 2.1, available at
|
|
120
|
+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
121
|
+
|
|
122
|
+
Community Impact Guidelines were inspired by
|
|
123
|
+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
|
124
|
+
|
|
125
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
126
|
+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
|
127
|
+
[https://www.contributor-covenant.org/translations][translations].
|
|
128
|
+
|
|
129
|
+
[homepage]: https://www.contributor-covenant.org
|
|
130
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
131
|
+
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
132
|
+
[FAQ]: https://www.contributor-covenant.org/faq
|
|
133
|
+
[translations]: https://www.contributor-covenant.org/translations
|