Security and data quality issues represent potential show- stoppers for the market take-up of IoT-based products and services in various operational scenarios and vertical application domains. To tackle these issues, in this elsarticle we have introduced and discussed a flexible security and data quality enforcement framework, coherently integrated within a distributed IoT middleware platform.