File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
internal/tools/update-readme Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 55 "fmt"
66 "maps"
77 "os"
8+ "path/filepath"
89 "slices"
910 "strings"
1011
@@ -25,7 +26,14 @@ func (o *OpenShift) IsOpenShift(ctx context.Context) bool {
2526var _ internalk8s.Openshift = (* OpenShift )(nil )
2627
2728func main () {
28- readme , err := os .ReadFile (os .Args [1 ])
29+ // Snyk reports false positive unless we flow the args through filepath.Clean and filepath.Localize in this specific order
30+ var err error
31+ localReadmePath := filepath .Clean (os .Args [1 ])
32+ localReadmePath , err = filepath .Localize (localReadmePath )
33+ if err != nil {
34+ panic (err )
35+ }
36+ readme , err := os .ReadFile (localReadmePath )
2937 if err != nil {
3038 panic (err )
3139 }
@@ -81,7 +89,7 @@ func main() {
8189 toolsetTools .String (),
8290 )
8391
84- if err := os .WriteFile (os . Args [ 1 ] , []byte (updated ), 0o644 ); err != nil {
92+ if err := os .WriteFile (localReadmePath , []byte (updated ), 0o644 ); err != nil {
8593 panic (err )
8694 }
8795}
You can’t perform that action at this time.
0 commit comments