Skip to content

Conversation

@HappyPaul55
Copy link
Contributor

@HappyPaul55 HappyPaul55 commented Nov 14, 2025

This pull request introduces updates to the TeamViewer integration, focusing on improved configuration and type safety. The main changes are enhancements to how sensitive credentials are injected into requests, and a minor TypeScript improvement for constants.

TeamViewer integration improvements:

  • Added a settingsInjection configuration for both the OAuth authorization and API endpoints in manifest.json, allowing client_id, client_secret, and global_access_token to be injected into the request body from settings.

Code quality and type safety:

  • Updated the placeholders object in src/services/teamviewer/constants.ts to use as const, ensuring stricter type safety for the exported constants.

Summary by Sourcery

Improve TeamViewer integration by enabling credential injection via settingsInjection in the app proxy manifest and strengthen type safety of placeholder constants

New Features:

  • Add settingsInjection configuration to manifest.json for TeamViewer OAuth and API endpoints to inject client_id, client_secret, and global_access_token into request bodies

Enhancements:

  • Apply 'as const' to the placeholders object in TeamViewer constants for stricter type safety

@HappyPaul55 HappyPaul55 requested a review from a team as a code owner November 14, 2025 12:22
@sourcery-ai
Copy link

sourcery-ai bot commented Nov 14, 2025

Reviewer's Guide

This PR enhances the TeamViewer integration by introducing a settingsInjection configuration to securely inject sensitive credentials into OAuth and API requests, and strengthens type safety by marking the placeholders object as const.

Entity relationship diagram for settingsInjection configuration in manifest.json

erDiagram
    SETTINGS_INJECTION {
        string client_id
        string client_secret
        string global_access_token
    }
    REQUEST_BODY {
        string client_id
        string client_secret
        string refresh_token
    }
    SETTINGS_INJECTION ||--|| REQUEST_BODY : injects
Loading

Class diagram for updated placeholders constant in TeamViewer service

classDiagram
    class placeholders {
        +string GLOBAL_REFRESH_TOKEN
        +string ACCESS_TOKEN
        +string REFRESH_TOKEN
    }
    %% The object is now marked as const for type safety
Loading

File-Level Changes

Change Details Files
Introduce settingsInjection configuration to restrict where token replacements can be injected
  • Added settingsInjection block to OAuth authorization endpoint in manifest.json
  • Added settingsInjection block to TeamViewer API endpoint in manifest.json
manifest.json
Enhanced type safety for placeholders constants
  • Appended as const to placeholders object in constants.ts
src/services/teamviewer/constants.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@HappyPaul55 HappyPaul55 requested review from Copilot and removed request for a team November 14, 2025 12:22
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • The settingsInjection objects for the two endpoints are identical—consider extracting them into a shared constant or reference to reduce duplication and ensure consistency across your manifest.
  • Double-check that your placeholders (e.g. GLOBAL_REFRESH_TOKEN) align exactly with the body keys ("refresh_token") defined in settingsInjection to avoid runtime mismatches.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The settingsInjection objects for the two endpoints are identical—consider extracting them into a shared constant or reference to reduce duplication and ensure consistency across your manifest.
- Double-check that your placeholders (e.g. GLOBAL_REFRESH_TOKEN) align exactly with the body keys ("refresh_token") defined in settingsInjection to avoid runtime mismatches.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@github-actions
Copy link

github-actions bot commented Nov 14, 2025

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request aims to improve app proxy security by adding settingsInjection configuration to TeamViewer integration endpoints, along with a TypeScript type safety improvement. However, there are several critical issues with the implementation that will prevent it from working correctly.

Key Issues Identified:

  • The OAuth authorize endpoint (GET request) is configured to inject credentials into the request body, which is not supported for GET requests
  • The broad API endpoint pattern injects sensitive credentials into all API calls unnecessarily, when only the token endpoint requires them
  • The global_access_token JSON object is being injected directly into refresh_token body parameters without extracting the actual refresh token field

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
src/services/teamviewer/constants.ts Added as const assertion to placeholders object for improved type safety
manifest.json Added settingsInjection configuration for OAuth authorize and API endpoints, but with incorrect mappings that will cause authentication failures

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +80 to +82
"global_access_token": {
"body": ["refresh_token"]
}
Copy link

Copilot AI Nov 14, 2025

Choose a reason for hiding this comment

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

Same issue as line 64-66: The mapping of global_access_token to body parameter refresh_token appears incorrect. The global_access_token setting stores a JSON object containing both accessToken and refreshToken fields, not just the refresh token string.

This configuration will inject the entire JSON string where only the refresh token value is expected, causing OAuth token refresh requests to fail. The settingsInjection configuration needs to support JSON field extraction similar to the placeholder syntax used in the codebase: __global_access_token.json("[refreshToken]")__.

Copilot uses AI. Check for mistakes.
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