Merge pull request #1309 from griznog/sanitize-wwclient-url-data

sanitize wwclient url data
This commit is contained in:
Jonathon Anderson
2024-08-02 10:50:26 -06:00
committed by GitHub
2 changed files with 3 additions and 1 deletions

View File

@@ -45,6 +45,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Ensure autobuilt overlays include contextual overlay contents. #1296 - Ensure autobuilt overlays include contextual overlay contents. #1296
- Fix the failure when updating overlay files existing on different partitions. #1312 - Fix the failure when updating overlay files existing on different partitions. #1312
- Escape asset tag for `wwclient` query strings when pulling runtime overlays. #1310
## v4.5.5, 2024-07-05 ## v4.5.5, 2024-07-05

View File

@@ -6,6 +6,7 @@ import (
"log" "log"
"net" "net"
"net/http" "net/http"
"net/url"
"os" "os"
"os/exec" "os/exec"
"os/signal" "os/signal"
@@ -132,7 +133,7 @@ func CobraRunE(cmd *cobra.Command, args []string) (err error) {
if tag == "Unknown" { if tag == "Unknown" {
dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output() dmiOut, err := exec.Command("dmidecode", "-s", "chassis-asset-tag").Output()
if err == nil { if err == nil {
chassisAssetTag := strings.TrimSpace(string(dmiOut)) chassisAssetTag := url.QueryEscape(strings.TrimSpace(string(dmiOut)))
if chassisAssetTag != "" { if chassisAssetTag != "" {
tag = chassisAssetTag tag = chassisAssetTag
} }