Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Do not write or update sessions or their cookies for API access

Oliver Günther64d545d8abad
diff --git a/lib/api/root_api.rb b/lib/api/root_api.rb
index 60ed908f792..59ef9f4ed17 100644
--- a/lib/api/root_api.rb
+++ b/lib/api/root_api.rb
@@ -90,6 +90,12 @@ module API
%w(application/json application/hal+json)
end
+ # Prevent committing the session
+ # This prevents an unnecessary write when accessing the API
+ def skip_session_write
+ request.session_options[:skip] = true
+ end
+
def enforce_content_type
# Content-Type is not present in GET or DELETE requests
return if request.get? || request.delete?
@@ -328,6 +334,7 @@ module API
authenticate
set_localization
enforce_content_type
+ skip_session_write
::OpenProject::Appsignal.tag_request(request:)
end
end