Skip to content

Commit 021e513

Browse files
committed
fix: add check for refUpdates parts valid length
1 parent 7095771 commit 021e513

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ async function exec(req: any, action: Action): Promise<Action> {
5454
}
5555

5656
const parts = refUpdates[0].split(' ');
57+
if (parts.length !== 3) {
58+
step.log('Invalid number of parts in ref update.');
59+
step.log(`Expected 3, but got ${parts.length}`);
60+
step.setError('Your push has been blocked. Invalid ref update format.');
61+
action.addStep(step);
62+
return action;
63+
}
64+
5765
const [oldCommit, newCommit, ref] = parts;
5866

5967
action.branch = ref.replace(/\0.*/, '').trim();

0 commit comments

Comments
 (0)