Skip to content

patterns: kindOf incorrectly looks at properties inherited from Object.prototype #3051

@gibson042

Description

@gibson042

Describe the bug

kindOf does not adequately guard against Object.prototype property reads.

Steps to reproduce

import '@endo/init';
import { kindOf } from '@endo/patterns';
import { makeTagged } from '@endo/pass-style';

const goodTagged = makeTagged('foo', undefined);
console.log(kindOf(goodTagged));
// => undefined

const badTagged = makeTagged('valueOf', undefined);
console.log(kindOf(badTagged));
// => TypeError: matchHelper.checkIsWellFormed is not a function

Expected behavior

Object.prototype properties are not confused as helpers.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions