Skip to content

Add missing image_handler.py and image_verification.html for snapshot camera verification #71

Merged
rquidute merged 4 commits intov2.15-cli-developfrom
fix/908_fix_camera_screenshot_capture
Mar 10, 2026
Merged

Add missing image_handler.py and image_verification.html for snapshot camera verification #71
rquidute merged 4 commits intov2.15-cli-developfrom
fix/908_fix_camera_screenshot_capture

Conversation

@rquidute
Copy link
Contributor

@rquidute rquidute commented Mar 9, 2026

What Changed

  • Add th_cli/test_run/camera/image_handler.py — implements ImageVerificationHandler, which starts a local HTTP server to serve the captured snapshot image and waits for a user PASS/FAIL response via the web UI
    • Add th_cli/test_run/camera/image_verification.html — HTML template rendered by the server, showing the snapshot and radio-button options for the user to submit a response
    • Export ImageVerificationHandler from th_cli/test_run/camera/init.py so it is importable by prompt_manager.py

Related Issue

project-chip/certification-tool#908

Testing

CLI is able to run TC-AVSM-2.10.
In order to reproduce the issue, I performed the command bellow since I don't have a proper DUT to perform the test run execution: gst-launch-1.0 v4l2src device=/dev/video0 num-buffers=1 ! videoconvert ! jpegenc ! filesink location=./capture_snapshot.jpg and rm -rf /tmp/chip_*;./chip-camera-app

Screenshot 2026-03-09 at 15 24 15

@rquidute rquidute self-assigned this Mar 9, 2026
@gemini-code-assist
Copy link
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 mechanism for visual verification of camera snapshots within the Matter Certification Tool's CLI. It establishes a local HTTP server to display captured images to the user and gather their pass/fail feedback through a dedicated web interface, streamlining the manual verification step in camera-related test cases.

Highlights

  • New Image Verification Handler: Added image_handler.py which implements ImageVerificationHandler to serve snapshot images and collect user responses via a local HTTP server.
  • Web User Interface for Verification: Added image_verification.html which provides the web UI for displaying the snapshot and allowing user input for verification.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • th_cli/test_run/camera/image_handler.py
    • Implemented a new Python module that sets up and manages a local HTTP server to display camera snapshots and process user verification responses.
  • th_cli/test_run/camera/image_verification.html
    • Created a new HTML template that defines the user interface for the snapshot image verification process, including image display and interactive response options.
Activity
  • The author tested the changes by running TC-AVSM-2.10 and provided specific commands to reproduce the issue and test the functionality.
  • A screenshot of the new web interface was included to demonstrate the feature.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
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 an ImageVerificationHandler for manual verification of snapshot images through a web UI, including a Python-based HTTP server and an HTML template. While the functionality is correctly implemented, there are several security concerns regarding the local HTTP server. Specifically, the server binds to all network interfaces (0.0.0.0) without authentication, uses a permissive CORS policy (*), and is vulnerable to Cross-Site Scripting (XSS) due to unescaped user-controlled values in the generated HTML. These issues could allow unauthorized users on the network or malicious websites to view snapshots and manipulate test results. Additionally, the review identifies a significant security vulnerability (CSRF) and offers suggestions to improve code quality by removing an unused parameter and refining exception handling for better robustness and maintainability.

@rquidute rquidute requested review from antonio-amjr and oxesoft March 9, 2026 19:49
@rquidute rquidute merged commit cc20100 into v2.15-cli-develop Mar 10, 2026
2 checks passed
@rquidute rquidute deleted the fix/908_fix_camera_screenshot_capture branch March 10, 2026 15:05
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