From a8040bc2c51605a4cca9e48cac83ff14928d50c2 Mon Sep 17 00:00:00 2001 From: Marius van der Wijden Date: Thu, 24 Mar 2022 15:04:47 +0100 Subject: [PATCH] node: allow JWT pass by file only (#24579) --- cmd/utils/flags.go | 2 +- node/node.go | 13 ++----------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 2981cd59948f..ae1e77675355 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -548,7 +548,7 @@ var ( } JWTSecretFlag = cli.StringFlag{ Name: "authrpc.jwtsecret", - Usage: "JWT secret (or path to a jwt secret) to use for authenticated RPC endpoints", + Usage: "Path to a JWT secret to use for authenticated RPC endpoints", } // Logging and debug settings EthStatsURLFlag = cli.StringFlag{ diff --git a/node/node.go b/node/node.go index 923d590576e0..7c540306db2b 100644 --- a/node/node.go +++ b/node/node.go @@ -346,17 +346,8 @@ func (n *Node) closeDataDir() { // or from the default location. If neither of those are present, it generates // a new secret and stores to the default location. func (n *Node) obtainJWTSecret(cliParam string) ([]byte, error) { - var fileName string - if len(cliParam) > 0 { - // If a plaintext secret was provided via cli flags, use that - jwtSecret := common.FromHex(cliParam) - if len(jwtSecret) == 32 && strings.HasPrefix(cliParam, "0x") { - log.Warn("Plaintext JWT secret provided, please consider passing via file") - return jwtSecret, nil - } - // path provided - fileName = cliParam - } else { + fileName := cliParam + if len(fileName) == 0 { // no path provided, use default fileName = n.ResolvePath(datadirJWTKey) }