Defect #13762
openSCM auto status change bypassses roles and permissions
Description
Hi,
Encountered unexpected behavior yesterday when i accidentally added a Git archive cloned from another site (buildroot in this case) which contained a lot of commit-messages like
This ended up in a lot of actions like:
Updated by Anonymous about 9 hours ago
Status changed from New to Resolved
% Done changed from 0 to 100
Comment Edit
Applied in changeset alleatoautomationplatform:buildroot|commit:4f0361ab2ca4f25207c84b557e31319c9a417a76.
This was not only in the project the Repository is in but sitewide.
The user Anonymous have no permissions set.
This differs in two ways from my expected behavior:
1) The anonymous user should not be able to close issues.
2) A repo commit should only be able to modify issues in the same project as the repo.
This is an old installation that have gone through several upgrades. Unfortunately I don't have time to reproduce it in a clean environment but I thought it might be best reporting it anyway since it is security related.
Ruby version 1.9.3 (x86_64-linux) RubyGems version 1.8.23 Rack version 1.4 Rails version 3.2.13 Active Record version 3.2.13 Action Pack version 3.2.13 Active Resource version 3.2.13 Action Mailer version 3.2.13 Active Support version 3.2.13 Middleware Rack::Cache, ActionDispatch::Static, Rack::Lock, #<ActiveSupport::Cache::Strategy::LocalCache::Middleware:0x0000000289ede0>, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Callbacks, ActiveRecord::ConnectionAdapters::ConnectionManagement, ActiveRecord::QueryCache, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, RedmineDmsf::NoParse, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport, OpenIdAuthentication Application root /var/www/redmine-2.2 Environment production Database adapter mysql2 Database schema version 20121026003537
Thanks in advance and thank you for a great product. We love it!
Marcus
Files
Updated by Toshi MARUYAMA over 13 years ago
- Category set to SCM
Updated by Toshi MARUYAMA over 13 years ago
- Status changed from New to Confirmed
- Target version set to 2.3.1
Updated by Toshi MARUYAMA over 13 years ago
- Target version changed from 2.3.1 to 2.4.0
Updated by Toshi MARUYAMA over 13 years ago
- Subject changed from Repositories bypassses roles and pesmissions to SCM auto status change bypassses roles and pesmissions
Updated by Etienne Massip over 13 years ago
I disagree with this one, Anonymous here is not the Redmine anonymous user but a developer which has commit access to the repository and which SCM identifier is not mapped to an actual Redmine user, this is far from being a lambda person but a member of the project.
This should not be touched IMHO.
Updated by Marcus Rejås over 13 years ago
Etienne Massip wrote:
I disagree with this one, Anonymous here is not the Redmine anonymous user but a developer which has commit access to the repository and which SCM identifier is not mapped to an actual Redmine user, this is far from being a lambda person but a member of the project.
This should not be touched IMHO.
I understand but it might lead to security breaches. You say that the person is being member of the project, but really it is member of any project. So if a committer by accident or on purpose mistypes the issue-id or enters one belonging to an external ticket system he or she might change things in a project where he or she might not have access. The person who made the mistake will not then be alerted at all and have no way to correct the problem.
My solution is to add three configuratoin options to the repos.
[] Allow altering of tickets through commit messages
[] Allow system wide altering of tickets through commit messages
[] Allow Non-mapped users in the repo to alter tickets through commit messages
We track external repos in some projects and this led to some confusion (to say the least) ...
Updated by Toshi MARUYAMA over 13 years ago
- Related to Defect #14276: Limit users than can reference and fix issues in commit messages added
Updated by Toshi MARUYAMA over 13 years ago
- Related to deleted (Defect #14276: Limit users than can reference and fix issues in commit messages)
Updated by Toshi MARUYAMA over 13 years ago
- Has duplicate Defect #14276: Limit users than can reference and fix issues in commit messages added
Updated by Etienne Massip over 13 years ago
- Subject changed from SCM auto status change bypassses roles and pesmissions to SCM auto status change bypassses roles and permissions
Updated by Toshi MARUYAMA about 13 years ago
- Has duplicate Defect #14826: Project permissions not respected in Fix/Reference commit added
Updated by Jean-Philippe Lang about 13 years ago
- Target version changed from 2.4.0 to Candidate for next major release
The root problem should be fixed by r4823 which disables issue updates when importing old commits. The requested option "Allow system wide altering of tickets through commit messages" is also already available as "Allow issues of all the other projects to be referenced and fixed".
Updated by Mischa The Evil about 13 years ago
Updated by Toshi MARUYAMA about 13 years ago
- Related to Feature #4823: Don't evaluate commit-message "refs, closes, ..." when adding a repository added
Updated by Go MAEDA almost 11 years ago
- Has duplicate Feature #13792: Fixing via git push should not break workflow added
Updated by Go MAEDA over 2 years ago
- Is duplicate of Defect #40874: Status change by commit added
Updated by Jens Krämer 17 days ago
- File 0001-Check-attributes-against-the-given-user-in-Issue-saf.patch 0001-Check-attributes-against-the-given-user-in-Issue-saf.patch added
- File 0002-Limit-commit-issue-updates-to-what-the-committer-may.patch 0002-Limit-commit-issue-updates-to-what-the-committer-may.patch added
The attached patches make fix keywords and @time logging in commit messages
respect the permissions of the committer. They apply to trunk r25417.
The first patch is unrelated to this issue, but contains a fix necessary for the second
patch: Issue#safe_attributes= takes a user, but checks project_id,tracker_id, status_id and assigned_to_id with safe_attribute? without
passing it on, so User.current decides about these four even if another user
is given. This does not matter for current callers, which all pass User.current.
The second patch implements the following:
- A fix keyword only updates issues visible to the committer, and the update
goes throughsafe_attributes=as the committer, so edit permission,
workflow transitions, read-only fields and disabled core fields apply. @timecreates the time entry through TimeEntry#safe_attributes= with the committer
as author, so the same rules apply as when logging time in the web UI (visibility,
log_time, log_time_for_other_users). The latter becomes relevant should a plugin
overrideacting_userand with repository types like Git where pusher (acting user)
and committer are not necessarily the same.- Committers not mapped to a Redmine user are treated as Anonymous.
- Refused updates and time entries, and attributes that could not be applied,
are logged with the issue, the changeset and the user.
This changes behaviour for setups where committers are not mapped to users:
their fix keywords and time logging stop having an effect until they are mapped
in the repository's Users tab. Etienne argued in #note-5 that unmapped committers
are effectively members. I think that is often true, but Redmine cannot tell an
unmapped team member from anyone else who got a commit into the repository, e.g.
through a merged pull request with a made-up author. The fix for #4823-10
stops old commits from updating issues when a repository is added, but new
commits are not limited in any way.
The patch takes the committer as recorded in the commit, so a commit claiming to
be by a more privileged user still gets that user's permissions. Preventing that
would require knowing who pushed the commit, which Redmine does not; setups that
do know (e.g. hosted repositories) can override Changeset#acting_user.
If the old behaviour should remain available, I would be happy to add a setting
(e.g. "Allow any committer to update issues" that keeps the current behaviour
(no checks at all, regardless of mapping). I left it out for now to keep the
patch small.
Existing tests in test/unit/changeset_test.rb now commit as a mapped user who
may change the issues, since they relied on unmapped committers being allowed to
do anything.