1
0
mirror of https://github.com/minimaxir/big-list-of-naughty-strings.git synced 2025-09-25 13:19:15 +02:00

Add "then" to strings which may be used elsewhere

The massive adoption of Promises made many programs potentially vulnerable to "accidental Promises".

In short, a program might take user input and produce an object as such:

```js
{
  [userInput]: AnyFunction
}
```

...when the object above is given to a Promise, nothing breaks until the user input is exactly `"then"`. Once it's *then*, a Promise will assume that the object as another Promise, and in trying to assimilate this accidental Promise the function will be called. After that, one of three things will happen

1. The function calls one of the continuations provided by the Promise, and the program continues with some unexpected data (this is highly unlikely)
1. The program hangs and never terminates (if the function stores input in memory)
1. The program terminates early, failing to execute any other chained Promises (the more likely case)

For more in-depth information, please refer to the appropriate sections in the articles I've written regarding this issue:

1. [Broken Promises - Specialized API](https://medium.com/@avaq/broken-promises-2ae92780f33#6828)
1. [A clarification with examples to the article above](https://medium.com/@avaq/im-referring-to-the-fact-that-a-promise-is-eagerly-evaluated-as-opposed-to-lazily-evaluated-5385cc519e3b#33cd) (see the part under "I never found myself creating an object with a then method")
This commit is contained in:
Aldwin Vlasblom
2017-11-10 15:28:20 +01:00
committed by GitHub
parent c0b5382124
commit 85bc805f4f

View File

@@ -17,6 +17,7 @@ TRUE
FALSE FALSE
None None
hasOwnProperty hasOwnProperty
then
\ \
\\ \\