OctopusDeploy / Issues

| Public | Bug reports and known issues for Octopus Deploy and all related tools
https://octopus.com
162 stars 20 forks source link

Unable to Clone project if user has ProjectGroup scoping on ProjectCreate permission #6798

Closed calverp closed 3 years ago

calverp commented 3 years ago

Are you a customer of Octopus Deploy? Don't raise the issue here. Please contact our support team so we can triage your issue, making sure it's handled appropriately.

Prerequisites

The bug

If a user has the ProjectCreate permission scoped to a Project Group. When they attempt to clone a project within that group they will receive an object reference error.

What I expected to happen

The project should be cloned successfully.

Steps to reproduce

  1. Create a new user and team
  2. Assign the Project initiator to the new team scoped to the Default Project Group
  3. Log in as the new user and create a new projectL
  4. Attempt to Clone the new project
  5. Receive error after hitting OK in clone dialogue box

Log excerpt

Unhandled error on request: POST http://localhost/api/Spaces-1/projects?clone=Projects-56294 80008c60-0006-f000-b63f-84710c7967bb by Paul : Object reference not set to an instance of an object. System.NullReferenceException: Object reference not set to an instance of an object.

   at Octopus.Server.Web.Api.Actions.Projects.DeploymentSettingsWillBeCopiedFromCloneRule.UpdateModelFromClone(DeploymentSettings model, DeploymentSettings toClone) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Api\Actions\Projects\DeploymentSettingsWillBeCopiedFromCloneRule.cs:line 51

   at Octopus.Server.Web.Api.Actions.Projects.DeploymentSettingsWillBeCopiedFromCloneRule.Apply(Project model, IOctopusQueryExecutor queryExecutor, IResponderMetadata responderMetadata) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Api\Actions\Projects\DeploymentSettingsWillBeCopiedFromCloneRule.cs:line 42

   at Octopus.Server.Web.Api.Actions.Projects.ProjectCreateResponder.AfterStore(Project model, ProjectResource resource, IOctopusRelationalTransaction transaction) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Api\Actions\Projects\ProjectCreateResponder.cs:line 81

   at Octopus.Server.Web.Infrastructure.Api.CustomCreateResponder`3.ExecuteRegistered() in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Infrastructure\Api\CustomCreateResponder.cs:line 97

   at Octopus.Server.Web.Infrastructure.Api.Responder`1.Respond(TDescriptor options, NancyContext context) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Infrastructure\Api\Responder.cs:line 46

   at Octopus.Server.Web.Infrastructure.OctopusNancyModule.<>c__DisplayClass14_0.<get_Routes>b__1(Object o, CancellationToken x) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Infrastructure\OctopusNancyModule.cs:line 81

   at Nancy.Routing.Route`1.Invoke(DynamicDictionary parameters, CancellationToken cancellationToken)

   at Nancy.Routing.DefaultRouteInvoker.Invoke(Route route, CancellationToken cancellationToken, DynamicDictionary parameters, NancyContext context)

   at Nancy.Routing.DefaultRequestDispatcher.Dispatch(NancyContext context, CancellationToken cancellationToken)

   at Nancy.NancyEngine.InvokeRequestLifeCycle(NancyContext context, CancellationToken cancellationToken, IPipelines pipelines)

   at Octopus.NancyOwin.NancyMiddleware.RequestComplete(NancyContext context, IDictionary`2 environment) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Owin\NancyMiddleware.cs:line 172

   at Octopus.NancyOwin.NancyMiddleware.<>c__DisplayClass3_0.<<UseNancy>b__1>d.MoveNext() in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Owin\NancyMiddleware.cs:line 108

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Owin.WebSocketAcceptAdapter.<>c__DisplayClass6_0.<<AdaptWebSockets>b__0>d.MoveNext()

--- End of stack trace from previous location where exception was thrown ---

   at Microsoft.AspNetCore.Builder.Extensions.MapWhenMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)

   at Microsoft.AspNetCore.HttpOverrides.HttpMethodOverrideMiddleware.Invoke(HttpContext context)

   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, Lazy`1 unitOfWork, ILog log, IActionContextAccessor actionContextAccessor) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\UnitOfWorkMiddleware.cs:line 42

   at Octopus.Server.Web.UnitOfWorkMiddleware.InvokeAsync(HttpContext httpContext, Lazy`1 unitOfWork, ILog log, IActionContextAccessor actionContextAccessor) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\UnitOfWorkMiddleware.cs:line 42

   at Octopus.Server.Web.Middleware.OctopusClientOldVersionWarningMiddleware.InvokeAsync(HttpContext context, IAutomationContext automationContext) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Middleware\OctopusClientOldVersionWarningMiddleware.cs:line 38

   at Octopus.Server.Web.Middleware.RequestLoggerMiddleware.InvokeAsync(HttpContext context) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Middleware\RequestLoggerMiddleware.cs:line 42

   at Octopus.Server.Web.Middleware.ErrorHandlingMiddleware.InvokeAsync(HttpContext context, CorrelationId correlationId) in C:\BuildAgent\work\b5c671f6c6f2b660\source\Octopus.Server\Web\Middleware\ErrorHandlingMiddleware.cs:line 70

Affected versions

Octopus Server: 2020.6.4671+

Workarounds

Removing the project group scoping from the relevant team will enable this to work again.

Links

Internal Link

zentron commented 3 years ago

Release Note: Allow Project cloning when user has ProjectGroup scoping on ProjectCreate permission

Octobob commented 3 years ago

:tada: The fix for this issue has been released in:

Release stream Release
2020.6 2020.6.4792
2021.1 2021.1.6930
2021.2 2021.2.1224
2021.3+ all releases