{"record":{"id":"d98c94a1d5a301e6","repo":"koala73/worldmonitor","slug":"company-claim-type-is-invalid","errorCode":null,"errorMessage":"company claim type is invalid","messagePattern":"company claim type is invalid","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"shared/company-monitoring-contract.ts","lineNumber":176,"sourceCode":"\nexport interface CompanyClaimInput {\n  type: string;\n  value: string;\n}\n\nexport interface NormalizedCompanyClaimInput {\n  type: CompanyClaimType;\n  value: string;\n}\n\nexport function normalizeCompanyClaimInput(input: CompanyClaimInput): NormalizedCompanyClaimInput {\n  if (!input || typeof input !== 'object') throw new Error('company claim is required');\n  // Own-property lookup: a plain object literal inherits `__proto__`, `constructor`,\n  // `toString`, etc., and a truthiness check would let those through as a \"valid\" type.\n  const type = Object.prototype.hasOwnProperty.call(COMPANY_CLAIM_TYPE_BY_INPUT, input.type)\n    ? COMPANY_CLAIM_TYPE_BY_INPUT[input.type]\n    : undefined;\n  if (!type) throw new Error('company claim type is invalid');\n\n  let value: string;\n  switch (type) {\n    case 'alias':\n      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxAliasBytes);\n      break;\n    case 'domain':\n      value = normalizeDomain(input.value, 0);\n      break;\n    case 'legal_identifier':\n      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxIdentifierBytes);\n      break;\n    case 'x_account_id':\n      value = assertPlainText(input.value, 'claim.value', COMPANY_MONITORING_LIMITS.maxXAccountIdBytes);\n      if (!X_ACCOUNT_ID.test(value)) throw new Error('invalid X account ID');\n      break;\n    case 'x_handle':\n      value = normalizeXHandle(input.value, 0);","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/koala73/worldmonitor/blob/eeab0a219fce0f02a00603b532dbae9041b934ac/shared/company-monitoring-contract.ts#L158-L194","documentation":"Contract validation error from normalizeCompanyClaimInput: input.type is not a key in the claim-type map. The lookup uses hasOwnProperty specifically so inherited properties like '__proto__', 'constructor', or 'toString' do not pass as valid types — a prototype-pollution hardening measure.","triggerScenarios":"Thrown at shared/company-monitoring-contract.ts:176 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the supported claim type keys (e.g. alias, domain, legal_identifier, x_account_id, x_handle, location, customer_reference)","Send type as a plain own-property string, not an inherited object key"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"eeab0a219fce0f02a00603b532dbae9041b934ac","analyzedAt":"2026-08-21T16:51:25.751Z","contentChangedAt":"2026-08-21T16:51:25.751Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}