advisory-rss 1.0.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.
Files changed (41) hide show
  1. advisory_rss-1.0.0/.env.example +52 -0
  2. advisory_rss-1.0.0/.github/dependabot.yml +19 -0
  3. advisory_rss-1.0.0/.github/workflows/codeql.yml +39 -0
  4. advisory_rss-1.0.0/.github/workflows/publish.yml +49 -0
  5. advisory_rss-1.0.0/.gitignore +51 -0
  6. advisory_rss-1.0.0/LICENSE +674 -0
  7. advisory_rss-1.0.0/PKG-INFO +306 -0
  8. advisory_rss-1.0.0/README.md +282 -0
  9. advisory_rss-1.0.0/pyproject.toml +55 -0
  10. advisory_rss-1.0.0/pyrightconfig.json +6 -0
  11. advisory_rss-1.0.0/release.sh +63 -0
  12. advisory_rss-1.0.0/scripts/fixtures_generator.py +373 -0
  13. advisory_rss-1.0.0/src/advisory_rss/__init__.py +1 -0
  14. advisory_rss-1.0.0/src/advisory_rss/auth/pat.py +31 -0
  15. advisory_rss-1.0.0/src/advisory_rss/cache/models.py +106 -0
  16. advisory_rss-1.0.0/src/advisory_rss/cache/store.py +269 -0
  17. advisory_rss-1.0.0/src/advisory_rss/cli.py +561 -0
  18. advisory_rss-1.0.0/src/advisory_rss/config/constants.py +34 -0
  19. advisory_rss-1.0.0/src/advisory_rss/config/settings.py +279 -0
  20. advisory_rss-1.0.0/src/advisory_rss/github/client.py +702 -0
  21. advisory_rss-1.0.0/src/advisory_rss/github/filter.py +77 -0
  22. advisory_rss-1.0.0/src/advisory_rss/github/normalize.py +227 -0
  23. advisory_rss-1.0.0/src/advisory_rss/github/paginate.py +51 -0
  24. advisory_rss-1.0.0/src/advisory_rss/logging_config.py +345 -0
  25. advisory_rss-1.0.0/src/advisory_rss/rss/builder.py +355 -0
  26. advisory_rss-1.0.0/src/advisory_rss/rss/xml_util.py +31 -0
  27. advisory_rss-1.0.0/src/advisory_rss/server/app.py +308 -0
  28. advisory_rss-1.0.0/src/advisory_rss/server/bind.py +35 -0
  29. advisory_rss-1.0.0/src/advisory_rss/server/headers.py +24 -0
  30. advisory_rss-1.0.0/tests/__init__.py +0 -0
  31. advisory_rss-1.0.0/tests/fixtures/.gitkeep +0 -0
  32. advisory_rss-1.0.0/tests/integration/test_cache_fallback.py +68 -0
  33. advisory_rss-1.0.0/tests/integration/test_server.py +163 -0
  34. advisory_rss-1.0.0/tests/unit/test_bind_validation.py +68 -0
  35. advisory_rss-1.0.0/tests/unit/test_cache.py +98 -0
  36. advisory_rss-1.0.0/tests/unit/test_filter.py +67 -0
  37. advisory_rss-1.0.0/tests/unit/test_github_client.py +278 -0
  38. advisory_rss-1.0.0/tests/unit/test_normalize.py +179 -0
  39. advisory_rss-1.0.0/tests/unit/test_paginate.py +29 -0
  40. advisory_rss-1.0.0/tests/unit/test_rss_builder.py +242 -0
  41. advisory_rss-1.0.0/tests/unit/test_token_redaction.py +86 -0
@@ -0,0 +1,52 @@
1
+ # Advisory-RSS - copy to .env and fill GITHUB_TOKEN
2
+ # NEVER commit .env - it is gitignored. Do NOT put real tokens in this example file.
3
+
4
+ # GitHub PAT (least privilege)
5
+ # Fine-grained PAT (recommended): Repository security advisories: Read + Metadata: Read
6
+ # Create at: https://github.com/settings/personal-access-tokens/new
7
+ # Expiry: short (30-90 days), rotate via `app auth login`.
8
+ # Classic PAT fallback: `repo` or at minimum `public_repo` (private drafts need `repo`)
9
+ # The token is NEVER logged or exposed via RSS/health.
10
+ GITHUB_TOKEN=ghp_your_token_here
11
+ # Alias accepted: GITHUB_PAT - but prefer GITHUB_TOKEN
12
+ # GITHUB_PAT=github_pat_your_token_here
13
+
14
+ # Optional: GitHub Enterprise / GHES base (default is https://api.github.com)
15
+ # GITHUB_API_BASE=https://api.github.com
16
+
17
+ # Server - MUST remain localhost-only. Do NOT change to 0.0.0.0 unless you fully redesign security.
18
+ BIND_ADDRESS=127.0.0.1
19
+ PORT=8765
20
+
21
+ # Background refresh interval in seconds (min 60). Zen Browser also polls RSS independently.
22
+ REFRESH_INTERVAL=600
23
+ # Max items in RSS feed (cache retains all to avoid missing advisories)
24
+ MAX_ITEMS=1000
25
+ # How to filter advisories: author (default) | author_or_publisher | author_or_collaborator
26
+ FILTER_MODE=author
27
+
28
+ # Optional: allow POST /refresh (default false - keep disabled to minimize attack surface)
29
+ # ENABLE_REFRESH_ENDPOINT=false
30
+ # REFRESH_TOKEN=change-me-to-random-uuid-if-enabled
31
+
32
+ # Logging
33
+ LOG_LEVEL=INFO
34
+ # LOG_FORMAT=text # text | json (json gives structured logs for aggregation)
35
+ # LOG_FILE=cache/serve.log # optional rotating file; if empty logs go to stderr (daemon still uses cache/serve.log)
36
+ # LOG_MAX_BYTES=5242880 # 5MiB per file (set via constant LOG_MAX_BYTES)
37
+ # LOG_BACKUP_COUNT=3
38
+
39
+ # Cache location (fixed, not user-controlled path traversal)
40
+ CACHE_PATH=cache/advisories.db
41
+
42
+ # Direct fetch - for advisories in repos you don't own (e.g. you authored GHSA in your-org/your-repo)
43
+ # Comma-separated list of repos to always scan (even if not in affiliation owner/member)
44
+ # Example: GITHUB_REPOS=your-org/your-repo,other-org/other-repo
45
+ # GITHUB_REPOS=
46
+ # GITHUB_ORG=your-org # expands to all repos in org via /orgs/{org}/repos
47
+ # When true, skip scanning all owned repos and ONLY scan GITHUB_REPOS/GITHUB_ORG (fast, no full enumeration)
48
+ # SKIP_FULL_SCAN=false
49
+
50
+ # Hard caps to bound pagination (avoid silently hitting rate limits without warning)
51
+ # MAX_REPOS=1000
52
+ # MAX_PAGES_PER_REPO=100
@@ -0,0 +1,19 @@
1
+ version: 2
2
+ updates:
3
+ # Python bağımlılıkları (pyproject.toml)
4
+ - package-ecosystem: "pip"
5
+ directory: "/"
6
+ schedule:
7
+ interval: "daily"
8
+ open-pull-requests-limit: 10
9
+ labels:
10
+ - "dependencies"
11
+ - "security"
12
+
13
+ - package-ecosystem: "github-actions"
14
+ directory: "/"
15
+ schedule:
16
+ interval: "weekly"
17
+ labels:
18
+ - "dependencies"
19
+ - "ci"
@@ -0,0 +1,39 @@
1
+ name: "CodeQL"
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+ workflow_dispatch: {}
9
+
10
+ jobs:
11
+ analyze:
12
+ name: Analyze (${{ matrix.language }})
13
+ runs-on: ubuntu-latest
14
+ permissions:
15
+ security-events: write
16
+ contents: read
17
+ actions: read
18
+
19
+ strategy:
20
+ fail-fast: false
21
+ matrix:
22
+ language: [ 'python' ]
23
+
24
+ steps:
25
+ - name: Checkout repository
26
+ uses: actions/checkout@v7
27
+ - name: Initialize CodeQL
28
+ uses: github/codeql-action/init@v4
29
+ with:
30
+ languages: ${{ matrix.language }}
31
+ queries: security-extended
32
+
33
+ - name: Autobuild
34
+ uses: github/codeql-action/autobuild@v4
35
+
36
+ - name: Perform CodeQL Analysis
37
+ uses: github/codeql-action/analyze@v4
38
+ with:
39
+ category: "/language:${{ matrix.language }}"
@@ -0,0 +1,49 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.14"
22
+
23
+ - name: Install build dependencies
24
+ run: pip install build
25
+
26
+ - name: Build package
27
+ run: python -m build
28
+
29
+ - name: Upload build artifacts
30
+ uses: actions/upload-artifact@v4
31
+ with:
32
+ name: dist
33
+ path: dist/
34
+
35
+ publish:
36
+ needs: build
37
+ runs-on: ubuntu-latest
38
+ environment: pypi
39
+ permissions:
40
+ id-token: write
41
+ steps:
42
+ - name: Download build artifacts
43
+ uses: actions/download-artifact@v4
44
+ with:
45
+ name: dist
46
+ path: dist/
47
+
48
+ - name: Publish to PyPI
49
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,51 @@
1
+ # secrets
2
+ .env
3
+ .env.local
4
+
5
+ # cache / db
6
+ *.db
7
+ *.sqlite
8
+ *.sqlite3
9
+ /cache/
10
+ data/
11
+ .cache/
12
+
13
+ # credentials
14
+ credentials/
15
+ *.pem
16
+ *.key
17
+
18
+ # logs
19
+ logs/
20
+ *.log
21
+
22
+ # python
23
+ __pycache__/
24
+ *.py[cod]
25
+ *.pyo
26
+ .venv/
27
+ venv/
28
+ .envrc
29
+ .pytest_cache/
30
+ .mypy_cache/
31
+ .ruff_cache/
32
+ coverage.xml
33
+ htmlcov/
34
+ dist/
35
+ build/
36
+ *.egg-info/
37
+
38
+ # os
39
+ .DS_Store
40
+ Thumbs.db
41
+
42
+ # editor
43
+ .vscode/
44
+ .idea/
45
+ *.swp
46
+ *.swo
47
+ # fixtures are per-user (tied to author's GHSA) - each user generates their own
48
+ # via `python scripts/fixtures_generator.py` - do not commit real fixtures or manifest
49
+ tests/fixtures/*
50
+ !tests/fixtures/.gitkeep
51
+ uv.lock