summaryrefslogtreecommitdiff
path: root/src/node_revert.h
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2016-02-03 17:16:10 -0800
committerJames M Snell <jasnell@gmail.com>2016-02-09 09:20:41 -0800
commitd387591bbb53991df8402cc9f0613e296e89929f (patch)
treea7872058964ddb450320a2967c888681ea9aa7c2 /src/node_revert.h
parentc3e50cadac93999da0a513b4b92274ad9522244f (diff)
downloadandroid-node-v8-d387591bbb53991df8402cc9f0613e296e89929f.tar.gz
android-node-v8-d387591bbb53991df8402cc9f0613e296e89929f.tar.bz2
android-node-v8-d387591bbb53991df8402cc9f0613e296e89929f.zip
src: add --security-revert command line flag
The `--security-revert={cvenum}` command line flag is a special purpose flag to be used only in stable or LTS branches when a breaking change is required to address a security vulnerability. Whenever a vulnerability requires a breaking change, and a CVE has been assigned, the flag can be used to force Node to revert to the insecure behavior that was implemented before the fix was applied. Note that this flag is intended to be used only as a last resort in the case a security update breaks existing code. When used, a security warning will be printed to stderr when Node launches. The `--security-revert={cvenum}` flag takes a single CVE number as an argument. Multiple instances of the `--security-revert={cvenum}` flag can be used on the command line to revert multiple changes. Whenever a new `--security-revert={cvenum}` is enabled, it should be documented in the release notes and in the API docs. Master and the first release of a new major (e.g. v6.0) should not have any reverts available. Every time a new `--security-revert={cvenum}` is added, there should be a semver-minor bump in the stable and LTS branch. PR-URL: https://github.com/nodejs/node-private/pull/26 Reviewed-By: Rod Vagg <r@va.gg> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/node_revert.h')
-rw-r--r--src/node_revert.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/node_revert.h b/src/node_revert.h
new file mode 100644
index 0000000000..6a0f9b452e
--- /dev/null
+++ b/src/node_revert.h
@@ -0,0 +1,44 @@
+#ifndef SRC_NODE_REVERT_H_
+#define SRC_NODE_REVERT_H_
+
+#include "node.h"
+
+/**
+ * Note that it is expected for this list to vary across specific LTS and
+ * Stable versions! Only CVE's whose fixes require *breaking* changes within
+ * a given LTS or Stable may be added to this list, and only with CTC
+ * consensus.
+ *
+ * For *master* this list should always be empty!
+ *
+ **/
+#define REVERSIONS(XX)
+// XX(CVE_2016_PEND, "CVE-2016-PEND", "Vulnerability Title")
+
+namespace node {
+
+typedef enum {
+#define V(code, _, __) REVERT_ ## code,
+ REVERSIONS(V)
+#undef V
+} reversions_t;
+
+
+/* A bit field for tracking the active reverts */
+extern unsigned int reverted;
+
+/* Revert the given CVE (see reversions_t enum) */
+void Revert(const unsigned int cve);
+
+/* Revert the given CVE by label */
+void Revert(const char* cve);
+
+/* true if the CVE has been reverted **/
+bool IsReverted(const unsigned int cve);
+
+/* true if the CVE has been reverted **/
+bool IsReverted(const char * cve);
+
+} // namespace node
+
+#endif // SRC_NODE_REVERT_H_