Skip to content

Commit c6b941f

Browse files
authored
Merge pull request #48 from GitGuardian/alina/include-incident-url
feat(api): parse incident_url from the multiscan endpoint
2 parents 655b88e + e158f47 commit c6b941f

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Removed
9+
10+
- A bullet item for the Removed category.
11+
12+
-->
13+
14+
### Added
15+
16+
- PolicyBreak now includes the URL of the policy break if the dashboard already knows about it.
17+
18+
<!--
19+
### Changed
20+
21+
- A bullet item for the Deprecated category.
22+
23+
-->
24+
25+
<!--
26+
### Deprecated
27+
28+
- A bullet item for the Deprecated category.
29+
30+
-->
31+
<!--
32+
### Fixed
33+
34+
- A bullet item for the Fixed category.
35+
36+
-->
37+
<!--
38+
### Security
39+
40+
- A bullet item for the Security category.
41+
42+
-->

pygitguardian/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ class PolicyBreakSchema(BaseSchema):
206206
policy = fields.String(required=True)
207207
validity = fields.String(required=False, load_default=None, dump_default=None)
208208
known_secret = fields.Boolean(required=False, load_default=False, dump_default=None)
209+
incident_url = fields.String(required=False, load_default=False, dump_default=None)
209210
matches = fields.List(fields.Nested(MatchSchema), required=True)
210211

211212
@post_load
@@ -230,13 +231,15 @@ def __init__(
230231
validity: str,
231232
matches: List[Match],
232233
known_secret: bool = False,
234+
incident_url: Optional[str] = None,
233235
**kwargs: Any,
234236
) -> None:
235237
super().__init__()
236238
self.break_type = break_type
237239
self.policy = policy
238240
self.validity = validity
239241
self.known_secret = known_secret
242+
self.incident_url = incident_url
240243
self.matches = matches
241244

242245
@property

tests/test_models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,18 @@ def test_document_handle_surrogates(self):
9191
"matches": [{"match": "hello", "type": "hello"}],
9292
},
9393
),
94+
(
95+
PolicyBreakSchema,
96+
PolicyBreak,
97+
{
98+
"type": "hello",
99+
"policy": "hello",
100+
"validity": "hey",
101+
"known_secret": True,
102+
"incident_url": "https://api.gitguardian.com/workspace/2/incidents/3",
103+
"matches": [{"match": "hello", "type": "hello"}],
104+
},
105+
),
94106
(
95107
QuotaSchema,
96108
Quota,

0 commit comments

Comments
 (0)