fix: align DOCUMENT_ENGINE_API_AUTH_TOKEN docs/tests and fail-closed auth for the HTTP transport - #13
Open
jdrhyne wants to merge 2 commits into
Open
fix: align DOCUMENT_ENGINE_API_AUTH_TOKEN docs/tests and fail-closed auth for the HTTP transport#13jdrhyne wants to merge 2 commits into
jdrhyne wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Aligns Document Engine configuration and hardens HTTP transport authentication.
Changes:
- Corrects authentication environment-variable references and integration-test skipping.
- Adds fail-closed HTTP bearer authentication and loopback detection.
- Documents and tests the new security behavior.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.env.example |
Corrects token variable and host default. |
README.md |
Documents HTTP security requirements. |
docs/configuration.md |
Expands HTTP transport configuration guidance. |
src/index.ts |
Applies authentication middleware to /mcp. |
src/utils/Environment.ts |
Validates HTTP security configuration. |
src/utils/HttpSecurity.ts |
Implements loopback checks and bearer authentication. |
test/environment.test.ts |
Tests environment validation changes. |
test/httpSecurity.test.ts |
Tests HTTP security behavior. |
test/integration.test.ts |
Corrects integration gating and documentation. |
test/integration/layers.test.ts |
Corrects layer integration gating. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two fixes from the MCP portfolio review's desk audit of this server:
.env.examplenamedDOCUMENT_ENGINE_AUTH_TOKEN, but the code readsDOCUMENT_ENGINE_API_AUTH_TOKEN; the integration tests gated on the wrong name too and didn't apply their computed skip flag. All aligned; integration tests now skip cleanly without an engine.MCP_TRANSPORT=httpendpoint had no inbound auth and could bind beyond loopback. Now:MCP_HOSTdefaults to127.0.0.1.MCP_HTTP_AUTH_TOKEN; otherwise the server refuses to start with an error naming the variable./mcprequest must carryAuthorization: Bearer <token>(SHA-256 digests compared withtimingSafeEqual); anything else gets401before JSON parsing./healthand/dashboardare unaffected; stdio transport (the default) is untouched.Tests
pnpm test: 210 passed, 43 integration skipped (no engine).pnpm run lintandpnpm run buildclean. New:test/httpSecurity.test.ts(middleware + loopback detection + fail-closed startup),test/environment.test.tsadditions.https://claude.ai/code/session_0168QbHA5yAyXyYLUfPxvSoQ