-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace busybox with internal copy binary and resolve CVEs.
Replace the busybox image. Bump Golang version to v1.20.3. Resolve CVEs. Signed-off-by: Xun Jiang <[email protected]>
- Loading branch information
Xun Jiang
committed
Apr 15, 2023
1 parent
2a00655
commit d4ca602
Showing
7 changed files
with
147 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Replace busybox with internal copy binary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
"io" | ||
"os" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) != 3 { | ||
fmt.Println( | ||
`Error: This command requires two arguments. | ||
Usage: cp-plugin src dst`) | ||
os.Exit(1) | ||
} | ||
src, dst := os.Args[1], os.Args[2] | ||
fmt.Printf("Copying %s to %s ... ", src, dst) | ||
srcFile, err := os.Open(src) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer srcFile.Close() | ||
if _, err := os.Stat(dst); errors.Is(err, os.ErrNotExist) { | ||
_, err = os.Create(dst) | ||
if err != nil { | ||
panic(err) | ||
} | ||
} | ||
dstFile, err := os.OpenFile(dst, os.O_WRONLY, 0755) | ||
if err != nil { | ||
panic(err) | ||
} | ||
defer dstFile.Close() | ||
buf := make([]byte, 1024*128) | ||
_, err = io.CopyBuffer(dstFile, srcFile, buf) | ||
if err != nil { | ||
panic(err) | ||
} | ||
os.Chmod(dst, 0755) | ||
fmt.Println("done.") | ||
} |