instructure/canvas-lms · error · GoogleDrive::MasqueradingException
cannot show collaboration when masquerading
Error message
cannot show collaboration when masquerading
What it means
Guard in CollaborationsController#show: a user viewing a collaboration while masquerading (acting as another user, where @real_current_user differs) is blocked. Google integrations bind to the real user's identity/credentials, so opening the collaboration under a spoofed session would access or create documents as the wrong account.
Solutions
- Stop masquerading (become yourself) before opening the collaboration
- Access the collaboration directly from the Google/Office account of the masqueraded user if legitimately needed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at app/controllers/collaborations_controller.rb:223 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of instructure/canvas-lms@1c9f0bb801 (2026-09-15).
Data as JSON: /api/errors/c74b05aa10268931.
Report an issue: GitHub.
Appendix: source
Thrown at app/controllers/collaborations_controller.rb:223
.where(where_collaborators)
end
collaborations = Api.paginate(
collaborations_query,
self,
url
)
render json: collaborations.map { |c| collaboration_json(c, @current_user, session) }
end
def show
@collaboration = @context.collaborations.find(params[:id])
if authorized_action(@collaboration, @current_user, :read)
@collaboration.touch
begin
# error out when user tries to open a collaboration while masquerading
raise GoogleDrive::MasqueradingException, "cannot show collaboration when masquerading" if logged_in_user != @current_user
if @collaboration.valid_user?(@current_user)
@collaboration.authorize_user(@current_user)
log_asset_access(@collaboration, "collaborations", "other", "participate")
url = if @collaboration.is_a? ExternalToolCollaboration
tool = Lti::ToolFinder.from_url(@collaboration.url, @context)
@collaboration.migrate_to_1_3_if_needed!(tool)
resource_link_lookup_uuid = @collaboration.resource_link_lookup_uuid if tool.use_1_3?
external_tool_launch_url(
@collaboration.url,
resource_link_lookup_uuid
)
else
@collaboration.url
end
redirect_to urlView on GitHub (pinned to 1c9f0bb801)