Ingestion & State
SSRF-hardened HTTP/HTML article fetching, XML/sitemap/HTML feed discovery, SQLite ETag/SHA-256 deduplication store, and the pre-LLM deterministic vulnerability prefilter.
ingest
Hardened HTTP/RSS ingestion, SQLite state tracking, and pre-LLM filtering.
FetchError
Bases: RuntimeError
Raised when fetching or decoding a remote feed or article fails safely.
FetchResponse(final_url, status_code, content_type, body, etag=None, last_modified=None, not_modified=False)
dataclass
Bounded HTTP response payload returned by :class:SafeHttpFetcher.
Attributes:
| Name | Type | Description |
|---|---|---|
final_url |
str
|
Final validated URL after any permitted redirects. |
status_code |
int
|
HTTP status code. |
content_type |
str
|
Normalized MIME type (without charset parameters). |
body |
bytes
|
Raw response bytes (empty on |
etag |
str | None
|
Optional HTTP |
last_modified |
str | None
|
Optional HTTP |
not_modified |
bool
|
True when the server responded with HTTP |
IngestStateStore(db_path)
SQLite-backed state tracking canonical article hashes, cache validators, and alert outbox.
Unlike naive URL-only deduplication, storing content_sha256 alongside ETag and
Last-Modified headers allows zerobom watch to skip unchanged articles cheaply via
HTTP 304 while automatically re-processing live advisories that receive post-publish
edits (such as newly added fixed versions). Schema version 2 adds an at-least-once
delivery_outbox table so transient sink outages never drop alerts.
Initialize the SQLite ingestion state store and ensure schema existence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
db_path
|
Path | str
|
Path to the SQLite database file (parent directories created if needed). |
required |
Source code in src/zerobom/ingest/state.py
49 50 51 52 53 54 55 56 57 | |
conditional_headers(url)
Build HTTP conditional request headers from persisted ETag / Last-Modified.
Source code in src/zerobom/ingest/state.py
159 160 161 162 163 164 165 166 167 168 169 | |
count()
Return total number of tracked canonical article URLs.
Source code in src/zerobom/ingest/state.py
231 232 233 234 235 236 237 238 | |
enqueue_delivery(advisory_id, content_sha256, sink_key, outcome, *, created_at=None)
Persist an idempotent pending outbound alert record for at-least-once delivery.
Source code in src/zerobom/ingest/state.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
get(url)
Retrieve the persisted :class:ArticleStateRecord for a URL, if recorded.
Source code in src/zerobom/ingest/state.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
has_changed(url, content_sha256)
Return True if url is unseen or its normalized content_sha256 changed.
Source code in src/zerobom/ingest/state.py
152 153 154 155 156 157 | |
mark_delivered(advisory_id, content_sha256, sink_key, *, delivered_at=None)
Mark an outbox alert delivery acknowledged by its target sink.
Source code in src/zerobom/ingest/state.py
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 | |
mark_delivery_failed(advisory_id, content_sha256, sink_key, error)
Record a transient sink delivery failure so subsequent runs retry automatically.
Source code in src/zerobom/ingest/state.py
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 | |
mark_seen(url, content_sha256, *, etag=None, last_modified=None, advisory_id=None, routing=None, seen_at=None)
Convenience wrapper to build and persist an :class:ArticleStateRecord.
Source code in src/zerobom/ingest/state.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
pending_deliveries(*, sink_key=None, limit=200)
Return undelivered (pending or failed) outbox items ordered oldest first.
Source code in src/zerobom/ingest/state.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
record_processed_with_outbox(url, content_sha256, *, extra_urls=(), etag=None, last_modified=None, advisory_id=None, routing=None, sink_keys=(), outcome=None, seen_at=None)
Atomically persist article state (including redirects) and enqueue pending sink rows.
Source code in src/zerobom/ingest/state.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 | |
schema_version()
Return the current SQLite PRAGMA user_version integer.
Source code in src/zerobom/ingest/state.py
111 112 113 114 115 116 117 118 | |
upsert(record)
Insert or update an :class:ArticleStateRecord using parameterized SQL.
Source code in src/zerobom/ingest/state.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
PolledArticle(article, content_sha256, etag=None, last_modified=None, source_entry_url=None)
dataclass
Fetched candidate article paired with HTTP cache validators and content digest.
Used by :func:poll_feed_items and :func:zerobom.pipeline.watch_feeds so callers can
persist :class:IngestStateStore markers only after downstream extraction succeeds.
Attributes:
| Name | Type | Description |
|---|---|---|
article |
RawArticle
|
Ingested and cleaned :class: |
content_sha256 |
str
|
Hexadecimal SHA-256 digest of |
etag |
str | None
|
Optional HTTP |
last_modified |
str | None
|
Optional HTTP |
SafeHttpFetcher(*, client=None, dns_resolver=None, max_bytes=MAX_RESPONSE_BYTES, max_redirects=MAX_REDIRECTS, timeout=DEFAULT_TIMEOUT_SECONDS)
SSRF-hardened, streaming-bounded HTTP fetcher with manual redirect verification.
Initialize the hardened HTTP fetcher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
Client | None
|
Optional pre-configured |
None
|
dns_resolver
|
DnsResolver | None
|
Optional DNS resolver callable for deterministic offline testing. |
None
|
max_bytes
|
int
|
Maximum allowed streamed response payload size in bytes. |
MAX_RESPONSE_BYTES
|
max_redirects
|
int
|
Maximum permitted HTTP redirect hops (each hop re-validated). |
MAX_REDIRECTS
|
timeout
|
float
|
Socket/request timeout in seconds for default client creation. |
DEFAULT_TIMEOUT_SECONDS
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/zerobom/ingest/fetcher.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | |
client
property
Return the underlying httpx.Client instance.
close()
Close the underlying HTTP client when owned by this instance.
Source code in src/zerobom/ingest/fetcher.py
357 358 359 360 | |
fetch_article(url, *, source_name, source_tier=SourceTier.UNKNOWN, published_at=None, published_at_inferred=False, conditional_headers=None)
Fetch an HTML/text blog post and extract a normalized :class:RawArticle.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
Source article HTTP/HTTPS URL. |
required |
source_name
|
str
|
Human-readable feed/publisher name. |
required |
source_tier
|
SourceTier
|
Source credibility tier. |
UNKNOWN
|
published_at
|
datetime | None
|
Optional publication timestamp (defaults to current UTC time). |
None
|
published_at_inferred
|
bool
|
Whether |
False
|
conditional_headers
|
dict[str, str] | None
|
Optional |
None
|
Returns:
| Type | Description |
|---|---|
RawArticle | None
|
Tuple of |
FetchResponse
|
server replies |
Raises:
| Type | Description |
|---|---|
FetchError
|
On transport, SSRF, content-type, or empty-body failure. |
Source code in src/zerobom/ingest/fetcher.py
485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 | |
fetch_bytes(url, *, headers=None, allowed_content_types=ALLOWED_CONTENT_TYPES)
Fetch raw response bytes with per-hop SSRF validation and streaming size limits.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
Target HTTP or HTTPS URL. |
required |
headers
|
dict[str, str] | None
|
Optional extra request headers (e.g., |
None
|
allowed_content_types
|
frozenset[str]
|
Permitted normalized MIME media types. |
ALLOWED_CONTENT_TYPES
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
FetchResponse
|
class: |
Raises:
| Type | Description |
|---|---|
SsrfBlockedError
|
If the initial URL or any redirect resolves to a non-public IP. |
FetchError
|
On HTTP error status, disallowed Content-Type, redirect loop, or size cap. |
Source code in src/zerobom/ingest/fetcher.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 | |
SsrfBlockedError
Bases: FetchError
Raised when a URL or redirect target resolves to a non-public IP address.
compute_content_sha256(text)
Compute a deterministic SHA-256 hex digest over whitespace-normalized text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Extracted article body text. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Lowercase 64-character hexadecimal SHA-256 digest. |
Source code in src/zerobom/ingest/fetcher.py
294 295 296 297 298 299 300 301 302 303 304 | |
discover_feed_entries(body_bytes, feed, *, base_url=None, content_type='', max_entries=MAX_FEED_ENTRIES)
Discover candidate :class:FeedEntry items according to feed.kind.
Dispatches explicitly to RSS/Atom, XML sitemap, or generic same-origin HTML index parsing;
in FeedKind.AUTO mode, tries RSS/Atom -> XML sitemap -> prefix-filtered HTML index.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body_bytes
|
bytes
|
Raw fetched bytes from the source endpoint. |
required |
feed
|
SourceFeedConfig
|
Source configuration specifying |
required |
base_url
|
str | None
|
Final fetched URL used for resolving relative links on HTML index pages. |
None
|
content_type
|
str
|
HTTP response Content-Type header value. |
''
|
max_entries
|
int
|
Maximum entries to discover per source. |
MAX_FEED_ENTRIES
|
Returns:
| Type | Description |
|---|---|
tuple[FeedEntry, ...]
|
Deduplicated tuple of :class: |
Raises:
| Type | Description |
|---|---|
FetchError
|
If XML policy (DOCTYPE/ENTITY), invalid format, or invalid limits occur. |
Source code in src/zerobom/ingest/rss.py
636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 | |
extract_article_metadata_and_text(raw_bytes, content_type, *, fallback_title='Untitled Advisory')
Extract sanitized title, plain-text body, and optional publication date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_bytes
|
bytes
|
Raw downloaded document payload. |
required |
content_type
|
str
|
Normalized HTTP Content-Type media type. |
required |
fallback_title
|
str
|
Title used when extraction yields no usable title. |
'Untitled Advisory'
|
Returns:
| Type | Description |
|---|---|
tuple[str, str, datetime | None]
|
Tuple of |
Source code in src/zerobom/ingest/fetcher.py
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 | |
extract_article_text(raw_bytes, content_type, *, fallback_title='Untitled Advisory')
Extract clean (title, body) text from fetched HTML or plain-text bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
raw_bytes
|
bytes
|
Downloaded response bytes. |
required |
content_type
|
str
|
Normalized MIME content type. |
required |
fallback_title
|
str
|
Title used when HTML lacks extractable title metadata. |
'Untitled Advisory'
|
Returns:
| Type | Description |
|---|---|
tuple[str, str]
|
Tuple of |
Source code in src/zerobom/ingest/fetcher.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
extract_known_aliases(text)
Extract normalized advisory identifiers (CVE, GHSA, ZDI, TALOS, VU#, OSV) from text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Combined article title and body text. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Deduplicated tuple of canonical advisory identifiers. |
Source code in src/zerobom/ingest/prefilter.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 | |
is_public_ip(ip_str)
Return True only when ip_str is a globally routable public IP address.
Unwraps IPv4-mapped IPv6 addresses (e.g., ::ffff:169.254.169.254) and blocks private,
loopback, link-local (cloud IMDS), multicast, reserved, and unspecified ranges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ip_str
|
str
|
IPv4 or IPv6 literal string. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
|
Source code in src/zerobom/_net.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
is_valid_advisory_alias(alias)
Validate and canonicalize a candidate advisory identifier against strict patterns.
Supports CVE-*, GHSA-*, ZDI-CAN-*, ZDI-*, TALOS-*, VU#*,
RUSTSEC-*, GO-*, and PYSEC-* identifiers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
alias
|
str
|
Candidate identifier string returned by pre-filtering or an LLM. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
Canonical identifier string if strictly valid, otherwise |
Source code in src/zerobom/ingest/prefilter.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | |
load_sources_config(path)
Load and strictly validate a sources.yaml feed allowlist using yaml.safe_load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Path | str
|
Path to the YAML sources configuration file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Validated |
SourcesConfig
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the file is missing, exceeds |
Source code in src/zerobom/ingest/rss.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | |
parse_feed_entries(feed_bytes, feed, *, max_entries=MAX_FEED_ENTRIES)
Parse RSS or Atom XML bytes into validated, deduplicated :class:FeedEntry records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feed_bytes
|
bytes
|
Raw XML bytes fetched from an RSS/Atom endpoint. |
required |
feed
|
SourceFeedConfig
|
Source feed configuration providing publisher name, tier, and optional prefix. |
required |
max_entries
|
int
|
Maximum number of entries returned from a single feed. |
MAX_FEED_ENTRIES
|
Returns:
| Type | Description |
|---|---|
tuple[FeedEntry, ...]
|
Deduplicated tuple of validated :class: |
Raises:
| Type | Description |
|---|---|
FetchError
|
If XML contains |
Source code in src/zerobom/ingest/rss.py
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
parse_html_index_entries(html_bytes, feed, *, base_url=None, max_entries=MAX_FEED_ENTRIES)
Extract same-origin prefix-filtered links from a blog HTML index page.
Resolves relative links strictly against base_url (or feed.url), requires a configured
same-origin feed.url_prefix, strips URI fragments, excludes index URLs themselves, and
deduplicates canonical URLs cleanly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
html_bytes
|
bytes
|
Raw HTML bytes of the index listing page. |
required |
feed
|
SourceFeedConfig
|
Source feed configuration specifying |
required |
base_url
|
str | None
|
Final response URL used for relative link resolution (defaults to |
None
|
max_entries
|
int
|
Maximum number of entries returned. |
MAX_FEED_ENTRIES
|
Returns:
| Type | Description |
|---|---|
tuple[FeedEntry, ...]
|
Deduplicated tuple of validated :class: |
Raises:
| Type | Description |
|---|---|
FetchError
|
If |
Source code in src/zerobom/ingest/rss.py
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 | |
parse_sitemap_entries(xml_bytes, feed, *, max_entries=MAX_FEED_ENTRIES)
Parse an XML sitemap (<urlset>) into validated, date-sorted :class:FeedEntry items.
Rejects XML DOCTYPE/ENTITY directives, applies optional feed.url_prefix filtering,
deduplicates canonical URLs, and sorts entries carrying <lastmod> newest-first prior
to enforcing max_entries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xml_bytes
|
bytes
|
Raw XML sitemap payload bytes. |
required |
feed
|
SourceFeedConfig
|
Source feed configuration providing name, tier, and optional |
required |
max_entries
|
int
|
Maximum number of entries returned. |
MAX_FEED_ENTRIES
|
Returns:
| Type | Description |
|---|---|
tuple[FeedEntry, ...]
|
Deduplicated tuple of validated :class: |
Raises:
| Type | Description |
|---|---|
FetchError
|
If XML contains DOCTYPE/ENTITY, is malformed, or |
Source code in src/zerobom/ingest/rss.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
poll_feed_items(feeds, *, fetcher, state_store=None, max_entries_per_feed=MAX_FEED_ENTRIES, mark_seen=False)
Poll enabled source endpoints and fetch new or updated articles securely.
By default (mark_seen=False), newly discovered or modified articles are NOT marked seen in
state_store until the downstream pipeline finishes processing them, preventing transient
extraction failures from permanently skipping advisories. Unchanged articles refresh HTTP
validators (ETag / Last-Modified) immediately.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feeds
|
Sequence[SourceFeedConfig]
|
Sequence of allowlisted :class: |
required |
fetcher
|
SafeHttpFetcher
|
SSRF-hardened :class: |
required |
state_store
|
IngestStateStore | None
|
Optional :class: |
None
|
max_entries_per_feed
|
int
|
Maximum entries inspected per feed poll. |
MAX_FEED_ENTRIES
|
mark_seen
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
tuple[PolledArticle, ...]
|
Tuple of :class: |
Source code in src/zerobom/ingest/rss.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 | |
poll_feed_items_isolated(feeds, *, fetcher, state_store=None, max_entries_per_feed=MAX_FEED_ENTRIES, mark_seen=False)
Poll enabled feeds with per-feed and per-entry error isolation.
Unlike :func:poll_feed_items, a network error, HTTP 4xx/5xx status, or XML policy violation on
one feed or article records a structured error and continues polling remaining feeds and items.
Tracks both discovered entry.url and resolved redirect target article.url in
state_store when refreshing validators or marking entries seen.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feeds
|
Sequence[SourceFeedConfig]
|
Sequence of allowlisted :class: |
required |
fetcher
|
SafeHttpFetcher
|
SSRF-hardened :class: |
required |
state_store
|
IngestStateStore | None
|
Optional :class: |
None
|
max_entries_per_feed
|
int
|
Maximum entries inspected per feed poll. |
MAX_FEED_ENTRIES
|
mark_seen
|
bool
|
When |
False
|
Returns:
| Type | Description |
|---|---|
tuple[tuple[PolledArticle, ...], tuple[FeedPollResult, ...], tuple[WatchItemError, ...]]
|
Tuple of |
Source code in src/zerobom/ingest/rss.py
802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 | |
poll_feeds(feeds, *, fetcher, state_store=None, max_entries_per_feed=MAX_FEED_ENTRIES, mark_seen=False)
Poll enabled feeds and return newly discovered or updated :class:RawArticle objects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feeds
|
Sequence[SourceFeedConfig]
|
Sequence of allowlisted :class: |
required |
fetcher
|
SafeHttpFetcher
|
SSRF-hardened :class: |
required |
state_store
|
IngestStateStore | None
|
Optional :class: |
None
|
max_entries_per_feed
|
int
|
Maximum entries inspected per feed poll. |
MAX_FEED_ENTRIES
|
mark_seen
|
bool
|
Whether to record unseen/changed articles immediately in |
False
|
Returns:
| Type | Description |
|---|---|
tuple[RawArticle, ...]
|
Tuple of newly discovered or content-modified :class: |
Source code in src/zerobom/ingest/rss.py
960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 | |
prefilter_article(article)
Gate out pure marketing/non-vulnerability posts deterministically before LLM calls.
Preserves disclosures mentioning newly reserved CVE- or GHSA- identifiers (since
blogs frequently publish days before NVD/OSV assigns ranges) and records them as
extracted_aliases.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
article
|
RawArticle
|
Ingested :class: |
required |
Returns:
| Name | Type | Description |
|---|---|---|
A |
PrefilterResult
|
class: |
Source code in src/zerobom/ingest/prefilter.py
339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 | |
validate_fetch_url(url, *, dns_resolver=default_dns_resolver)
Validate URL syntax, scheme, absence of credentials, and DNS-resolved IPs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url
|
str
|
Untrusted HTTP or HTTPS URL candidate. |
required |
dns_resolver
|
DnsResolver
|
Callable mapping |
default_dns_resolver
|
Returns:
| Type | Description |
|---|---|
str
|
Validated trimmed URL string. |
Raises:
| Type | Description |
|---|---|
FetchError
|
If URL syntax, scheme, credentials, or DNS resolution fails. |
SsrfBlockedError
|
If the host or any resolved IP is non-global/internal. |
Source code in src/zerobom/ingest/fetcher.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |