Skip to content

fix: publish the endpoint guard through aiToolkit's public barrel - #5625

Open
Bryandero98 wants to merge 1 commit into
atomantic:mainfrom
Bryandero98:fix/aitoolkit-endpoint-guard-public-export
Open

fix: publish the endpoint guard through aiToolkit's public barrel#5625
Bryandero98 wants to merge 1 commit into
atomantic:mainfrom
Bryandero98:fix/aitoolkit-endpoint-guard-public-export

Conversation

@Bryandero98

Copy link
Copy Markdown
Contributor

Summary

  • evaluateSecretEndpoint/assertSecretEndpoint (the SSRF/key-exfiltration guard for provider endpoint URLs) lived only at the toolkit's private internal/endpointGuard.js path, yet six server/services/* modules imported it from there directly.
  • Promotes both as named exports of server/lib/aiToolkit/index.js and repoints every service import at the public barrel. internal/endpointGuard.js stays the sole implementation — this is an API-path correction, not a policy change.
  • Documents the new public surface in server/lib/README.md.
  • The guard's own contract test now imports through the barrel, so it exercises what services actually call.
  • Fixed a stale test mock (visionTest.frameGuard.test.js) still pinned to the old internal path, found while grepping the whole repo for any remaining reference — it would have silently stopped intercepting the guard call once the production import moved.

Test plan

  • npx vitest run lib/aiToolkit/internal/endpointGuard.test.js services/aiProvider.test.js services/askService.test.js services/localLlmPlayground.test.js services/visionTest.test.js services/voice/llm.test.js services/insightsService.test.js services/visionTest.frameGuard.test.js — all pass
  • Repo-wide grep confirms no remaining production import of aiToolkit/internal/endpointGuard.js outside the toolkit's own internal modules (providers.js, runner.js, validation.js)
  • Sanity-checked the barrel resolves with no circular-import error

Fixes #5619

evaluateSecretEndpoint/assertSecretEndpoint (SSRF/key-exfiltration guard
for provider endpoint URLs) lived only at the toolkit's private
internal/endpointGuard.js path, yet six server/services/* modules
imported it from there directly, coupling every one of them to a
vendored internal file path.

Promote both as named exports of server/lib/aiToolkit/index.js and
repoint every service import at the public barrel instead. The
internal/ implementation is unchanged - this is an API-path
correction, not a policy change. Its contract test now imports through
the barrel so it exercises what services actually call, and a stale
test mock pinned to the old internal path (visionTest.frameGuard.test.js)
is updated to match.

Fixes atomantic#5619
@Bryandero98

Copy link
Copy Markdown
Contributor Author

Thanks for the well-specified issue — the reuse search and the exact call-site list made this a clean, mechanical fix to verify end-to-end. Happy to adjust anything or take on more of this module-hygiene series if useful.

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.

[module-hygiene-provider-endpoint-guard] Publish the AI endpoint guard through the toolkit API

1 participant