KEMBAR78
Prototype pollution by Opal · Issue #3 · shishkin/astro-asciidoc · GitHub
Skip to content

Prototype pollution by Opal #3

@shishkin

Description

@shishkin

It seems that running Asciidoctor.js does pollute Javascript native object prototypes that leads to weird bugs. For example, this code adds a stub $id method to Array prototype so all arrays suddenly get it:

import asciidoctor from "@asciidoctor/core";

asciidoctor();

console.log([].$id);
// [Function: method_missing_stub] { '$$stub': true }
console.log(Array.prototype.$id);
// [Function: method_missing_stub] { '$$stub': true }

I discover a bug with this in ajv schema validator that runs into issues when it encounters an array of schemas with a present $id property, which it only expects to find on a single schema, not array.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions