{"record":{"id":"9da25ed28f375508","repo":"m1k1o/neko","slug":"is-not-the-admin","errorCode":null,"errorMessage":"is not the admin","messagePattern":"is not the admin","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/websocket/handler/screen.go","lineNumber":13,"sourceCode":"package handler\n\nimport (\n\t\"errors\"\n\n\t\"github.com/m1k1o/neko/server/pkg/types\"\n\t\"github.com/m1k1o/neko/server/pkg/types/event\"\n\t\"github.com/m1k1o/neko/server/pkg/types/message\"\n)\n\nfunc (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {\n\tif !session.Profile().IsAdmin {\n\t\treturn errors.New(\"is not the admin\")\n\t}\n\n\tsize, err := h.desktop.SetScreenSize(payload.ScreenSize)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSizeUpdate{\n\t\tID:         session.ID(),\n\t\tScreenSize: size,\n\t})\n\treturn nil\n}\n","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/m1k1o/neko/blob/b0f01cedea68893e85a3fd852c0521238c285695/server/internal/websocket/handler/screen.go#L1-L27","documentation":"screenSet in server/internal/websocket/handler/screen.go rejects screen size changes when the sending session's profile lacks IsAdmin. Changing the remote display resolution is an administrative action in neko because it affects all viewers and can disrupt the shared desktop.","triggerScenarios":"Sending a screen size set message while session.Profile().IsAdmin is false — e.g. any non-admin member calling the screen configuration handler.","commonSituations":"A regular host tries to change resolution assuming host rights suffice (admin flag is separate); custom member profiles created without IsAdmin; self-hosted setups where users log in with default non-admin credentials and attempt resolution changes via the UI.","solutions":["Log in / create the session with an admin profile (IsAdmin: true) if resolution control is required.","Use an admin account for screen configuration changes.","Disable or hide the screen settings UI for non-admin clients.","Verify the auth/membership provider actually returns the admin flag for the account."],"exampleFix":"// before\nprofile := types.MemberProfile{ CanWatch: true, CanHost: true }\n// after\nprofile := types.MemberProfile{ CanWatch: true, CanHost: true, IsAdmin: true }","handlingStrategy":"validation","validationCode":"// client-side, before sending screen size\nif (!session.profile.isAdmin) {\n  console.warn('screen configuration requires admin')\n  return\n}","typeGuard":"function isAdmin(session) {\n  return session?.profile?.isAdmin === true\n}","tryCatchPattern":"try {\n  socket.emit('screen/set', screenSize)\n} catch (e) {\n  if (e.message === 'is not the admin') promptAdminLogin()\n}","preventionTips":["Hide screen settings UI for non-admin profiles.","Remember IsAdmin is separate from CanHost — hosts still cannot change resolution.","Use an admin account for resolution changes.","Verify your auth provider maps the admin role to IsAdmin correctly."],"tags":["websocket","permissions","admin","screen"],"backgroundTag":"insufficient-permissions","analyzedSha":"b0f01cedea68893e85a3fd852c0521238c285695","analyzedAt":"2026-09-01T10:35:56.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}