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
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ jobs:
# throwaway environment with the runner's Python and compiles lxml from
# source there, which fails for reasons that have nothing to do with a
# vulnerability. The tool itself is pinned like everything else.
# Ignored IDs are the ones in .trivyignore, which says why each is open.
run: |
uv export --all-extras --no-emit-project --format requirements.txt > requirements.txt
uvx pip-audit@2.10.1 --disable-pip --require-hashes --requirement requirements.txt --strict
uvx pip-audit@2.10.1 --disable-pip --require-hashes --requirement requirements.txt --strict \
$(grep -E '^[A-Z]+-' .trivyignore | sed 's/^/--ignore-vuln /')
3 changes: 2 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Container

on:
pull_request:
paths: [Dockerfile, .dockerignore, compose.yaml, pyproject.toml, uv.lock, "src/**"]
paths: [Dockerfile, .dockerignore, .trivyignore, compose.yaml, pyproject.toml, uv.lock, "src/**"]
push:
branches: [develop]
workflow_dispatch:
Expand Down Expand Up @@ -62,4 +62,5 @@ jobs:
image-ref: epc:ci
severity: HIGH,CRITICAL
ignore-unfixed: true
trivyignores: .trivyignore
exit-code: "1"
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ repos:
- id: gitleaks

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.6
rev: v0.17.2
hooks:
- id: ruff-check
args: ["--fix"]
Expand Down
13 changes: 13 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Vulnerabilities deliberately left open. Each entry says why and when it goes.
# pip-audit (ci.yml, `make audit`) reads its ignores from this file too, so an
# ID listed here is open in both scanners and nowhere else.

# pyasn1 0.6.4: quadratic CPU on crafted BER/DER. Fixed in 0.6.5, published
# 2026-10-27, still inside the 7-day supply-chain cooldown. Unreachable here: its
# only importer is google-auth's pure-Python RSA fallback, which needs `rsa`,
# and `rsa` is not installed — keys go through `cryptography` instead.
# Remove once pyasn1 0.6.5 is locked (2026-11-03 or later).
CVE-2026-119194
CVE-2026-119195
CVE-2026-119196
CVE-2026-119197
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ check: lint typecheck test ## Everything CI runs
.PHONY: audit
audit: ## Check locked dependencies against known vulnerabilities
uv export --all-extras --no-emit-project --format requirements.txt > /tmp/epc-requirements.txt
uvx pip-audit@2.10.1 --disable-pip --require-hashes --requirement /tmp/epc-requirements.txt --strict
uvx pip-audit@2.10.1 --disable-pip --require-hashes --requirement /tmp/epc-requirements.txt --strict \
$$(grep -E '^[A-Z]+-' .trivyignore | sed 's/^/--ignore-vuln /')

.PHONY: lock-refresh
lock-refresh: ## Move the supply-chain cooldown window forward, then re-lock
Expand Down
59 changes: 30 additions & 29 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,28 @@ keywords = ["gmail", "email", "triage", "llm", "classification"]
# Core = what every entrypoint needs, including the apply worker.
# The apply worker deliberately depends on neither an LLM SDK nor the MIME parser.
dependencies = [
"google-api-python-client>=2.200.0,<3",
"google-auth-oauthlib>=1.4.1,<2",
"google-auth-httplib2>=0.4.2,<0.5",
"pydantic>=2.13.5,<3",
"pydantic-settings>=2.15.0,<3",
"google-api-python-client>=2.201.0,<3",
"google-auth-oauthlib>=1.5.0,<2",
"google-auth-httplib2>=0.4.4,<0.5",
"pydantic>=2.14.1,<3",
"pydantic-settings>=2.16.1,<3",
"pyyaml>=6.0.3,<7",
"structlog>=26.1.0,<27",
]

[project.optional-dependencies]
# Everything the classify path needs on top of core.
classify = [
"openai>=3.8.0,<4",
"openai>=3.37.0,<4",
"beautifulsoup4>=4.15.0,<5",
"lxml>=6.1.3,<7",
]
# Credential/state/dispatch backends on AWS, plus the Bedrock classifier.
aws = [
"boto3>=1.43.89,<2",
"boto3>=1.43.118,<2",
# The Lambda Runtime Interface Client. Present so that one image can serve
# both entrypoints: the CLI on Fargate, and the apply handler on Lambda.
"awslambdaric>=3.1.1,<4",
"awslambdaric>=4.2.2,<5",
]
all = ["email-priority-classifier[classify,aws]"]

Expand All @@ -45,13 +45,13 @@ Repository = "https://github.com/KO1231/EmailPriorityClassifier"
dev = [
"pytest>=9.1.1,<10",
"pytest-cov>=7.1.0,<8",
"mypy>=2.3.1,<3",
"ruff>=0.16.6,<0.17",
"types-PyYAML>=6.0.12.20260815,<7",
"pre-commit>=4.6.2,<5",
"mypy>=2.4.0,<3",
"ruff>=0.17.2,<0.18",
"types-PyYAML>=6.0.12.20260906,<7",
"pre-commit>=4.7.0,<5",
# Typed boto3. The Converse request body is hand-written JSON; a wrong key
# name should be a type error, not a runtime ValidationException.
"boto3-stubs[bedrock-runtime,s3,sqs,ssm]>=1.43.89,<2",
"boto3-stubs[bedrock-runtime,s3,sqs,ssm]>=1.43.118,<2",
]

[build-system]
Expand All @@ -69,7 +69,8 @@ packages = ["src/epc"]
# Nearly every recent PyPI incident was detected and yanked within days, so a
# one-week quarantine blocks the class. Bump this date deliberately (and only
# with a lockfile diff you have read) when pulling in updates.
exclude-newer = "2026-09-06T00:00:00Z"
# The timezone is set to +09:00 to match JST.
exclude-newer = "2026-10-26T23:59:59+09:00"
default-groups = ["dev"]
# `uv add` writes a bare `>=X` by default, so every dependency added after this
# file was tidied would quietly admit the next major. "major" is semver-aware:
Expand All @@ -89,24 +90,24 @@ extend-exclude = ["*.md"]

[tool.ruff.lint]
select = [
"E", "W", # pycodestyle
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # bugbear
"A", # builtin shadowing
"C4", # comprehensions
"SIM", # simplify
"RET", # return
"ARG", # unused arguments
"PTH", # use pathlib
"TID", # tidy imports
"S", # bandit — this tool parses hostile input, keep it on
"E", "W", # pycodestyle
"F", # pyflakes
"I", # isort
"N", # pep8-naming
"UP", # pyupgrade
"B", # bugbear
"A", # builtin shadowing
"C4", # comprehensions
"SIM", # simplify
"RET", # return
"ARG", # unused arguments
"PTH", # use pathlib
"TID", # tidy imports
"S", # bandit — this tool parses hostile input, keep it on
"RUF",
]
ignore = [
"S101", # assert is fine outside of security-sensitive paths
"S101", # assert is fine outside of security-sensitive paths
]

[tool.ruff.lint.per-file-ignores]
Expand Down
Loading
Loading