Skip to content

Conversation

@majiayu000
Copy link
Contributor

Summary

  • Add GET /api/version endpoint that returns version information
  • Returns app version, name, build time, git commit, and environment
  • Helps identify the version of a running Sim Studio instance

Test plan

  • Manual testing with curl /api/version

Fixes #2014

icecrasher321 and others added 8 commits December 18, 2025 16:23
…dioai#2481)

The realtime service network policy was missing the custom egress rules section
that allows configuration of additional egress rules via values.yaml. This caused
the realtime pods to be unable to connect to external databases (e.g., PostgreSQL
on port 5432) when using external database configurations.

The app network policy already had this section, but the realtime network policy
was missing it, creating an inconsistency and preventing the realtime service
from accessing external databases configured via networkPolicy.egress values.

This fix adds the same custom egress rules template section to the realtime
network policy, matching the app network policy behavior and allowing users to
configure database connectivity via values.yaml.
Adds GET /api/version endpoint that returns:
- Application version
- Application name
- Build time (if available)
- Git commit hash (if available)
- Node environment

This helps users identify the version of a running Sim Studio instance.

Fixes simstudioai#2014
@vercel
Copy link

vercel bot commented Dec 22, 2025

@majiayu000 is attempting to deploy a commit to the Sim Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Dec 22, 2025

Greptile Summary

Adds a new version endpoint that returns instance identification information including app version, build time, and git commit hash.

Key Changes:

  • New GET /api/version endpoint returns version metadata without authentication
  • Network policy updated to support custom egress rules for realtime service
  • Endpoint uses force-dynamic to prevent caching

Security Consideration:

  • Exposing NODE_ENV in the response reveals environment details that could aid reconnaissance attacks

Confidence Score: 4/5

  • This PR is safe to merge with one security consideration to address
  • The implementation is straightforward and adds useful functionality. The endpoint correctly uses force-dynamic to prevent caching. However, exposing NODE_ENV presents a minor security concern by revealing the environment type, which could aid attackers in reconnaissance. The network policy change is safe and follows established patterns.
  • Review apps/sim/app/api/version/route.ts to consider removing nodeEnv from the response

Important Files Changed

Filename Overview
apps/sim/app/api/version/route.ts New version endpoint that exposes app version, build time, git commit, and environment - potential information disclosure concern with nodeEnv
helm/sim/templates/networkpolicy.yaml Added custom egress rule support to realtime service network policy - clean infrastructure improvement

Sequence Diagram

sequenceDiagram
    participant Client
    participant API as /api/version
    participant Env as Environment Variables

    Client->>API: GET /api/version
    API->>Env: Read npm_package_version or APP_VERSION
    API->>Env: Read BUILD_TIME
    API->>Env: Read VERCEL_GIT_COMMIT_SHA or GIT_COMMIT
    API->>Env: Read NODE_ENV
    Env-->>API: Return environment values
    API->>API: Format gitCommit to 7 chars
    API-->>Client: Return JSON with version info
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Additional Comments (1)

  1. apps/sim/app/api/version/route.ts, line 22 (link)

    logic: exposing NODE_ENV could reveal whether the instance is in development/staging/production, which may aid attackers in reconnaissance

2 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

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.

4 participants