comparison OrthancServer/Sources/OrthancRestApi/OrthancRestSystem.cpp @ 5200:f8f1c4a9a216

New configuration option 'RestApiWriteToFileSystemEnabled'
author Alain Mazy <am@osimis.io>
date Wed, 29 Mar 2023 11:23:37 +0200
parents 0ea402b4d901
children 08e0c9c0ab39
comparison
equal deleted inserted replaced
5195:32df369198ac 5200:f8f1c4a9a216
257 { 257 {
258 call.GetDocumentation() 258 call.GetDocumentation()
259 .SetTag("System") 259 .SetTag("System")
260 .SetSummary("Execute Lua script") 260 .SetSummary("Execute Lua script")
261 .SetDescription("Execute the provided Lua script by the Orthanc server. This is very insecure for " 261 .SetDescription("Execute the provided Lua script by the Orthanc server. This is very insecure for "
262 "Orthanc servers that are remotely accessible, cf. configuration option `ExecuteLuaEnabled`") 262 "Orthanc servers that are remotely accessible. Since Orthanc 1.5.8, this route "
263 "is disabled by default and can be enabled thanks to the `ExecuteLuaEnabled` configuration.")
263 .AddRequestType(MimeType_PlainText, "The Lua script to be executed") 264 .AddRequestType(MimeType_PlainText, "The Lua script to be executed")
264 .AddAnswerType(MimeType_PlainText, "Output of the Lua script"); 265 .AddAnswerType(MimeType_PlainText, "Output of the Lua script");
265 return; 266 return;
266 } 267 }
267 268
268 ServerContext& context = OrthancRestApi::GetContext(call); 269 ServerContext& context = OrthancRestApi::GetContext(call);
269 270
270 if (!context.IsExecuteLuaEnabled()) 271 if (!context.IsExecuteLuaEnabled())
271 { 272 {
272 LOG(ERROR) << "The URI /tools/execute-script is disallowed for security, " 273 LOG(ERROR) << "The URI /tools/execute-script is disallowed for security, "
273 << "check your configuration file"; 274 << "check your configuration option `ExecuteLuaEnabled`";
274 call.GetOutput().SignalError(HttpStatus_403_Forbidden); 275 call.GetOutput().SignalError(HttpStatus_403_Forbidden);
275 return; 276 return;
276 } 277 }
277 278
278 std::string result; 279 std::string result;