Skip to content

Conversation

@shashank-factory
Copy link

Summary

Add comprehensive security review functionality with new commands, configuration options, and Factory security skills integration.

New Commands

Command Description
@droid security Security-focused code review using STRIDE methodology
@droid review security Run both code and security reviews in parallel
@droid security review Same as above (order doesn't matter)
@droid security --full Full repository security scan (creates PR with report)

New Configuration Options

Input Default Description
automatic_security_review false Auto-run security review on PRs
security_model "" Override model for security reviews
security_severity_threshold medium Filter by severity (critical/high/medium/low)
security_block_on_critical true Block PR on critical findings
security_block_on_high false Block PR on high findings
security_notify_team "" Team to @mention on critical findings
security_scan_schedule false Enable scheduled full repo scans
security_scan_days 7 Days of commits to scan for scheduled scans

New Sub-Action

- uses: Factory-AI/droid-action/security@v1
  with:
    factory_api_key: ${{ secrets.FACTORY_API_KEY }}
    tracking_comment_id: ${{ needs.prepare.outputs.comment_id }}
    security_severity_threshold: medium

Security Skills Integration

Auto-installs Factory security skills from Factory-AI/skills:

  • threat-model-generation - STRIDE-based threat modeling
  • commit-security-scan - Vulnerability scanning
  • vulnerability-validation - False positive filtering
  • security-review - Comprehensive review and patching

Parallel Workflow

When both automatic_review and automatic_security_review are enabled, reviews run in parallel:

prepare → code-review ──┬──→ combine
         security-review ─┘

The combine step only runs when BOTH reviews are enabled, ensuring deduplicated inline comments.

Testing

  • All 344 tests pass
  • Type checking passes
  • New tests added for security commands and prompts

Depends On

Part of

This is PR 3 of 3 for the security review feature:

  1. PR feat: add modular sub-actions for parallel review workflow #8: Sub-action infrastructure
  2. PR refactor: change code review to output JSON for combine step #9: Code review refactor
  3. This PR: Security review feature

Add comprehensive security review functionality:

## New Commands
- `@droid security` - Security-focused code review using STRIDE methodology
- `@droid review security` or `@droid security review` - Run both code and security reviews in parallel
- `@droid security --full` - Full repository security scan

## New Inputs (action.yml)
- automatic_security_review - Auto-run security review on PRs
- security_model - Override model for security reviews
- security_severity_threshold - Filter by severity (critical/high/medium/low)
- security_block_on_critical - Block PR on critical findings
- security_block_on_high - Block PR on high findings
- security_notify_team - Team to @mention on critical findings
- security_scan_schedule - Enable scheduled scans
- security_scan_days - Days of commits to scan

## New Files
- security/action.yml - Security review sub-action
- src/tag/commands/security-review.ts - Security review command handler
- src/tag/commands/security-scan.ts - Full repo scan handler
- src/create-prompt/templates/security-review-prompt.ts - STRIDE-based prompt
- src/create-prompt/templates/security-report-prompt.ts - Scan report prompt
- src/entrypoints/combine-reviews.ts - Combine code + security results

## Security Skills Integration
Auto-installs Factory security skills from Factory-AI/skills:
- threat-model-generation
- commit-security-scan
- vulnerability-validation
- security-review

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@factory-droid
Copy link
Contributor

factory-droid bot commented Jan 8, 2026

Droid finished @shashank-factory's task —— View job


🔍 Code Review Summary

Reviewed the security review feature PR and found 3 potential issues worth discussing:

File Line Summary
src/github/validation/trigger.ts 21 Missing security-full and review-security commands in trigger check array
src/tag/index.ts 190 Explicit @droid security command returns early without preparing outputs
.github/workflows/droid-review.yml 97 Combine job requires BOTH reviews - may skip when security review is skipped

See inline comments for details.

needs: [prepare, code-review]
if: always() && needs.prepare.outputs.run_code_review == 'true'
needs: [prepare, code-review, security-review]
# Only run combine when BOTH code review AND security review were executed
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition requires both run_code_review AND run_security_review to be true. However, when an existing security review is detected (hasExistingSecurityReview returns true in src/tag/index.ts), run_security_review is set to false while run_code_review is true. In that case, the combine job will be skipped and the tracking comment won't be updated with the code review results.

Should this use OR logic instead (||) to run combine when either review was executed?

core.setOutput("run_code_review", "true");
core.setOutput("run_security_review", "true");
return {
skipped: false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When handling the explicit @droid security command, this returns early without calling prepareSecurityReviewMode(). As a result, droid_args and mcp_tools outputs won't be set, and downstream workflow steps that depend on these outputs will fail or behave unexpectedly.

Should this call prepareSecurityReviewMode() similar to how automaticSecurityReview is handled above?

const command = extractCommandFromContext(context);
if (command && ['fill', 'review'].includes(command.command)) {
console.log(`Detected @droid ${command.command} command, triggering action`);
if (command && ["fill", "review", "security"].includes(command.command)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The security-full and review-security commands are missing from this trigger check array. Since parseDroidCommand() in command-parser.ts recognizes these commands, users invoking @droid security --full or @droid review security will not trigger the action.

Could we update this to include all security-related commands?

Suggested change
if (command && ["fill", "review", "security"].includes(command.command)) {
if (command && ["fill", "review", "security", "security-full", "review-security"].includes(command.command)) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants