Restrict OpenAI gateway endpoint to internal network after detecting unauthorized external probes #70

Open
opened 2026-07-13 00:37:05 +02:00 by retoor · 21 comments
Owner

Summary

The OpenAI gateway log shows two rejected connection attempts from external sources, indicating the /openai/v1/chat/completions endpoint is publicly reachable. External parties are actively probing for open/leaked LLM endpoints. One rejected call had a latency of 12335ms, meaning a full connection was held open before rejection.

Steps to Reproduce

  1. Review the OpenAI gateway log for rejected connection attempts from external sources.
  2. Observe entries such as:
    [22:31:02] Rejected POST /chat/completions: unauthorized
    [22:31:11] Rejected POST /chat/completions: unauthorized
    
  3. Note that the endpoint is publicly reachable and external probes are occurring.

Expected Behaviour

The /openai/v1/chat/completions endpoint should not be publicly reachable. It should be restricted to internal network access only (127.0.0.1/localhost), as all internal services already use localhost URLs.

Actual Behaviour

The endpoint is publicly reachable, and external unauthorized connection attempts are being logged. One rejected call had a latency of 12335ms, indicating a full connection was held open before rejection.

Environment

Not provided.


Reported by retoor via DevPlace.

## Summary The OpenAI gateway log shows two rejected connection attempts from external sources, indicating the `/openai/v1/chat/completions` endpoint is publicly reachable. External parties are actively probing for open/leaked LLM endpoints. One rejected call had a latency of 12335ms, meaning a full connection was held open before rejection. ## Steps to Reproduce 1. Review the OpenAI gateway log for rejected connection attempts from external sources. 2. Observe entries such as: ``` [22:31:02] Rejected POST /chat/completions: unauthorized [22:31:11] Rejected POST /chat/completions: unauthorized ``` 3. Note that the endpoint is publicly reachable and external probes are occurring. ## Expected Behaviour The `/openai/v1/chat/completions` endpoint should not be publicly reachable. It should be restricted to internal network access only (127.0.0.1/localhost), as all internal services already use localhost URLs. ## Actual Behaviour The endpoint is publicly reachable, and external unauthorized connection attempts are being logged. One rejected call had a latency of 12335ms, indicating a full connection was held open before rejection. ## Environment Not provided. --- *Reported by **retoor** via DevPlace.*
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

Starting research round 1 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 1 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

The ticket was compared against the current source and tests. The findings show that the requested restriction—limiting the OpenAI gateway to internal network access—is already implemented in two independent layers (Python middleware and nginx), with unit tests verifying the behavior. The ticket description appears to match an earlier version of the codebase rather than the current state.

Could you confirm whether the ticket description is still accurate, or should it be closed as already implemented?

The ticket was compared against the current source and tests. The findings show that the requested restriction—limiting the OpenAI gateway to internal network access—is already implemented in two independent layers (Python middleware and nginx), with unit tests verifying the behavior. The ticket description appears to match an earlier version of the codebase rather than the current state. Could you confirm whether the ticket description is still accurate, or should it be closed as already implemented?
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

I need input to continue.

What I tried: Retried this step 3 times.
What I found: Each attempt failed for internal reasons unrelated to this ticket. The details are in the operator's logs; this is not a judgment about the ticket.

The system needs operator attention before I can continue. Reply here once things are healthy and I will resume from where I left off.

I need input to continue. What I tried: Retried this step 3 times. What I found: Each attempt failed for internal reasons unrelated to this ticket. The details are in the operator's logs; this is not a judgment about the ticket. The system needs operator attention before I can continue. Reply here once things are healthy and I will resume from where I left off.
Collaborator

I am picking this ticket up now.

First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.

I am picking this ticket up now. First I will bring up an isolated workspace with a fresh checkout and investigate whether the ticket matches the current state of the code before planning any change. I will announce every step here before I take it.
Collaborator

Starting research round 1 of at most 5.

I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.

Starting research round 1 of at most 5. I am now reading the relevant source, tests, and prior work in the live checkout to verify the ticket and gather the context needed for a concrete plan. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Investigated the ticket against the current source and tests. The issue is confirmed: the /openai/v1/chat/completions endpoint is publicly reachable on master with only application-level authentication, and external probes are visible in logs. A two-layer fix (nginx + Python middleware) already exists on the feature branch typosaurus/ticket-70 and has not been merged.

The problem is well-understood and actionable. Next step is drafting a concrete implementation plan for merging the fix.

Investigated the ticket against the current source and tests. The issue is confirmed: the `/openai/v1/chat/completions` endpoint is publicly reachable on `master` with only application-level authentication, and external probes are visible in logs. A two-layer fix (nginx + Python middleware) already exists on the feature branch `typosaurus/ticket-70` and has not been merged. The problem is well-understood and actionable. Next step is drafting a concrete implementation plan for merging the fix.
Collaborator

I am drafting the implementation plan now.

The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.

I am drafting the implementation plan now. The research confirmed the ticket; I am turning the findings into a concrete, verifiable plan.
Collaborator

Implementation plan drafted from the investigation findings. The plan covers merging the two-layer IP restriction fix from typosaurus/ticket-70 into master, resolving the known merge conflicts in five files by discarding unintended changes from the ticket branch, addressing the pre-existing test failure in tests/unit/content.py, and running the full verification suite.

The plan is now being handed to the execution agent for implementation. No further action is required on this ticket at this time.

Implementation plan drafted from the investigation findings. The plan covers merging the two-layer IP restriction fix from `typosaurus/ticket-70` into `master`, resolving the known merge conflicts in five files by discarding unintended changes from the ticket branch, addressing the pre-existing test failure in `tests/unit/content.py`, and running the full verification suite. The plan is now being handed to the execution agent for implementation. No further action is required on this ticket at this time.
Collaborator

The full, verbatim implementation plan is attached: plan-ticket-70.md

The full, verbatim implementation plan is attached: [plan-ticket-70.md](https://retoor.molodetz.nl/attachments/92438f2d-7b3f-44a3-a973-87ad9bce6272)
Collaborator

Starting implementation attempt 1 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 1 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Progress update: implementation attempt 1 is still running (10 minutes elapsed). I have not stalled; I will report the result here the moment this step completes.

Progress update: implementation attempt 1 is still running (10 minutes elapsed). I have not stalled; I will report the result here the moment this step completes.
Collaborator

Implementation attempt 1 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 1 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

Attempt 1 did not succeed because the change failed to apply cleanly or did not pass the project’s own checks, specifically the test_command validation. The next attempt will incorporate the recorded failure details and lessons from the prompt, targeting a cleaner application and successful validation.

Attempt 1 did not succeed because the change failed to apply cleanly or did not pass the project’s own checks, specifically the test_command validation. The next attempt will incorporate the recorded failure details and lessons from the prompt, targeting a cleaner application and successful validation.
Collaborator

Starting implementation attempt 2 of at most 5.

I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.

Starting implementation attempt 2 of at most 5. I am executing the plan inside this ticket's isolated workspace. This can take a while; I will post periodic progress updates until it completes.
Collaborator

Progress update: implementation attempt 2 is still running (10 minutes elapsed). I have not stalled; I will report the result here the moment this step completes.

Progress update: implementation attempt 2 is still running (10 minutes elapsed). I have not stalled; I will report the result here the moment this step completes.
Collaborator

Implementation attempt 2 finished; I am verifying it now.

Running the project's own build, test, and lint commands against the change.

Implementation attempt 2 finished; I am verifying it now. Running the project's own build, test, and lint commands against the change.
Collaborator

Attempt 2 did not succeed due to checks failing on test_command. The change either did not apply cleanly or did not meet the project's validation requirements.

The next attempt will incorporate the recorded failure details and adjustments based on previous findings.

Attempt 2 did not succeed due to checks failing on test_command. The change either did not apply cleanly or did not meet the project's validation requirements. The next attempt will incorporate the recorded failure details and adjustments based on previous findings.
Collaborator

A conflict appeared while rebasing onto master; I am resolving it now.

Handing the conflicting files to the execution agent for one resolution attempt.

A conflict appeared while rebasing onto `master`; I am resolving it now. Handing the conflicting files to the execution agent for one resolution attempt.
Collaborator

The ticket branch was rebased onto master and the automated merge attempted to resolve the conflict, but the overlapping changes could not be reconciled automatically. The divergence appears to involve logic that both branches modified in incompatible ways, leaving no clear path for a mechanical resolution.

How should these conflicting changes be reconciled?

The ticket branch was rebased onto `master` and the automated merge attempted to resolve the conflict, but the overlapping changes could not be reconciled automatically. The divergence appears to involve logic that both branches modified in incompatible ways, leaving no clear path for a mechanical resolution. How should these conflicting changes be reconciled?
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: retoor/devplacepy#70
No description provided.