Skip to content

Commit 59fc651

Browse files
committed
Release v1.3.2
1 parent 45509a6 commit 59fc651

37 files changed

Lines changed: 1104 additions & 278 deletions

.github/ISSUE_TEMPLATE/release-checklist.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,31 @@ assignees: ""
99
## Version
1010

1111
- [ ] `bla/__version__.py` contains the target version
12+
- [ ] Git tag is exactly `vX.Y.Z` and matches `bla.__version__`
1213
- [ ] `bla --version` shows the target version
1314
- [ ] JSON/SARIF report metadata uses the target version
1415
- [ ] README examples use the target version
1516

1617
## Validation
1718

1819
- [ ] `python3 -m compileall -q bla bla_cli.py setup.py tests`
20+
- [ ] `python3 -m pytest -q`
1921
- [ ] `python3 -m unittest discover -s tests -v`
2022
- [ ] `python3 bla_cli.py validate-rules --strict-metadata`
2123
- [ ] sample log smoke tests pass with `--exit-on none`
24+
- [ ] P0 fixture smoke test passes with `--profile cn-hvv --out /tmp/bla-p0-smoke --exit-on none --no-color`
2225
- [ ] `bla ssh --help` confirms Remote Workspace CLI wiring
26+
- [ ] `python3 bla_cli.py benchmark --size-mb 1`
27+
- [ ] `python3 bla_cli.py benchmark --size-mb 1 --memory`
2328
- [ ] `python3 -m build`
24-
- [ ] wheel/sdist include `bla/rules/web_attacks.yaml` and `bla/remote/ssh_workspace.py`
29+
- [ ] `python3 -m twine check dist/*` when `twine` is available
30+
- [ ] wheel includes package code/rules; sdist includes release notes, sample logs, and P0 fixtures
31+
- [ ] fresh wheel install smoke test passes
2532

2633
## Publishing
2734

2835
- [ ] Git tag created as `vX.Y.Z`
29-
- [ ] GitHub Release created with notes and artifacts
36+
- [ ] GitHub Release created with notes and artifacts, marked Latest
3037
- [ ] PyPI Trusted Publishing is configured for `.github/workflows/publish.yml` and the `pypi` GitHub environment
3138
- [ ] Only one PyPI publish path is used for this version: GitHub Release workflow preferred, no prior manual `twine` upload
3239
- [ ] PyPI publish workflow completed

.github/workflows/publish.yml

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,35 @@ jobs:
2222
with:
2323
python-version: "3.12"
2424

25-
- name: Build package
25+
- name: Verify tag version
26+
run: |
27+
python - <<'PY'
28+
import os
29+
from bla.__version__ import __version__
30+
ref = os.environ.get("GITHUB_REF_NAME", "")
31+
if ref.startswith("v") and ref[1:] != __version__:
32+
raise SystemExit(f"Tag {ref} does not match package version {__version__}")
33+
PY
34+
35+
- name: Run validation
2636
run: |
27-
python -m pip install --upgrade build
28-
python -m build
37+
python -m pip install --upgrade build twine pytest
38+
python -m pytest -q
39+
python -m compileall -q bla bla_cli.py setup.py tests
40+
python bla_cli.py validate-rules --strict-metadata
41+
python bla_cli.py ssh --help
42+
43+
- name: Build package
44+
run: python -m build
2945

3046
- name: Check distribution metadata
3147
run: |
48+
python -m twine check dist/*
3249
python - <<'PY'
3350
from pathlib import Path
3451
import tarfile
3552
import zipfile
53+
from bla.__version__ import __version__
3654
3755
dist = Path("dist")
3856
wheels = sorted(dist.glob("*.whl"))
@@ -53,8 +71,26 @@ jobs:
5371
raise SystemExit("Source distribution is missing bla/rules/web_attacks.yaml")
5472
if not any(name.endswith("/bla/remote/ssh_workspace.py") for name in names):
5573
raise SystemExit("Source distribution is missing bla/remote/ssh_workspace.py")
74+
required = [
75+
f"/docs/releases/v{__version__}.md",
76+
"/sample_logs/auth.log",
77+
"/sample_logs/windows_rdp_sample.xml",
78+
"/tests/fixtures/p0/hvv_chain.jsonl",
79+
]
80+
for suffix in required:
81+
if not any(name.endswith(suffix) for name in names):
82+
raise SystemExit(f"Source distribution is missing {suffix}")
5683
PY
5784
85+
- name: Smoke test built wheel
86+
run: |
87+
python -m venv /tmp/bla-wheel-smoke
88+
/tmp/bla-wheel-smoke/bin/python -m pip install --upgrade pip
89+
/tmp/bla-wheel-smoke/bin/python -m pip install dist/*.whl
90+
/tmp/bla-wheel-smoke/bin/bla --version
91+
/tmp/bla-wheel-smoke/bin/bla validate-rules --strict-metadata
92+
/tmp/bla-wheel-smoke/bin/bla ssh --help
93+
5894
- name: Publish to PyPI
5995
uses: pypa/gh-action-pypi-publish@release/v1
6096
with:

.github/workflows/test.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,25 @@ jobs:
3030
- name: Validate bundled rules
3131
run: python bla_cli.py validate-rules --strict-metadata
3232

33+
- name: Install test dependencies
34+
run: python -m pip install --upgrade pytest
35+
36+
- name: Run pytest regressions
37+
run: python -m pytest -q
38+
3339
- name: Run regression tests
3440
run: python -m unittest discover -s tests -v
3541

3642
- name: Smoke test Remote Workspace CLI
3743
run: python bla_cli.py ssh --help
3844

3945
- name: Smoke test on sample logs
40-
# 样本日志包含故意构造的暴力破解 / Web 攻击,bla 命中严重告警时退出码为 1,
41-
# 这是期望行为而不是 CI 失败。允许 0 或 1,其它退出码才视为故障。
4246
shell: bash
4347
run: |
44-
set +e
45-
python bla_cli.py sample_logs/auth.log --no-color --max-alerts 5
46-
rc=$?; [ $rc -eq 0 ] || [ $rc -eq 1 ] || exit $rc
47-
python bla_cli.py sample_logs/access.log --no-color --max-alerts 5
48-
rc=$?; [ $rc -eq 0 ] || [ $rc -eq 1 ] || exit $rc
49-
python bla_cli.py sample_logs/remote_ssh_auth.log --no-color --max-alerts 5
50-
rc=$?; [ $rc -eq 0 ] || [ $rc -eq 1 ] || exit $rc
48+
python bla_cli.py sample_logs/auth.log --no-color --max-alerts 5 --exit-on none
49+
python bla_cli.py sample_logs/access.log --no-color --max-alerts 5 --exit-on none
50+
python bla_cli.py sample_logs/remote_ssh_auth.log --no-color --max-alerts 5 --exit-on none
51+
python bla_cli.py sample_logs/windows_rdp_sample.xml --rdp --no-color --max-alerts 5 --exit-on none
5152
5253
- name: Build package
5354
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,15 @@ Thumbs.db
4242
!docs/allowlist-example.json
4343
!tests/fixtures/**/*.json
4444
*.csv
45+
*.sarif
46+
iocs.txt
47+
report/
4548
case-*/
4649
!sample_logs/
50+
.coverage
51+
htmlcov/
52+
.pytest_cache/
53+
.ruff_cache/
4754

4855
# Logs
4956
*.log

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include README.md LICENSE pyproject.toml setup.py
2+
recursive-include bla/rules *.yaml
3+
recursive-include docs *.md *.png *.json
4+
recursive-include sample_logs *.log *.xml
5+
recursive-include tests *.py *.json *.jsonl

0 commit comments

Comments
 (0)