Skip to content

gemini-cyber-cli#25591

Open
JSNrepo wants to merge 21 commits intogoogle-gemini:mainfrom
JSNrepo:main
Open

gemini-cyber-cli#25591
JSNrepo wants to merge 21 commits intogoogle-gemini:mainfrom
JSNrepo:main

Conversation

@JSNrepo
Copy link
Copy Markdown

@JSNrepo JSNrepo commented Apr 17, 2026

Summary

Details

Related Issues

How to Validate

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Copilot AI and others added 10 commits April 17, 2026 17:17
Add Gemini-Cyber extension scaffold with HATS MCP bridge, skills, and cyber commands
@JSNrepo JSNrepo requested review from a team as code owners April 17, 2026 18:21
@google-cla
Copy link
Copy Markdown

google-cla bot commented Apr 17, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new extension, 'gemini-cyber-cli', designed to bridge the Gemini CLI with the HATS framework. By leveraging the Model Context Protocol (MCP), this change enables automated security reconnaissance and reporting workflows directly within the CLI environment, enhancing the tool's capabilities for ethical hacking and security assessments.

Highlights

  • New Extension Scaffold: Added a new 'gemini-cyber-cli' extension that integrates the HATS framework via an MCP bridge.
  • MCP Bridge Implementation: Implemented a Python-based MCP server that exposes HATS framework capabilities like port scanning, service detection, and vulnerability lookup as structured tools.
  • Custom Commands: Added new '/scan' and '/report' commands to facilitate automated reconnaissance and professional penetration testing reporting.
  • Documentation and Configuration: Updated documentation with setup instructions and added configuration files for extension behavior and skill definitions.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the Gemini-Cyber extension, which integrates the HATS framework into Gemini CLI via an MCP server. It includes new commands for scanning and reporting, along with specialized skills for reconnaissance and exploit verification. Feedback identifies high-severity security risks related to prompt injection in the command prompts and recommends implementing stricter input validation and trimming for tool parameters in the Python MCP bridge.

Comment on lines +5 to +24
Use the latest 10 tool outputs in this session as the evidence base.
If fewer than 10 are available, use all available outputs and explicitly say so.

Required sections:
1. Executive Summary
2. Scope and Methodology
3. Reconnaissance Findings
4. Validated Vulnerabilities
5. Risk Prioritization Matrix
6. Remediation Recommendations
7. Evidence Appendix

For each finding include:
- Asset
- Evidence source/tool output reference
- Severity
- Confidence
- Impact
- Recommended fix
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The prompt for generating penetration testing reports is vulnerable to indirect prompt injection. It instructs the LLM to use the latest 10 tool outputs as evidence, but these outputs contain data from external, potentially malicious targets (e.g., service banners, version strings). A crafted string from a scanned target could manipulate the LLM's behavior, leading to unauthorized actions like scanning internal hosts or exfiltrating data. The prompt should be updated to treat tool outputs as untrusted data and use delimiters to separate them from instructions.

Comment on lines +3 to +18
You are executing /scan for target input: {{args}}.
Run this exact workflow with HATS MCP tools:
1) hats_port_scan
2) hats_service_detection
3) hats_vulnerability_lookup
If useful, run hats_recon_chain to consolidate outputs.
Return:
- Target and scan scope
- Open ports
- Identified services/versions
- Correlated vulnerabilities with severity and confidence
- Next recommended recon or verification step
"""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

security-high high

The prompt for the /scan command directly concatenates user-supplied arguments ({{args}}) into the prompt without sanitization or delimitation. This makes it vulnerable to direct prompt injection, where a user could provide input that overrides the intended workflow (e.g., skipping service detection or targeting unauthorized hosts). While the impact is limited to the user's own session in a CLI context, it represents a failure to follow LLM safety best practices for handling untrusted input.



async def _call_hats_function(tool_name: str, kwargs: dict[str, Any]) -> dict[str, Any]:
try:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

According to the general rules, string parameters from tools should be trimmed and checked for emptiness to prevent whitespace-only values from being accepted. This is especially important for the target parameter which is central to these security tools. Centralizing this logic in _call_hats_function ensures all tools (including the recon chain) adhere to this requirement.

    kwargs = {k: (v.strip() if isinstance(v, str) else v) for k, v in kwargs.items()}
    if "target" in kwargs and not kwargs["target"]:
        return {
            "tool": tool_name,
            "timestamp": _format_utc_timestamp(),
            "status": "error",
            "input": _convert_to_json_serializable(kwargs),
            "error": "The 'target' parameter cannot be empty or whitespace only.",
        }

    try:
References
  1. When validating string parameters from tools, trim the string first and then check for emptiness to prevent whitespace-only values from being accepted.

@gemini-cli gemini-cli bot added the priority/p1 Important and should be addressed in the near term. label Apr 17, 2026
JSNrepo and others added 10 commits April 18, 2026 00:37
Revert "Add Gemini-Cyber extension scaffold with HATS MCP bridge, skills, and cyber commands"
…sion

Refresh README for Gemini-Cyber-CLI scope, HATS MCP bridge, and cyber command usage
@JSNrepo JSNrepo requested a review from a team as a code owner April 18, 2026 09:43
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 18, 2026

🛑 Action Required: Evaluation Approval

Steering changes have been detected in this PR. To prevent regressions, a maintainer must approve the evaluation run before this PR can be merged.

Maintainers:

  1. Go to the Workflow Run Summary.
  2. Click the yellow 'Review deployments' button.
  3. Select the 'eval-gate' environment and click 'Approve'.

Once approved, the evaluation results will be posted here automatically.

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

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants