add client origin header - #9
Merged
Merged
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
Pull request overview
Adds an X-Engram-Client header to outgoing Engram requests so the backend can identify the calling client (platform + plugin version).
Changes:
- Introduces
plugin/core/client_origin.pyto build an origin header using the plugin manifest version. - Adds the origin header to both SDK (
EngramClient) construction and the RESTengram_gethelper. - Adds unit tests to validate platform/version/header formatting without importing the full plugin package.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
plugin/core/client.py |
Attaches the client-origin header to SDK and REST requests. |
plugin/core/client_origin.py |
Implements origin header generation from .claude-plugin/plugin.json. |
plugin/tests/test_client_origin.py |
Adds tests for platform detection, manifest version reading, and header formatting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+1
to
+22
| import json | ||
| import os | ||
|
|
||
| _MANIFEST = os.path.join( | ||
| os.path.dirname(__file__), "..", ".claude-plugin", "plugin.json" | ||
| ) | ||
|
|
||
|
|
||
| def _platform(): | ||
| return "claude" | ||
|
|
||
|
|
||
| def _plugin_version(): | ||
| try: | ||
| with open(_MANIFEST) as f: | ||
| return json.load(f).get("version", "unknown") | ||
| except Exception: | ||
| return "unknown" | ||
|
|
||
|
|
||
| def client_origin_header(): | ||
| return {"X-Engram-Client": f"{_platform()}-plugin/{_plugin_version()}"} |
danmichaeljones
approved these changes
Aug 10, 2026
Comment on lines
+9
to
+10
| def _platform(): | ||
| return "claude" |
There was a problem hiding this comment.
Can this not just be a constant?
Collaborator
Author
There was a problem hiding this comment.
yeah, it's just left for extending -> later function will resolve which plugin is the origin when there' gonna be multiple
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.
No description provided.