{"record":{"id":"c4bfd94ea4134803","repo":"paperclipai/paperclip","slug":"invalid-teams-consent-scope","errorCode":null,"errorMessage":"Invalid Teams consent scope","messagePattern":"Invalid Teams consent scope","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/chat-teams-file-consent.ts","lineNumber":586,"sourceCode":"        ? \"none\"\n        : typeof upload === \"string\"\n          ? upload\n          : \"available\";\n    Object.freeze(this);\n  }\n  isHookEvent() {\n    return this.#authentic;\n  }\n  async seal(\n    context: TeamsFilePrivateContext,\n    binding: TeamsFileConsentBinding,\n  ) {\n    if (\n      !consentEventMatches(this, binding) ||\n      context.companyId !== binding.companyId ||\n      context.endpointId !== binding.endpointId\n    )\n      throw new Error(\"Invalid Teams consent scope\");\n    return sealPrivate(context, \"response\", {\n      bindingDigest: digest(binding),\n      activityId: this.activityId,\n      action: this.action,\n      replyToId: this.replyToId,\n      upload: this.#upload,\n    });\n  }\n  receiptDigest() {\n    return digest({\n      activityId: this.activityId,\n      action: this.action,\n      replyToId: this.replyToId,\n      upload: this.#upload,\n    });\n  }\n  static async restore(\n    context: TeamsFilePrivateContext,","sourceCodeStart":568,"sourceCodeEnd":604,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/chat-teams-file-consent.ts#L568-L604","documentation":"Binding guard in the seal method of the Teams file-consent event: the consent event being sealed does not match the provided binding — either consentEventMatches failed, or the context's companyId/endpointId differ from the binding's. It prevents sealing a Teams file consent token for a scope (company/endpoint/event) other than the one that originally granted it.","triggerScenarios":"Thrown at server/src/services/chat-teams-file-consent.ts:586 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass the consent binding that matches the original Teams consent event (same companyId, endpointId, and event match)","Re-request user consent if the binding legitimately changed (new endpoint or company)","Check for stale cached bindings being reused across endpoints"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}