/openbmc/bmcweb/include/ |
H A D | security_headers.hpp | diff cd1f3920ac3ec6605bcc3e7e45bab18e235bd33a Tue Mar 09 07:57:47 CST 2021 Arun P. Mohanan <arun.p.m@linux.intel.com> Fix KVM issue on DISABLE_XSS_PREVENTION
Fix KVM failed to load images issue introduced by incorrect condition updated by commit 0260d9d6b252d5fef81a51d4797e27a6893827f4.
Tested: KVM loaded images successfully
Signed-off-by: Arun P. Mohanan <arun.p.m@linux.intel.com> Change-Id: Ib753ed1d56ce2e0a9228ca52e36ffab298d21cff diff 0260d9d6b252d5fef81a51d4797e27a6893827f4 Sun Feb 07 13:31:07 CST 2021 Ed Tanous <ed@tanous.net> Fix compile issue on DISABLE_XSS_PREVENTION
Fixes #178
Every few months, this option breaks because of some combination of compiler options. I'm hoping that this is a more permenant fix, and will keep it working forever.
Functionally, this commit changes a couple things. 1. It fixes the regression that snuck into this option, by making the req variable optional using the c++17 [[maybe_unused]] syntax. 2. It promotes the BMCWEB_INSECURE_DISABLE_XSS_PREVENTION into the config.h file, and a constexpr variable rather than a #define. This has the benefit that both the code paths in question will compiled regardless of whether or not they're used, thus ensuring they stay buildable forever. The optimization path will still delete the code later, but we won't have so many one-off build options breaking. We should move all the other feature driven #ifdefs to this pattern in the future. 3. As a mechnaical change to #2, this adds a config.h.in, which delcares the various variables as their respective constexpr types. This allows the constants to be used in a cleaner way.
As an aside, at some point, DISABLE_XSS_PREVENTION should really move to a non-persistent runtime option rather than a compile time option. Too many people get hung up on having to recompile their BMC, and moving it to runtime under admin credentials is no more a security risk.
As another aside, we should move all the other #ifdef style options to this pattern. It seems like it would help with keeping all options buildable, and is definitely more modern than #ifdefs for features, especially if they don't require #include changes or linker changes.
Tested: enabled meson option insecure-disable-xss, and verified code builds and works again.
Change-Id: Id03faa17cffdbabaf4e5b0d46b24bb58b7f44669 Signed-off-by: Ed Tanous <edtanous@google.com>
|
/openbmc/bmcweb/src/ |
H A D | webserver_main.cpp | diff 0260d9d6b252d5fef81a51d4797e27a6893827f4 Sun Feb 07 13:31:07 CST 2021 Ed Tanous <ed@tanous.net> Fix compile issue on DISABLE_XSS_PREVENTION
Fixes #178
Every few months, this option breaks because of some combination of compiler options. I'm hoping that this is a more permenant fix, and will keep it working forever.
Functionally, this commit changes a couple things. 1. It fixes the regression that snuck into this option, by making the req variable optional using the c++17 [[maybe_unused]] syntax. 2. It promotes the BMCWEB_INSECURE_DISABLE_XSS_PREVENTION into the config.h file, and a constexpr variable rather than a #define. This has the benefit that both the code paths in question will compiled regardless of whether or not they're used, thus ensuring they stay buildable forever. The optimization path will still delete the code later, but we won't have so many one-off build options breaking. We should move all the other feature driven #ifdefs to this pattern in the future. 3. As a mechnaical change to #2, this adds a config.h.in, which delcares the various variables as their respective constexpr types. This allows the constants to be used in a cleaner way.
As an aside, at some point, DISABLE_XSS_PREVENTION should really move to a non-persistent runtime option rather than a compile time option. Too many people get hung up on having to recompile their BMC, and moving it to runtime under admin credentials is no more a security risk.
As another aside, we should move all the other #ifdef style options to this pattern. It seems like it would help with keeping all options buildable, and is definitely more modern than #ifdefs for features, especially if they don't require #include changes or linker changes.
Tested: enabled meson option insecure-disable-xss, and verified code builds and works again.
Change-Id: Id03faa17cffdbabaf4e5b0d46b24bb58b7f44669 Signed-off-by: Ed Tanous <edtanous@google.com>
|
/openbmc/bmcweb/ |
H A D | meson.build | diff feaf15005555a3099c7f22a7e3d16c99ccb40e72 Tue Feb 23 10:53:50 CST 2021 Ed Tanous <edtanous@google.com> Fix XSS regressions
The router has an old sanity check in it to verify that nodes are simple. This is no longer the case, as we can have multiple, overlapping routes between different handlers, so non-simple root nodes are allowed.
The commit here broke a couple things. 0260d9d6b252d5fef81a51d4797e27a6893827f4
First, when that route gets injected, the root node is no longer simple, as the first root in the trie can be a complex node. This should be ok, and this commit comments out the check.
Also, because the meson node for the option was loaded directly into set10, instead of the boolean equivalent, the XSS feature always gets enabled, regardless of whether or not that's what the user wanted. The fix to this was to simply include a .enabled(), which correctly calls the bool.
Tested: Built with insecure-disable-xss set, and observed crash was removed. Tried several routes including /redfish/v1 and observed them working.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib9fb55a61796ddbda65b7ee5d2803a5cbd2ae75f diff 0260d9d6b252d5fef81a51d4797e27a6893827f4 Sun Feb 07 13:31:07 CST 2021 Ed Tanous <ed@tanous.net> Fix compile issue on DISABLE_XSS_PREVENTION
Fixes #178
Every few months, this option breaks because of some combination of compiler options. I'm hoping that this is a more permenant fix, and will keep it working forever.
Functionally, this commit changes a couple things. 1. It fixes the regression that snuck into this option, by making the req variable optional using the c++17 [[maybe_unused]] syntax. 2. It promotes the BMCWEB_INSECURE_DISABLE_XSS_PREVENTION into the config.h file, and a constexpr variable rather than a #define. This has the benefit that both the code paths in question will compiled regardless of whether or not they're used, thus ensuring they stay buildable forever. The optimization path will still delete the code later, but we won't have so many one-off build options breaking. We should move all the other feature driven #ifdefs to this pattern in the future. 3. As a mechnaical change to #2, this adds a config.h.in, which delcares the various variables as their respective constexpr types. This allows the constants to be used in a cleaner way.
As an aside, at some point, DISABLE_XSS_PREVENTION should really move to a non-persistent runtime option rather than a compile time option. Too many people get hung up on having to recompile their BMC, and moving it to runtime under admin credentials is no more a security risk.
As another aside, we should move all the other #ifdef style options to this pattern. It seems like it would help with keeping all options buildable, and is definitely more modern than #ifdefs for features, especially if they don't require #include changes or linker changes.
Tested: enabled meson option insecure-disable-xss, and verified code builds and works again.
Change-Id: Id03faa17cffdbabaf4e5b0d46b24bb58b7f44669 Signed-off-by: Ed Tanous <edtanous@google.com>
|
/openbmc/bmcweb/http/ |
H A D | routing.hpp | diff feaf15005555a3099c7f22a7e3d16c99ccb40e72 Tue Feb 23 10:53:50 CST 2021 Ed Tanous <edtanous@google.com> Fix XSS regressions
The router has an old sanity check in it to verify that nodes are simple. This is no longer the case, as we can have multiple, overlapping routes between different handlers, so non-simple root nodes are allowed.
The commit here broke a couple things. 0260d9d6b252d5fef81a51d4797e27a6893827f4
First, when that route gets injected, the root node is no longer simple, as the first root in the trie can be a complex node. This should be ok, and this commit comments out the check.
Also, because the meson node for the option was loaded directly into set10, instead of the boolean equivalent, the XSS feature always gets enabled, regardless of whether or not that's what the user wanted. The fix to this was to simply include a .enabled(), which correctly calls the bool.
Tested: Built with insecure-disable-xss set, and observed crash was removed. Tried several routes including /redfish/v1 and observed them working.
Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ib9fb55a61796ddbda65b7ee5d2803a5cbd2ae75f
|
H A D | http_connection.hpp | diff 0260d9d6b252d5fef81a51d4797e27a6893827f4 Sun Feb 07 13:31:07 CST 2021 Ed Tanous <ed@tanous.net> Fix compile issue on DISABLE_XSS_PREVENTION
Fixes #178
Every few months, this option breaks because of some combination of compiler options. I'm hoping that this is a more permenant fix, and will keep it working forever.
Functionally, this commit changes a couple things. 1. It fixes the regression that snuck into this option, by making the req variable optional using the c++17 [[maybe_unused]] syntax. 2. It promotes the BMCWEB_INSECURE_DISABLE_XSS_PREVENTION into the config.h file, and a constexpr variable rather than a #define. This has the benefit that both the code paths in question will compiled regardless of whether or not they're used, thus ensuring they stay buildable forever. The optimization path will still delete the code later, but we won't have so many one-off build options breaking. We should move all the other feature driven #ifdefs to this pattern in the future. 3. As a mechnaical change to #2, this adds a config.h.in, which delcares the various variables as their respective constexpr types. This allows the constants to be used in a cleaner way.
As an aside, at some point, DISABLE_XSS_PREVENTION should really move to a non-persistent runtime option rather than a compile time option. Too many people get hung up on having to recompile their BMC, and moving it to runtime under admin credentials is no more a security risk.
As another aside, we should move all the other #ifdef style options to this pattern. It seems like it would help with keeping all options buildable, and is definitely more modern than #ifdefs for features, especially if they don't require #include changes or linker changes.
Tested: enabled meson option insecure-disable-xss, and verified code builds and works again.
Change-Id: Id03faa17cffdbabaf4e5b0d46b24bb58b7f44669 Signed-off-by: Ed Tanous <edtanous@google.com>
|