Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions git/objects/commit.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
from io import BytesIO
import logging
import os
import re
from subprocess import Popen, PIPE
from time import altzone, daylight, localtime, time, timezone
import warnings
Expand Down Expand Up @@ -964,12 +963,21 @@ def co_authors(self) -> List[Actor]:
co_authors = []

if self.message:
results = re.findall(
r"^Co-authored-by: (.*) <(.*?)>$",
str(self.message),
re.MULTILINE,
)
for author in results:
co_authors.append(Actor(*author))
# Scan line by line instead of matching `(.*) <(.*?)>` across the whole
# message. On a single trailer line that repeats " <" without ever closing
# a ">", greedy backtracking over each " <" made the regex run in O(n^2)
# time, so a large (fully attacker-controlled) commit message could stall