Skip to content

Commit c2e524e

Browse files
committed
Merge branch 'bugfix-prevent-empty-branch-push' of https://github.com/jescalada/git-proxy-security-fixes into bugfix-prevent-empty-branch-push
2 parents 6cfc66a + d7eadd8 commit c2e524e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const exec = async (req: any, action: Action): Promise<Action> => {
4242
const git = simpleGit(path);
4343
const log = await git.log({ from: action.commitFrom, to: action.commitTo });
4444

45-
action.commitData = log.all.toReversed().map((entry, i, array) => {
45+
action.commitData = [...log.all].reverse().map((entry, i, array) => {
4646
const parent = i === 0 ? action.commitFrom : array[i - 1].hash;
4747
const timestamp = Math.floor(new Date(entry.date).getTime() / 1000).toString();
4848
return {
@@ -63,14 +63,12 @@ const exec = async (req: any, action: Action): Promise<Action> => {
6363

6464
const user = action.commitData[action.commitData.length - 1].committer;
6565
action.user = user;
66-
67-
return await validateUser(user, action, step);
6866
} catch (e: any) {
6967
step.setError(e.toString('utf-8'));
7068
} finally {
7169
action.addStep(step);
7270
}
73-
return action;
71+
return await validateUser(action.user || '', action, step);
7472
};
7573

7674
exec.displayName = 'getMissingData.exec';

0 commit comments

Comments
 (0)