Skip to content

Commit ad24af3

Browse files
committed
fix(ssh): use authenticated user identity from transport layer in parsePush
1 parent aee9788 commit ad24af3

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/proxy/processors/push-action/parsePush.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,18 @@ async function exec(req: any, action: Action): Promise<Action> {
9191
action.commitFrom = action.commitData[action.commitData.length - 1].parent;
9292
}
9393

94-
const { committer, committerEmail } = action.commitData[action.commitData.length - 1];
95-
console.log(`Push Request received from user ${committer} with email ${committerEmail}`);
96-
action.user = committer;
97-
action.userEmail = committerEmail;
94+
if (req.user) {
95+
console.log(
96+
`Push Request received from user ${req.user.username} with email ${req.user.email}`,
97+
);
98+
action.user = req.user.username;
99+
action.userEmail = req.user.email;
100+
} else {
101+
const { committer, committerEmail } = action.commitData[action.commitData.length - 1];
102+
console.log(`Push Request received from user ${committer} with email ${committerEmail}`);
103+
action.user = committer;
104+
action.userEmail = committerEmail;
105+
}
98106
}
99107

100108
step.content = {

0 commit comments

Comments
 (0)