Fix potential log panic #82

Merged
Zettat123 merged 1 commits from bugfix/log-panic into main 2023-03-28 03:49:10 +00:00
Zettat123 commented 2023-03-27 09:18:42 +00:00 (Migrated from gitea.com)

If a job uses a reusable workflow, the job's steps sequence will be empty.

But in log reporter, we don't check the length of r.state.Steps, which may cause panic.

if v, ok := entry.Data["stepNumber"]; ok {
	if v, ok := v.(int); ok {
		step = r.state.Steps[v]
	}
}
If a job uses a [reusable workflow](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-of-jobsjob_iduses), the job's steps sequence will be empty. But in log reporter, we don't check the length of `r.state.Steps`, which may cause panic. ``` go if v, ok := entry.Data["stepNumber"]; ok { if v, ok := v.(int); ok { step = r.state.Steps[v] } } ```
lunny commented 2023-03-27 12:35:49 +00:00 (Migrated from gitea.com)

Should this be sent upstream?

Should this be sent upstream?
lunny (Migrated from gitea.com) approved these changes 2023-03-27 12:36:03 +00:00
Zettat123 commented 2023-03-28 01:27:50 +00:00 (Migrated from gitea.com)

Should this be sent upstream?

I don't think so. Because this bug only exists in the logger of act_runner, not in act.

> Should this be sent upstream? I don't think so. Because this bug only exists in the logger of `act_runner`, not in `act`.
Sign in to join this conversation.