mainframe.endpoints.opengrep¶
Staging-only OpenGrep shadow queue and result endpoints.
Attributes¶
Functions¶
|
Hide the shadow API unless staging explicitly enables it. |
|
Return the reviewed OpenGrep corpus without exposing YARA rules. |
|
Fail expired shadow leases after the configured attempt budget. |
|
Create idempotent shadow work only for a package selected for alerting. |
|
Lease OpenGrep work without consuming the canonical YARA queue. |
|
Store a leased shadow result without changing the canonical scan. |
Atomically lease completed shadow results to one publisher. |
|
Return a matching terminal publication lease or raise a safe conflict. |
|
|
Persist monotonic Discord thread progress for retry-safe resumption. |
|
Renew an active publication lease without changing its progress. |
Acknowledge publication only after the complete Discord thread exists. |
Module Contents¶
- mainframe.endpoints.opengrep.require_opengrep_shadow() None[source]¶
Hide the shadow API unless staging explicitly enables it.
- mainframe.endpoints.opengrep.get_opengrep_rules(state: Annotated[mainframe.rules.Rules, Depends(get_rules)]) mainframe.models.schemas.GetRules[source]¶
Return the reviewed OpenGrep corpus without exposing YARA rules.
- mainframe.endpoints.opengrep.dead_letter_expired_shadow_scans(session: sqlalchemy.orm.Session, *, retry_before: datetime.datetime, now: datetime.datetime) None[source]¶
Fail expired shadow leases after the configured attempt budget.
- mainframe.endpoints.opengrep.queue_opengrep_alert(package: mainframe.models.schemas.OpenGrepAlert, session: Database, auth: Authenticated) mainframe.models.schemas.QueuePackageResponse[source]¶
Create idempotent shadow work only for a package selected for alerting.
- mainframe.endpoints.opengrep.get_opengrep_jobs(session: Database, auth: Authenticated, state: Annotated[mainframe.rules.Rules, Depends(get_rules)], batch: Annotated[int, Query(ge=1, le=100)] = 1) list[mainframe.models.schemas.JobResult][source]¶
Lease OpenGrep work without consuming the canonical YARA queue.
- mainframe.endpoints.opengrep.submit_opengrep_result(result: mainframe.models.schemas.OpenGrepScanResult | mainframe.models.schemas.OpenGrepScanResultFail, session: Database, auth: Authenticated) None[source]¶
Store a leased shadow result without changing the canonical scan.
- mainframe.endpoints.opengrep.get_unpublished_opengrep_results(session: Database, limit: Annotated[int, Query(ge=1, le=100)] = 20) list[mainframe.models.schemas.OpenGrepResult][source]¶
Atomically lease completed shadow results to one publisher.
- mainframe.endpoints.opengrep.require_publication_claim(shadow: mainframe.models.orm.OpenGrepScan | None, publication_id: uuid.UUID) mainframe.models.orm.OpenGrepScan[source]¶
Return a matching terminal publication lease or raise a safe conflict.
- mainframe.endpoints.opengrep.checkpoint_opengrep_publication(scan_id: uuid.UUID, progress: mainframe.models.schemas.OpenGrepPublicationProgress, session: Database) None[source]¶
Persist monotonic Discord thread progress for retry-safe resumption.
- mainframe.endpoints.opengrep.heartbeat_opengrep_publication(scan_id: uuid.UUID, claim: mainframe.models.schemas.OpenGrepPublicationClaim, session: Database) None[source]¶
Renew an active publication lease without changing its progress.
- mainframe.endpoints.opengrep.acknowledge_opengrep_result(scan_id: uuid.UUID, claim: mainframe.models.schemas.OpenGrepPublicationClaim, session: Database) mainframe.models.schemas.OpenGrepPublished[source]¶
Acknowledge publication only after the complete Discord thread exists.