Skip to content

Commit cfcba63

Browse files
MariusVanDerWijdenJacek Glen
authored and
Jacek Glen
committed
node: allow JWT pass by file only (ethereum#24579)
1 parent b88cba4 commit cfcba63

File tree

2 files changed

+3
-12
lines changed

2 files changed

+3
-12
lines changed

cmd/utils/flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ var (
548548
}
549549
JWTSecretFlag = cli.StringFlag{
550550
Name: "authrpc.jwtsecret",
551-
Usage: "JWT secret (or path to a jwt secret) to use for authenticated RPC endpoints",
551+
Usage: "Path to a JWT secret to use for authenticated RPC endpoints",
552552
}
553553
// Logging and debug settings
554554
EthStatsURLFlag = cli.StringFlag{

node/node.go

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,8 @@ func (n *Node) closeDataDir() {
346346
// or from the default location. If neither of those are present, it generates
347347
// a new secret and stores to the default location.
348348
func (n *Node) obtainJWTSecret(cliParam string) ([]byte, error) {
349-
var fileName string
350-
if len(cliParam) > 0 {
351-
// If a plaintext secret was provided via cli flags, use that
352-
jwtSecret := common.FromHex(cliParam)
353-
if len(jwtSecret) == 32 && strings.HasPrefix(cliParam, "0x") {
354-
log.Warn("Plaintext JWT secret provided, please consider passing via file")
355-
return jwtSecret, nil
356-
}
357-
// path provided
358-
fileName = cliParam
359-
} else {
349+
fileName := cliParam
350+
if len(fileName) == 0 {
360351
// no path provided, use default
361352
fileName = n.ResolvePath(datadirJWTKey)
362353
}

0 commit comments

Comments
 (0)