Skip to content

Commit

Permalink
Update 99_main_compiler.js
Browse files Browse the repository at this point in the history
  • Loading branch information
khrj committed Nov 23, 2022
1 parent a0535df commit cf286a4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cli/tsc/99_main_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@
// that is created when Deno needs to type check TypeScript, and in some
// instances convert TypeScript to JavaScript.

// Removes the `__proto__` for security reasons.
// Disables setting `__proto__` and emits a warning instead, for security reasons.
// https://tc39.es/ecma262/#sec-get-object.prototype.__proto__
delete Object.prototype.__proto__;
Object.defineProperty(Object.prototype, '__proto__', {
configurable: true,
enumerable: false,
get () { return Object.getPrototypeOf(this) },
set (_) {
console.warn(
"Prototype access via __proto__ attempted; __proto__ is not implemented in Deno due to security reasons. Use Object.setPrototypeOf instead."
)
}
})

((window) => {
/** @type {DenoCore} */
Expand Down

0 comments on commit cf286a4

Please sign in to comment.