3.2.0
rajnandan1/kener3.2.0Feb 27, 2025by rajnandan1
AI Summary
Version 3.2.0 is a significant security and usability release that replaces unsafe eval() with secure Function() constructors and changes how data is passed to monitor evaluation functions. API monitors now receive raw response data directly along with access to cheerio via a modules parameter, while TCP/Ping monitors receive arrayOfPings directly instead of base64-encoded data.
Key Highlights
- Replaced unsafe eval() with secure Function() constructors across all monitor types for improved security
- API monitors now receive raw response data directly instead of base64-encoded strings
- Added cheerio module support for HTML parsing in API monitor evaluations
- Simplified TCP/Ping monitor evaluation functions with direct access to ping data
- Fixed 'cheerio is undefined' errors in API monitor evaluations
Breaking Changes
- API monitor evaluation functions must now use new signature: (statusCode, responseTime, responseRaw, modules) instead of (statusCode, responseTime, responseDataBase64)
- TCP/Ping monitor evaluation functions must now use new signature: (arrayOfPings) instead of (responseDataBase64)
- Custom evaluation functions require migration to the new parameter structure
New Features
- Secure Function() constructors replace unsafe eval() across all monitor types
- Direct raw response data passed to API monitor evaluation functions
- New modules parameter provides access to cheerio for HTML parsing
- Direct access to ping/TCP data array in evaluation functions
- Removed unnecessary base64 encoding/decoding steps
- Improved error handling and logging for monitor evaluation failures
Full Release Notes
## v3.2.0
<picture>
<source srcset="https://fonts.gstatic.com/s/e/notoemoji/latest/1f680/512.webp" type="image/webp">
<img src="https://fonts.gstatic.com/s/e/notoemoji/latest/1f680/512.gif" alt="🚀" width="32" height="32">
</picture>
### Features
- **Improved Monitor Evaluation Functions**
- Replaced unsafe `eval()` with secure `Function()` constructors across all monitor types
- Added support for using modules (like cheerio) directly in evaluation functions
- **Enhanced API Monitors**
- Raw response data is now passed directly to eval functions instead of base64 encoded
- Added `modules` parameter with access to cheerio for HTML parsing
- Updated default evaluation function to use the new parameter structure
- **Improved TCP & Ping Monitors**
- Simplified evaluation functions with direct access to ping/TCP data
- Removed unnecessary base64 encoding/decoding steps
- Better error handling for invalid evaluation functions
- **Documentation Updates**
- Updated all examples and documentation for the new evaluation function signatures
- Added more detailed explanations of input parameters
- Improved examples showing usage with the new parameter structure
### Breaking Changes
- **Monitor Evaluation Functions**
- Custom evaluation functions will need to be updated to the new parameter structure
- API monitors: `(statusCode, responseTime, responseRaw, modules)` instead of `(statusCode, responseTime, responseDataBase64)`
- TCP/Ping monitors: `(arrayOfPings)` instead of `(responseDataBase64)`
### Fixes
- Fixed "cheerio is undefined" errors in API monitor evaluations
- Improved error handling and logging for monitor evaluation failures
- Security enhancements by removing `eval()` usage
### Migration
If you're using custom evaluation functions in your monitors, you'll need to update them to the new format:
#### API Monitors
```javascript
// Old format
(async function (statusCode, responseTime, responseDataBase64) {
const resp = atob(responseDataBase64)
// Your logic here
})
```
```javascript
// New format
(async function (statusCode, responseTime, responseRaw, modules) {
// responseRaw is the direct response - no need to decode
// Access cheerio with modules.cheerio
// Your logic here
})
```
#### TCP/Ping Monitors
```javascript
// Old format
(async function (responseDataBase64) {
let arrayOfPings = JSON.parse(atob(responseDataBase64))
// Your logic here
})
```
```javascript
// New format
(async function (arrayOfPings) {
// arrayOfPings is directly available - no need to decode
// Your logic here
})
```