This repository has been archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Passing null/undefined for options crashes node #1574
Labels
exp/novice
Someone with a little familiarity can pick up
kind/bug
A bug in existing code (including security flaws)
P1
High: Likely tackled by core team if no one steps up
Comments
alanshaw
added
kind/bug
A bug in existing code (including security flaws)
exp/novice
Someone with a little familiarity can pick up
status/ready
Ready to be worked
P1
High: Likely tackled by core team if no one steps up
labels
Sep 17, 2018
alanshaw
pushed a commit
that referenced
this issue
Sep 18, 2018
Options should be optional! Our API should be flexible enough to allow passing null or undefined in place of an options object. This PR fixes cases where we assume an options object has been passed. fixes: #1574 License: MIT Signed-off-by: Alan Shaw <[email protected]>
alanshaw
pushed a commit
that referenced
this issue
Sep 18, 2018
Options should be optional! Our API should be flexible enough to allow passing null or undefined in place of an options object. This PR fixes cases where we assume an options object has been passed. fixes: #1574 License: MIT Signed-off-by: Alan Shaw <[email protected]>
alanshaw
pushed a commit
that referenced
this issue
Sep 19, 2018
Options should be optional! Our API should be flexible enough to allow passing null or undefined in place of an options object. This PR fixes cases where we assume an options object has been passed. fixes: #1574
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
exp/novice
Someone with a little familiarity can pick up
kind/bug
A bug in existing code (including security flaws)
P1
High: Likely tackled by core team if no one steps up
It's legal to pass
null
/undefined
as a value for options. In some instances our API methods expect an options object to exist and try to access properties on it, which fails and crashes the node.e.g.
js-ipfs/src/core/components/files.js
Lines 279 to 281 in e7d1270
^^ in this instance, the default assignment only happens if options is
undefined
so does not work correctly ifnull
is passed.It could happen if the user is using a ternary to pass/not pass options e.g.
The text was updated successfully, but these errors were encountered: