Bug#968971: gitlab: Can't create new project: undefined method `set_attribute_was'

2020-10-03 Thread Antoine Le Gonidec

Here I am running 13.2.8-1+fto10+2 on top of a Debian Buster, following the recommended 
"FastTrack" installation method.

I get a similar error related to a missing "set_attribute_was" method when 
trying to add a new push mirror to an existing repository.

The only mentions I found of this method are in the following packages:
- ruby-acts-as-taggable-on: 
/usr/lib/ruby/vendor_ruby/acts_as_taggable_on/taggable/core.rb
- ruby-attr-encrypted: 
/usr/lib/ruby/vendor_ruby/attr_encrypted/adapters/active_record.rb

Both are installed from Buster backports:
- ruby-acts-as-taggable-on: 6.5.0-2~bpo10+1
- ruby-attr-encrypted: 3.1.0-2~bpo10+1

The method "set_attribute_was" used to be provided by ruby-activemodel in its 
5.* version (Buster and official Buster backports), but is not part of the 6.* version 
(FastTrack-provided backports).

If I remove the calls to "set_attribute_was" from the two listed .rb files and 
restart the gitlab service, I no longer get the crash on addition of a new push mirror. I 
attached the edited source files to this e-mail for testing purposes, but keep in mind 
that I am not a Ruby developer, I only removed some part of the scripts without worrying 
about the consequences. If you use these edited files without a careful review, things 
are expected to break in unexpected ways ;)


gitlab-set_attribute_was-crash-fixed-source-files.tar.xz
Description: application/xz


OpenPGP_0x4E34F6017289428A.asc
Description: application/pgp-keys


OpenPGP_signature
Description: OpenPGP digital signature


Bug#968971: gitlab: Can't create new project: undefined method `set_attribute_was' for #

2020-08-24 Thread Fabrice Meyer
Package: gitlab
Version: 13.2.6-1+fto10+1
Severity: important
Tags: upstream

Dear Maintainer,

Since I upgraded from 12.2.9-1+fto10+2 to 13.1 and then to 13.2.6-1+fto10+1 I 
ran into several issue leading to the same error type: "undefined method 
`set_attribute_was'".

When I try to create a new project, I end up with the following error inside 
production.log.
I tried to disable jira itegration as it is obviously linked to the root cause 
but I also end up on a error 500 (following the first stacktrace)

Finally I also experiment this kind of issue while trying to set Ci variables: 
"undefined method `set_attribute_was' for #" (last stacktrace)

Hope this while help to fix these issues.


Processing by Gitlab::RequestForgeryProtection::Controller#index as HTML
  Parameters: {"project"=>"florian.galati/ansible.git", "changes"=>"_any", 
"protocol"=>"ssh", "key_id"=>"99", "check_ip"=>"192.168.1.102", 
"request_forgery_protection"=>{"action"=>"git-receive-pack", 
"project"=>"florian.galati/ansible.git", "changes"=>"_any", "protocol"=>"ssh", 
"key_id"=>"99", "check_ip"=>"192.168.1.102"}}
Can't verify CSRF token authenticity.
This CSRF token verification failure is handled internally by 
`GitLab::RequestForgeryProtection`
Unlike the logs may suggest, this does not result in an actual 422 response to 
the user
For API requests, the only effect is that `current_user` will be `nil` for the 
duration of the request
Completed 422 Unprocessable Entity in 1ms (ActiveRecord: 0.0ms | Elasticsearch: 
0.0ms | Allocations: 212)

Gitlab::GitAccessProject::CreationError (Could not create project: undefined 
method `set_attribute_was' for #):
  /usr/share/gitlab/lib/gitlab/git_access_project.rb:35:in 
`ensure_project_on_push!'
  /usr/share/gitlab/lib/gitlab/git_access_project.rb:13:in `check_project!'
  /usr/share/gitlab/lib/gitlab/git_access.rb:77:in `check'
  /usr/share/gitlab/lib/api/internal/base.rb:90:in `access_check!'
  /usr/share/gitlab/lib/api/internal/base.rb:44:in `check_allowed'
  /usr/share/gitlab/lib/api/internal/base.rb:116:in `block (2 levels) in 
'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:59:in `call'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:59:in `block (2 levels) in 
generate_api_method'
  
/usr/share/rubygems-integration/all/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:182:in
 `instrument'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:58:in `block in 
generate_api_method'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:341:in `execute'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:267:in `block in run'
  
/usr/share/rubygems-integration/all/gems/activesupport-6.0.3.1/lib/active_support/notifications.rb:182:in
 `instrument'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:247:in `run'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:322:in `block in build_stack'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:35:in `call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:28:in `call'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:35:in `call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:28:in `call'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:35:in `call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:28:in `call'
  
/usr/share/rubygems-integration/all/gems/rack-oauth2-1.11.0/lib/rack/oauth2/server/resource.rb:20:in
 `_call'
  
/usr/share/rubygems-integration/all/gems/rack-oauth2-1.11.0/lib/rack/oauth2/server/resource/bearer.rb:8:in
 `_call'
  
/usr/share/rubygems-integration/all/gems/rack-oauth2-1.11.0/lib/rack/oauth2/server/abstract/handler.rb:17:in
 `call'
  /usr/lib/ruby/vendor_ruby/grape/middleware/error.rb:39:in `block in call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/error.rb:38:in `catch'
  /usr/lib/ruby/vendor_ruby/grape/middleware/error.rb:38:in `call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:28:in `call'
  /usr/lib/ruby/vendor_ruby/grape_logging/middleware/request_logger.rb:60:in 
`block in call!'
  /usr/lib/ruby/vendor_ruby/grape_logging/middleware/request_logger.rb:58:in 
`catch'
  /usr/lib/ruby/vendor_ruby/grape_logging/middleware/request_logger.rb:58:in 
`call!'
  /usr/lib/ruby/vendor_ruby/grape/middleware/base.rb:28:in `call'
  /usr/lib/ruby/vendor_ruby/rack/head.rb:14:in `call'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:231:in `call!'
  /usr/lib/ruby/vendor_ruby/grape/endpoint.rb:225:in `call'
  /usr/lib/ruby/vendor_ruby/grape/router/route.rb:58:in `exec'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:116:in `process_route'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:72:in `block in identity'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:91:in `transaction'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:70:in `identity'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:55:in `block in call'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:132:in `with_optimization'
  /usr/lib/ruby/vendor_ruby/grape/router.rb:54:in `call'