Commit b6006edb authored by Max Kanat-Alexander's avatar Max Kanat-Alexander

Bug 617030 - Add an error code for json_rpc_invalid_callback, and fix the

regex used by _bz_callback in Bugzilla::WebService::Server::JSONRPC to accept numbers other than 0 or 1. r=LpSolit, a=mkanat
parent b82f8f68
...@@ -135,6 +135,7 @@ use constant WS_ERROR_CODE => { ...@@ -135,6 +135,7 @@ use constant WS_ERROR_CODE => {
xmlrpc_invalid_value => -32600, xmlrpc_invalid_value => -32600,
unknown_method => -32601, unknown_method => -32601,
json_rpc_post_only => 32610, json_rpc_post_only => 32610,
json_rpc_invalid_callback => 32611,
}; };
# These are the fallback defaults for errors not in ERROR_CODE. # These are the fallback defaults for errors not in ERROR_CODE.
......
...@@ -381,7 +381,7 @@ sub _bz_callback { ...@@ -381,7 +381,7 @@ sub _bz_callback {
if (defined $value) { if (defined $value) {
$value = trim($value); $value = trim($value);
# We don't use \w because we don't want to allow Unicode here. # We don't use \w because we don't want to allow Unicode here.
if ($value !~ /^[A-Za-z0-1_\.\[\]]+$/) { if ($value !~ /^[A-Za-z0-9_\.\[\]]+$/) {
ThrowUserError('json_rpc_invalid_callback', { callback => $value }); ThrowUserError('json_rpc_invalid_callback', { callback => $value });
} }
$self->{_bz_callback} = $value; $self->{_bz_callback} = $value;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment