Coverage for /usr/local/lib/python3.10/site-packages/opal_common-0.0.0-py3.10.egg/opal_common/schemas/webhook.py: 100%
16 statements
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 11:54 +0000
« prev ^ index » next coverage.py v7.15.2, created at 2026-10-10 11:54 +0000
1import typing
2from enum import Enum
3from typing import Union
5from opal_common.schemas.policy import BaseSchema
6from pydantic import Field
9class SecretTypeEnum(str, Enum):
10 """Is the passed secret in the webhook a token or a signature on the
11 request body."""
13 token = "token"
14 signature = "signature"
17class GitWebhookRequestParams(BaseSchema):
18 secret_header_name: str = Field(
19 ...,
20 description="The HTTP header holding the secret",
21 )
22 secret_type: SecretTypeEnum = Field(
23 ...,
24 description=SecretTypeEnum.__doc__,
25 )
26 secret_parsing_regex: str = Field(
27 ...,
28 description="The regex used to parse out the actual signature from the header. Use '(.*)' for the entire value",
29 )
30 event_header_name: typing.Optional[str] = Field(
31 default=None,
32 description="The HTTP header holding the event information (used instead of event_request_key)",
33 )
34 event_request_key: typing.Optional[str] = Field(
35 default=None,
36 description="The JSON object key holding the event information (used instead of event_header_name)",
37 )
38 push_event_value: str = Field(
39 ...,
40 description="The event value indicating a Git push",
41 )
42 match_sender_url: bool = Field(
43 True,
44 description="Should OPAL verify that the sender url matches the tracked repo URL, and drop the webhook request otherwise?",
45 )