[security] Error handling policy and macro usage clarification #14190
Labels
area/security
design proposal
Needs design doc/proposal before implementation
no stalebot
Disables stalebot from closing an issue
Error Handling and Macro Usage Policy Updates and Clarifications
Description:
Envoy contains over 1000 ASSERTs in core code, and over 400 exist in router and HTTP components. In some cases, ASSERTs are not used as statements of true invariants, but used incorrectly to indicate possible errors on the data plane. Especially as Envoy moves towards a hardened posture against extensions, dependencies, and upstreams, macro usage and when proper error handling is needed should be clarified. There is some evidence that ASSERTs are not consistently used for true invariants, either because of wishful assumptions on incoming traffic or from mistaking the invariant (GHSA-gxvv-x4p2-rppp, #13756, #9996, #9509).
In addition to broadening and clarifying types of errors that should be handled, this proposal also suggests adding guidelines for using ENVOY_BUGs, which can be used in addition to error handling and as a way to detect violations in release mode. This could especially help debugging complex crashes, where a condition was violated at some earlier point in time.
A link the the full proposal is here.
Summary
A high level of the changes, with significant differences bolded.
Gracefully handle all errors that may be caused by
Macros:
- ENVOY_BUG_ALPHA (effectively ENVOY_BUG): Used for alpha/rapidly changing protocols that want to have detectability on probable invariants.
Some clarifications/additions in macro usage philosophy:
In addition, the main addition to the proposal is having clear guidelines. A high level bucketing can show potential usages of ASSERT/RELEASE_ASSERT, ENVOY_BUG, and error handling. There is always room for cross-over, dotted lines indicate places where that may happen.
Open Questions
Proposed Actions
Relevant Links
#9087
The text was updated successfully, but these errors were encountered: