Graylog2 / Graylog2/graylog2-server
findByIdForStream redundant code and potential auth bypass
- Dominant language
- Java
- Stars
- 8.1k
- Forks
- 1.1k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 217
Description
StreamDestinationFilterService.java:137-139:
public Optional findByIdForStream(String streamId, String id) {
collection.find(and(eq(FIELD_STREAM_ID, streamId), idEq(id)));
return utils.getById(id);
}
The collection.find(...) result is discarded — its return value is never consumed. The method then calls utils.getById(id) which ignores the streamId parameter entirely. If a caller assumes that the service will enforce access rights, it could result in an auth issue: a user who has access to stream A can look up a filter rule belonging to stream B as long as they know the rule's ID.
## Your Environment
* Graylog Version: 7.1
Contributor guide
Assessment
This issue has not been assessed yet.