-
Notifications
You must be signed in to change notification settings - Fork 191
kola: add --no-ignition flag to run tests without ignition #4469
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -70,12 +70,30 @@ func (qc *Cluster) NewMachineWithQemuOptions(userdata *conf.UserData, options pl | |
| // NOTE: escaping is not supported | ||
| qc.mu.Lock() | ||
|
|
||
| conf, err := qc.RenderUserData(userdata, map[string]string{}) | ||
| if err != nil { | ||
| noIgnition := qc.RuntimeConf().NoIgnition | ||
| var conf *conf.Conf | ||
| var confPath string | ||
| var err error | ||
| if noIgnition { | ||
|
|
||
| qc.mu.Unlock() | ||
| return nil, err | ||
| } else { | ||
| conf, err = qc.RenderUserData(userdata, map[string]string{}) | ||
| if err != nil { | ||
| qc.mu.Unlock() | ||
| return nil, err | ||
| } | ||
| qc.mu.Unlock() | ||
|
|
||
| if conf.IsIgnition() { | ||
| confPath = filepath.Join(dir, "ignition.json") | ||
| if err := conf.WriteFile(confPath); err != nil { | ||
| return nil, err | ||
| } | ||
| } else if !conf.IsEmpty() { | ||
| return nil, fmt.Errorf("qemu only supports Ignition or empty configs") | ||
| } | ||
| } | ||
|
Comment on lines
71
to
96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This block for handling Ignition is a bit complex and hard to follow due to the locking and branching. It can be simplified by restructuring the noIgnition := qc.RuntimeConf().NoIgnition
var conf *conf.Conf
var confPath string
var err error
if !noIgnition {
qc.mu.Lock()
conf, err = qc.RenderUserData(userdata, map[string]string{})
qc.mu.Unlock()
if err != nil {
return nil, err
}
if conf.IsIgnition() {
confPath = filepath.Join(dir, "ignition.json")
if err := conf.WriteFile(confPath); err != nil {
return nil, err
}
} else if !conf.IsEmpty() {
return nil, fmt.Errorf("qemu only supports Ignition or empty configs")
}
} |
||
| qc.mu.Unlock() | ||
|
|
||
| journal, err := platform.NewJournal(dir) | ||
| if err != nil { | ||
|
|
@@ -94,24 +112,15 @@ func (qc *Cluster) NewMachineWithQemuOptions(userdata *conf.UserData, options pl | |
| builder.Pdeathsig = false | ||
| } | ||
|
|
||
| if qc.flight.opts.SecureExecution { | ||
| if !noIgnition && qc.flight.opts.SecureExecution { | ||
| if err := builder.SetSecureExecution(qc.flight.opts.SecureExecutionIgnitionPubKey, qc.flight.opts.SecureExecutionHostKey, conf); err != nil { | ||
| return nil, err | ||
| } | ||
| } | ||
|
|
||
| var confPath string | ||
| if conf.IsIgnition() { | ||
| confPath = filepath.Join(dir, "ignition.json") | ||
| if err := conf.WriteFile(confPath); err != nil { | ||
| return nil, err | ||
| } | ||
| } else if conf.IsEmpty() { | ||
| } else { | ||
| return nil, fmt.Errorf("qemu only supports Ignition or empty configs") | ||
| if !noIgnition { | ||
| builder.ConfigFile = confPath | ||
| } | ||
|
|
||
| builder.ConfigFile = confPath | ||
| defer builder.Close() | ||
| builder.UUID = qm.id | ||
| if qc.flight.opts.Arch != "" { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
SSHUsercommand-line flag is written directly into thessh-configfile without sanitization. An attacker who can control the command-line arguments tokolacan inject arbitrary SSH configuration options by including newlines in theSSHUserstring. This can lead to arbitrary command execution if thessh-configfile is used by the user or another tool (e.g., viaProxyCommand).