Description
Is this a possible security vulnerability?
- This is NOT a possible security vulnerability
Describe the bug
In the following code:
for (PolarisEntityCore resolveEntity : toResolve) {
// get associate active record
PolarisEntityActiveRecord activeEntityRecord = activeRecordIt.next();
// if this entity has been dropped (null) or replaced (<> ids), then fail validation
if (activeEntityRecord == null || activeEntityRecord.getId() != resolveEntity.getId()) {
return false;
}
}
If there are no elements in activeRecordIt
, calling .next()
will throw an exception before reaching the activeEntityRecord == null
check.
Should we add a .hasNext()
check before calling .next()
?
If this is indeed an issue, it seems like a trivial fix, and I’d be happy to address it.
` for (PolarisEntityCore resolveEntity : toResolve) {
// get associate active record
PolarisEntityActiveRecord activeEntityRecord = activeRecordIt.next();
// if this entity has been dropped (null) or replaced (<> ids), then fail validation
if (activeEntityRecord == null || activeEntityRecord.getId() != resolveEntity.getId()) {
return false;
}
}`
If there are no elements in activeRecordIt, then the .next() will throw an exception before reaching below.
activeEntityRecord == null
Should we check for .hasNext()
before calling .next()
.
If it is indeed an issue, it seems to be an trivial fix and I am happy to do it. Please assign it to me.
To Reproduce
No response
Actual Behavior
No response
Expected Behavior
No response
Additional context
No response
System information
No response