filehost: refuse to sign upload tokens when filehost_jwt_secret is unset/empty/"changeme" — the default fell open, signing with a world-known key so anyone could forge a server-trusted upload authorization; now it fails closed and tells the user to fix the config
This commit is contained in:
parent
a09dfc74df
commit
d9d5bd069b
1 changed files with 14 additions and 4 deletions
|
|
@ -201,10 +201,20 @@ impl Command for FileHostCmd {
|
|||
}
|
||||
};
|
||||
|
||||
let secret = s
|
||||
.conf("filehost_jwt_secret")
|
||||
.unwrap_or("changeme")
|
||||
.to_string();
|
||||
// Fail closed: signing upload tokens with a missing/placeholder secret
|
||||
// would let anyone forge a server-trusted upload authorization.
|
||||
let secret = match s.conf("filehost_jwt_secret") {
|
||||
Some(sec) if !sec.is_empty() && sec != "changeme" => sec.to_string(),
|
||||
_ => {
|
||||
note(
|
||||
s,
|
||||
uid,
|
||||
"FILEHOST: file hosting is misconfigured (no upload secret set). \
|
||||
Please tell an operator.",
|
||||
);
|
||||
return CmdResult::Fail;
|
||||
}
|
||||
};
|
||||
let issuer = s
|
||||
.conf("filehost_jwt_issuer")
|
||||
.unwrap_or("FILEHOST")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue