@@ -12,6 +12,7 @@ use crate::audit::AuditError;
1212use crate :: config:: Config ;
1313use crate :: finding:: location:: Locatable as _;
1414use crate :: finding:: { Confidence , Finding , Severity } ;
15+ use crate :: models:: StepCommon ;
1516use crate :: models:: { workflow:: JobExt as _, workflow:: Step } ;
1617use crate :: state:: AuditState ;
1718use crate :: utils;
@@ -383,8 +384,8 @@ impl Audit for GitHubEnv {
383384 if let StepBody :: Run { run, .. } = & step. deref ( ) . body {
384385 let shell = step. shell ( ) . unwrap_or_else ( || {
385386 tracing:: warn!(
386- "github-env: couldn't determine shell type for {workflow}:{job} step {stepno}" ,
387- workflow = step. workflow( ) . key. filename ( ) ,
387+ "github-env: couldn't determine shell type for {workflow}:{job} step {stepno}; assuming bash " ,
388+ workflow = step. workflow( ) . key. presentation_path ( ) ,
388389 job = step. parent. id( ) ,
389390 stepno = step. index
390391 ) ;
@@ -423,10 +424,23 @@ impl Audit for GitHubEnv {
423424 ) -> Result < Vec < Finding < ' doc > > , AuditError > {
424425 let mut findings = vec ! [ ] ;
425426
426- let action:: StepBody :: Run { run, shell , .. } = & step. body else {
427+ let action:: StepBody :: Run { run, .. } = & step. body else {
427428 return Ok ( findings) ;
428429 } ;
429430
431+ let shell = step. shell ( ) . unwrap_or_else ( || {
432+ tracing:: warn!(
433+ "github-env: couldn't determine shell type for {action} step {stepno}; assuming bash" ,
434+ action = step. action( ) . key. presentation_path( ) ,
435+ stepno = step. index
436+ ) ;
437+
438+ // The only way shell inference can fail for a `run:` in a
439+ // composition action is if a user specifies an expression instead
440+ // of a string literal. In that case, assume bash.
441+ "bash"
442+ } ) ;
443+
430444 // TODO: actually use the spanning information here.
431445 for ( dest, _span) in self . uses_github_env ( run, shell) ? {
432446 findings. push (
0 commit comments