mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: potential file inclusion via variable
This commit is contained in:
@@ -418,7 +418,7 @@ func TestLoadImage(t *testing.T) {
|
||||
// loadImage loads image and returns base64 encoded string
|
||||
func loadImage(imagePath string) (base64Str string, size types.Size, err error) {
|
||||
// Read the image file
|
||||
imageFile, err := os.Open(imagePath)
|
||||
imageFile, err := os.OpenFile(imagePath, os.O_RDONLY, 0o666)
|
||||
if err != nil {
|
||||
return "", types.Size{}, fmt.Errorf("failed to open image file: %w", err)
|
||||
}
|
||||
|
||||
@@ -701,7 +701,7 @@ func (ad *ADBDriver) StopCaptureLog() (result interface{}, err error) {
|
||||
return pointRes, nil
|
||||
}
|
||||
|
||||
reader, err := os.Open(files[0])
|
||||
reader, err := os.OpenFile(files[0], os.O_RDONLY, 0o666)
|
||||
if err != nil {
|
||||
log.Info().Msg("open File error")
|
||||
return pointRes, nil
|
||||
|
||||
@@ -970,7 +970,7 @@ func (wd *WDADriver) StartCaptureLog(identifier ...string) error {
|
||||
|
||||
func (wd *WDADriver) PushImage(localPath string) error {
|
||||
log.Info().Str("localPath", localPath).Msg("WDADriver.PushImage")
|
||||
localFile, err := os.Open(localPath)
|
||||
localFile, err := os.OpenFile(localPath, os.O_RDONLY, 0o666)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user