{"record":{"id":"d7aae4e58093b8c4","repo":"portainer/portainer","slug":"the-device-has-not-been-trusted-yet","errorCode":null,"errorMessage":"the device has not been trusted yet","messagePattern":"the device has not been trusted yet","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"api/http/security/bouncer.go","lineNumber":214,"sourceCode":"\t}\n\n\treturn nil\n}\n\n// TrustedEdgeEnvironmentAccess defines a security check for Edge environments, checks if\n// the request is coming from a trusted Edge environment\nfunc (bouncer *RequestBouncer) TrustedEdgeEnvironmentAccess(tx dataservices.DataStoreTx, endpoint *portainer.Endpoint) error {\n\tif endpoint.UserTrusted {\n\t\treturn nil\n\t}\n\n\tsettings, err := tx.Settings().Settings()\n\tif err != nil {\n\t\treturn errors.WithMessage(err, \"could not retrieve the settings\")\n\t}\n\n\tif !settings.TrustOnFirstConnect {\n\t\treturn errors.New(\"the device has not been trusted yet\")\n\t}\n\n\treturn nil\n}\n\n// mwAuthenticatedUser authenticates a request by\n// - adding a secure handlers to the response\n// - authenticating the request with a valid token\nfunc (bouncer *RequestBouncer) mwAuthenticatedUser(h http.Handler) http.Handler {\n\th = bouncer.mwAuthenticateFirst([]tokenLookup{\n\t\tbouncer.apiKeyLookup,\n\t\tbouncer.CookieAuthLookup,\n\t\tbouncer.JWTAuthLookup,\n\t}, h)\n\th = MWSecureHeaders(h, bouncer.hsts, bouncer.csp)\n\n\treturn h\n}","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/http/security/bouncer.go#L196-L232","documentation":"Error \"the device has not been trusted yet\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/http/security/bouncer.go:214 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}