From 63548a63e1b240dd8c254b1153d9b78e84082cc9 Mon Sep 17 00:00:00 2001 From: Levi Durfee Date: Wed, 7 Jan 2026 14:11:55 -0500 Subject: Clean filepaths --- cmd/goaes/commands/decrypt.go | 2 ++ cmd/goaes/commands/encrypt.go | 2 ++ 2 files changed, 4 insertions(+) (limited to 'cmd/goaes/commands') diff --git a/cmd/goaes/commands/decrypt.go b/cmd/goaes/commands/decrypt.go index 1912c1a..a590f47 100644 --- a/cmd/goaes/commands/decrypt.go +++ b/cmd/goaes/commands/decrypt.go @@ -5,6 +5,7 @@ import ( "encoding/gob" "log/slog" "os" + "path/filepath" "github.com/nerdsec/goaes/internal" "github.com/urfave/cli/v3" @@ -14,6 +15,7 @@ func Decrypt(ctx context.Context, cmd *cli.Command) error { source := cmd.String("source") destination := cmd.String("destination") + source = filepath.Clean(source) file, err := os.Open(source) if err != nil { return err diff --git a/cmd/goaes/commands/encrypt.go b/cmd/goaes/commands/encrypt.go index c658780..b50ef97 100644 --- a/cmd/goaes/commands/encrypt.go +++ b/cmd/goaes/commands/encrypt.go @@ -5,6 +5,7 @@ import ( "context" "encoding/gob" "os" + "path/filepath" "github.com/nerdsec/goaes/internal" "github.com/urfave/cli/v3" @@ -14,6 +15,7 @@ func Encrypt(ctx context.Context, cmd *cli.Command) error { source := cmd.String("source") destination := cmd.String("destination") + source = filepath.Clean(source) plaintext, err := os.ReadFile(source) if err != nil { return err -- cgit v1.2.3