Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions pkg/workflow/update_project_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package workflow
import (
"encoding/json"
"fmt"
"strings"
)

// buildUpdateProjectJob creates the update_project job
Expand Down Expand Up @@ -45,11 +44,8 @@ func (c *Compiler) buildUpdateProjectJob(data *WorkflowData, mainJobName string)
if err != nil {
return nil, fmt.Errorf("failed to marshal views configuration: %w", err)
}
// Escape single quotes in JSON to prevent shell injection
// Replace backslashes first, then single quotes
escapedJSON := strings.ReplaceAll(string(viewsJSON), `\`, `\\`)
escapedJSON = strings.ReplaceAll(escapedJSON, `'`, `'\''`)
customEnvVars = append(customEnvVars, fmt.Sprintf(" GH_AW_PROJECT_VIEWS: '%s'\n", escapedJSON))
// Use %q to properly quote and escape the JSON for YAML
customEnvVars = append(customEnvVars, fmt.Sprintf(" GH_AW_PROJECT_VIEWS: %q\n", string(viewsJSON)))
}

jobCondition := BuildSafeOutputType("update_project")
Expand Down