We recently had an outage, apparently due to many mis-constructed JQL statement being used in an Agile board filter. The filter resulted in almost 500K issues being returned. Is it possible to set a limit to prevent users to use these filters when creating the board?
Hi Eric,
1) Did you try changing jira.search.views.max.limit in Jira’s advanced settings, if it is not at the default value i.e. 1000?
2) I personally haven't used powerscript put you can try the below steps. Let me know if it helps
Create a custom event listener that triggers when a new board is created. The script will extract the JQL filter used in the board. Count the number of issues returned by the filter.
If the count exceeds a threshold (e.g., 10,000 issues), the script prevents board creation or logs a warning.
string boardName = argv["boardName"];
string filterId = argv["filterId"];if (!isNull(filterId)) {
// Get the JQL from the filter
string jqlQuery = sql("jira", "SELECT jqlquery FROM searchrequest WHERE id = {filterId}", filterId);if (!isNull(jqlQuery)) {
// Count the number of issues in the JQL filter
number issueCount = countIssues(jqlQuery);// Set the issue limit threshold (e.g., 10,000)
number issueLimit = 10000;if (issueCount > issueLimit) {
logError("Board creation blocked: Filter returns too many issues (" + issueCount + ")");
throw("Board creation failed: The filter retrieves " + issueCount + " issues, exceeding the allowed limit of " + issueLimit);
} else {
logInfo("Board created successfully: " + boardName);
}
}
}
Hi Eric,
If you have Jira Data Center or Server, you can set a hard limit to restrict large queries by adjusting jira.search.views.max.limit in Jira’s advanced settings
If you are using Cloud and ScriptRunner plugin, you can create scripts to restrict board creation if the filter returns more than X issues.
Eg.
def jqlQuery = "your query here"
def searchResults = searchService.search(user, jqlQuery, PagerFilter.unlimitedFilter)
if (searchResults.total > 10000) {
throw new RuntimeException("Your filter returns too many issues!")
}
Ideally users shall not use broad filters (project = XYZ), add date or status constraints (e.g., updated >= -30d)
Regards,
Anshul
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anshul,
Our platform is Jira DC. We don't have ScriptRunner plugin, but we are using power script in Jira. We don't want to set a limit for issue navigator, but we'd like to prevent users from creating board from saved filter if this filter includes above 1,000 issues. Is there any solution?
Thanks,
Chengzhi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.