xSemaphoreTake in a critical section

I assume by “illegal action” you mean calling a FreeRTOS API with non-zero block time. If yes, there is no assert to catch this as of now. Critical sections should be few and should be very short and deterministic and therefore, grepping for taskENTER_CRITICAL and reviewing the code can be a viable way to catch such violations.