Skip to content

Conversation

@shashank-factory
Copy link
Contributor

Summary

Add support for security-focused code review commands.

New Commands

  • @droid security - Security review on PR changes using STRIDE methodology
  • @droid security --full - Full repository security scan with threat model generation

Changes

  • Security command parser (security, review-security, security-full)
  • Security review prompt with STRIDE methodology and severity definitions
  • Security scan prompt with threat model generation and PR creation
  • Security configuration inputs in action.yml
  • Security-specific tracking comment message

New Files

  • src/tag/commands/security-review.ts
  • src/tag/commands/security-scan.ts
  • src/create-prompt/templates/security-review-prompt.ts
  • src/create-prompt/templates/security-report-prompt.ts

This PR is part of a split from the security review feature branch.

PR Stack

  1. Formatting cleanup (chore: code formatting and style cleanup #16)
  2. This PR - Security commands foundation
  3. Review prompt JSON output pattern (next)
  4. Parallel workflow architecture (final)

Copy link
Contributor

@factory-droid factory-droid bot left a comment

Choose a reason for hiding this comment

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

Overall the security-command additions look directionally correct, but there are a couple of input/flow edge cases that can lead to non-deterministic behavior (NaN scan days) or prompts missing the tracking comment id in some paths. Addressing the inline notes should make the new security flows more robust.

Copy link
Contributor

@factory-droid factory-droid bot left a comment

Choose a reason for hiding this comment

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

Overall: the feature wiring looks coherent, but the security-review prompt currently instructs potentially unsafe/incorrect behavior (committing files to the contributor’s PR and suppressing inline comments), which can break expected review semantics. Fixing those prompt directives should make the new security flows safer and more reliable.

Base automatically changed from ssharma/pr1-formatting to dev January 15, 2026 18:21
@factory-droid
Copy link
Contributor

factory-droid bot commented Jan 15, 2026

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


shashank-factory and others added 2 commits January 15, 2026 10:22
Add support for security-focused code review commands:

- @droid security - Security review on PR changes
- @droid security --full - Full repository security scan

New features:
- Security command parser (security, review-security, security-full)
- Security review prompt with STRIDE methodology
- Security scan prompt with threat model generation
- Security configuration inputs in action.yml
- Security-specific tracking comment message

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Fix SECURITY_SCAN_DAYS to avoid NaN (clamp to positive integer, default 7)
- Remove instructions to commit threat model to PR branch during review
- Remove instructions to commit patches to PR branch
- Align security review with JSON output pattern (no direct inline comments)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
## Output Requirements
IMPORTANT: Do NOT post inline comments directly. Instead, write findings to a JSON file.
The finalize step will post all inline comments to avoid overlapping with code review comments.
Copy link
Contributor

Choose a reason for hiding this comment

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

[P1] Don’t forbid inline comments without providing a poster

This prompt says “do NOT post inline comments directly” and instead write security-review-results.json, but there’s no code in this PR that reads that file and posts the comments—so security reviews can silently produce zero inline feedback.

@varin-nair-factory varin-nair-factory force-pushed the ssharma/pr2-security-commands branch from dff43cf to 01e9df8 Compare January 15, 2026 18:22
Copy link
Contributor

@factory-droid factory-droid bot left a comment

Choose a reason for hiding this comment

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

Overall: the PR is mostly correct and prior P1 issues look addressed, but the security-review prompt still instructs writing a JSON file instead of posting inline comments, and there’s no mechanism added here to publish those findings—so security review runs can end up with no inline feedback.

);
if (combinedMatch) {
return {
command: "review-security",
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is review-security? Is that where both code review and security review get triggered?

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
Collaborator

Choose a reason for hiding this comment

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

Shouldn't we also check for security-full command?

Comment on lines +110 to +111
const securityModel =
process.env.SECURITY_MODEL?.trim() || process.env.REVIEW_MODEL?.trim();
Copy link
Collaborator

Choose a reason for hiding this comment

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

The code prefers SECURITY_MODEL over REVIEW_MODEL as a fallback, which is sensible. However, this precedence isn't documented in action.yml descriptions, which could confuse users who set both variables.

Comment on lines +57 to +60
const isSecurityCommand =
context.inputs.automaticSecurityReview ||
commandContext?.command === "security" ||
commandContext?.command === "security-full";
Copy link
Collaborator

Choose a reason for hiding this comment

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

what about security-review? You added that as an option in DroidCommand (command-parser.ts)

Copy link
Collaborator

@varin-nair-factory varin-nair-factory left a comment

Choose a reason for hiding this comment

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

approving to unblock, but pls see comments

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.

3 participants