Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/issue-assistant/src/security.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ async function validateRequest({
context,
maxInputLength,
rateLimitPerHour,
maxBotResponses,
customInjectionPatterns,
customSuspiciousPatterns
}) {
Expand Down Expand Up @@ -226,7 +227,7 @@ async function validateRequest({
errors.push('Rate limit exceeded');
}

if (comment) {
if (comment && maxBotResponses !== undefined) {
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -237,7 +238,7 @@ async function validateRequest({
c.body && c.body.includes('<!-- msdo-issue-assistant -->')
);

if (botComments.length >= 3) {
if (botComments.length >= maxBotResponses) {
errors.push('Maximum bot responses reached');
}
}
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/issue-assistant.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ env:
MAX_INPUT_LENGTH: 10000
MAX_BOT_RESPONSES: 4
MIN_RESPONSE_INTERVAL_SECONDS: 120
RATE_LIMIT_PER_USER_PER_HOUR: 10
RATE_LIMIT_PER_USER_PER_HOUR: 12

jobs:
validate-and-triage:
Expand Down Expand Up @@ -283,6 +283,7 @@ jobs:
context,
maxInputLength: parseInt(process.env.MAX_INPUT_LENGTH),
rateLimitPerHour: parseInt(process.env.RATE_LIMIT_PER_USER_PER_HOUR),
maxBotResponses: parseInt(process.env.MAX_BOT_RESPONSES),
customInjectionPatterns: injectionPatterns
});

Expand Down