Skip to content

Docker: Add more logs to video container #2783

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 14, 2025
Merged

Docker: Add more logs to video container #2783

merged 1 commit into from
Apr 14, 2025

Conversation

VietND96
Copy link
Member

@VietND96 VietND96 commented Apr 14, 2025

User description

Thanks for contributing to the Docker-Selenium project!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines, applied for this repository.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

PR Type

Enhancement


Description

  • Added a new endpoint NODE_OWNER_ENDPOINT for session ownership checks.

  • Introduced headers for Node Registration Secret validation.

  • Enhanced logging for better debugging and process tracking.

  • Improved handling of video recording and container restart policies.


Changes walkthrough 📝

Relevant files
Enhancement
video.sh
Add session ownership checks and logging enhancements       

Video/video.sh

  • Added NODE_OWNER_ENDPOINT for session ownership checks.
  • Introduced conditional headers for Node Registration Secret.
  • Enhanced logging for API responses and process tracking.
  • Improved handling of recording and container restart policies.
  • +11/-0   

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 Security concerns

    Sensitive information exposure:
    The PR adds code to handle registration secrets (SE_REGISTRATION_SECRET) which is a security credential. While the implementation itself doesn't directly expose the secret, the code sets this value in HTTP headers. Ensure that these communications are properly encrypted (HTTPS) and that logs don't inadvertently expose this secret value during debugging or error conditions.

    ⚡ Recommended focus areas for review

    Unused Variable

    The NODE_OWNER_ENDPOINT is defined but never used in the visible code. This endpoint is added in two places but there's no code showing how it's being utilized.

      NODE_OWNER_ENDPOINT="$(python3 /opt/bin/video_gridUrl.py)/se/grid/node/owner"
    else
      JQ_SESSION_ID_QUERY=".[]?.node?.slots | .[0]?.session?.sessionId"
      SE_NODE_PORT=${SE_NODE_PORT:-"5555"}
      NODE_STATUS_ENDPOINT="${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/status"
      NODE_OWNER_ENDPOINT="${SE_SERVER_PROTOCOL}://${DISPLAY_CONTAINER_NAME}:${SE_NODE_PORT}/se/grid/node/owner"
    Header Implementation

    The HEADERS variable is set but not used in any of the visible API calls. Additionally, the else branch sets an invalid header format with a semicolon at the end.

    if [ ! -z "${SE_REGISTRATION_SECRET}" ]; then
      HEADERS="X-REGISTRATION-SECRET: ${SE_REGISTRATION_SECRET}"
    else
      HEADERS="X-REGISTRATION-SECRET;"
    fi

    @VietND96 VietND96 merged commit 89f3415 into trunk Apr 14, 2025
    79 of 81 checks passed
    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Fix invalid header format

    The else clause sets an invalid header format with a semicolon at the end. When
    the registration secret is not set, you should either omit the header entirely
    or set it to an empty value, not use an invalid syntax.

    Video/video.sh [42-47]

     # Set headers if Node Registration Secret is set
     if [ ! -z "${SE_REGISTRATION_SECRET}" ]; then
       HEADERS="X-REGISTRATION-SECRET: ${SE_REGISTRATION_SECRET}"
     else
    -  HEADERS="X-REGISTRATION-SECRET;"
    +  HEADERS=""
     fi
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    __

    Why: The current code sets an invalid header format with a semicolon when SE_REGISTRATION_SECRET is not set. This could cause API requests to fail due to malformed headers, potentially breaking the node registration functionality.

    Medium
    • More

    @VietND96 VietND96 deleted the video-stop branch April 14, 2025 15:43
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant