Repository navigation
Conversation
Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
There was a problem hiding this comment.
3 issues found across 6 files
Confidence score: 3/5
.github/checks-manifest.yamlstill interpolates rawuidinto setup-pagehrefandform-actionquery targets, leaving the defect this PR addresses in the hive template; apply the same escaping fix to these occurrences.plugins/test_uid_reflection_extra.pycheckssetup.htmlsource text rather than rendered behavior, so the tests may pass while the generated links remain unsafe; label these as static tripwires and add behavioral coverage.plugins/import/manual-import/app.pypasses non-string JSONuidvalues toquote(), causing a 500 for inputs such as numeric, boolean, or list IDs; validate the type and return an appropriate client error.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/checks-manifest.yaml">
<violation number="1" location=".github/checks-manifest.yaml:951">
P2: The hive setup template still interpolates raw uid into href/form-action query targets (`/disconnect?uid={{ uid }}` at setup.html:486, `/settings/api-key?uid={{ uid }}` at :541), the exact defect this PR fixed in linear's template (`uid={{ uid }}` -> `uid={{ uid_q }}`). The home() handler passes only raw `uid` to the template context, so a uid containing & or # still corrupts the rendered URL. The newly registered regression test covers hive redirects but, unlike the linear template assert, never checks hive's template. Mirror the linear fix: pass an encoded `uid_q` from home() and render it in both hrefs.</violation>
</file>
<file name="plugins/import/manual-import/app.py">
<violation number="1" location="plugins/import/manual-import/app.py:312">
P3: `quote()` raises `TypeError` for any non-string `user_id`, and the `if not user_id` guard only rejects falsy values, so a JSON numeric/bool/list `uid` (e.g. `"uid": 123`) now returns a 500 from the outer except clause. Normalize to `str` before quoting.</violation>
</file>
<file name="plugins/test_uid_reflection_extra.py">
<violation number="1" location="plugins/test_uid_reflection_extra.py:155">
P3: The `uid={{ uid_q }}` / `uid={{ uid }}` template checks read setup.html source text, so they are static tripwires rather than behavior checks. Per AGENTS.md, source-string assertions must be labeled as static tripwires. Add a brief comment noting these verify the template text only and that the behavior contract is the `oauth_url` assertion above.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
|
|
||
| - id: plugin-uid-query-encoding-extra-tests | ||
| command: ["python3", "plugins/test_uid_reflection_extra.py"] | ||
| triggers: ["plugins/omi-linear-app/**", "plugins/omi-hive-app/**", "plugins/import/manual-import/**", "plugins/test_uid_reflection_extra.py", ".github/checks-manifest.yaml"] |
There was a problem hiding this comment.
P2: The hive setup template still interpolates raw uid into href/form-action query targets (/disconnect?uid={{ uid }} at setup.html:486, /settings/api-key?uid={{ uid }} at :541), the exact defect this PR fixed in linear's template (uid={{ uid }} -> uid={{ uid_q }}). The home() handler passes only raw uid to the template context, so a uid containing & or # still corrupts the rendered URL. The newly registered regression test covers hive redirects but, unlike the linear template assert, never checks hive's template. Mirror the linear fix: pass an encoded uid_q from home() and render it in both hrefs.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/checks-manifest.yaml, line 951:
<comment>The hive setup template still interpolates raw uid into href/form-action query targets (`/disconnect?uid={{ uid }}` at setup.html:486, `/settings/api-key?uid={{ uid }}` at :541), the exact defect this PR fixed in linear's template (`uid={{ uid }}` -> `uid={{ uid_q }}`). The home() handler passes only raw `uid` to the template context, so a uid containing & or # still corrupts the rendered URL. The newly registered regression test covers hive redirects but, unlike the linear template assert, never checks hive's template. Mirror the linear fix: pass an encoded `uid_q` from home() and render it in both hrefs.</comment>
<file context>
@@ -946,6 +946,12 @@ checks:
+ - id: plugin-uid-query-encoding-extra-tests
+ command: ["python3", "plugins/test_uid_reflection_extra.py"]
+ triggers: ["plugins/omi-linear-app/**", "plugins/omi-hive-app/**", "plugins/import/manual-import/**", "plugins/test_uid_reflection_extra.py", ".github/checks-manifest.yaml"]
+ lanes: ["local", "ci"]
+ reason: "the client-controlled uid/user_id was interpolated raw into linear's setup oauth_url + template hrefs, hive's redirect Location headers, and manual-import's API query; & or # in the value corrupted the query string (verified param injection)"
</file context>
|
|
||
| # Send the request to OMI API with dynamic user_id (still using the facts endpoint) | ||
| response = requests.post(f"{API_URL}?uid={user_id}", headers=headers, data=json.dumps(memory_data)) | ||
| response = requests.post(f"{API_URL}?uid={quote(user_id, safe='')}", headers=headers, data=json.dumps(memory_data)) |
There was a problem hiding this comment.
P3: quote() raises TypeError for any non-string user_id, and the if not user_id guard only rejects falsy values, so a JSON numeric/bool/list uid (e.g. "uid": 123) now returns a 500 from the outer except clause. Normalize to str before quoting.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/import/manual-import/app.py, line 312:
<comment>`quote()` raises `TypeError` for any non-string `user_id`, and the `if not user_id` guard only rejects falsy values, so a JSON numeric/bool/list `uid` (e.g. `"uid": 123`) now returns a 500 from the outer except clause. Normalize to `str` before quoting.</comment>
<file context>
@@ -308,7 +309,7 @@ def submit_memories():
# Send the request to OMI API with dynamic user_id (still using the facts endpoint)
- response = requests.post(f"{API_URL}?uid={user_id}", headers=headers, data=json.dumps(memory_data))
+ response = requests.post(f"{API_URL}?uid={quote(user_id, safe='')}", headers=headers, data=json.dumps(memory_data))
# Record result
</file context>
| response = requests.post(f"{API_URL}?uid={quote(user_id, safe='')}", headers=headers, data=json.dumps(memory_data)) | |
| response = requests.post(f"{API_URL}?uid={quote(str(user_id), safe='')}", headers=headers, data=json.dumps(memory_data)) |
| assert "uid={{ uid_q }}" in template | ||
| assert "uid={{ uid }}" not in template |
There was a problem hiding this comment.
P3: The uid={{ uid_q }} / uid={{ uid }} template checks read setup.html source text, so they are static tripwires rather than behavior checks. Per AGENTS.md, source-string assertions must be labeled as static tripwires. Add a brief comment noting these verify the template text only and that the behavior contract is the oauth_url assertion above.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At plugins/test_uid_reflection_extra.py, line 155:
<comment>The `uid={{ uid_q }}` / `uid={{ uid }}` template checks read setup.html source text, so they are static tripwires rather than behavior checks. Per AGENTS.md, source-string assertions must be labeled as static tripwires. Add a brief comment noting these verify the template text only and that the behavior contract is the `oauth_url` assertion above.</comment>
<file context>
@@ -0,0 +1,211 @@
+ assert ctx["oauth_url"] == expected, ctx["oauth_url"]
+ # the template must render the encoded value into the href targets
+ template = (PLUGINS / "omi-linear-app" / "templates" / "setup.html").read_text()
+ assert "uid={{ uid_q }}" in template
+ assert "uid={{ uid }}" not in template
+
</file context>
| assert "uid={{ uid_q }}" in template | |
| assert "uid={{ uid }}" not in template | |
| # Static tripwire: template source must reference uid_q, never raw uid. | |
| assert "uid={{ uid_q }}" in template | |
| assert "uid={{ uid }}" not in template |
|
Thanks @Da7em-T — reviewed all six changed files; the fix pattern is applied consistently and the hermetic regression suite passes when run isolated (5/5, stdlib-only stubs, no network/subprocess). Per-file notes:
CI note: "Dart Analyze & Tests" is red on This PR is independently mergeable (no file overlap with #13658 despite being its follow-up), but since it's one of a same-day batch of PRs from a new account touching uid handling across many plugins, a human maintainer should confirm the series-wide fix pattern and landing order before merge. Feedback by AI on behalf of David — leaving for human maintainer review of the uid-encoding series pattern and landing order. |
kodjima33
left a comment
There was a problem hiding this comment.
backend/plugins uid-encoding fix (linear/hive/manual-import), well-tested, root cause clear. CI: Dart Analyze & Tests fails on a stale-base compile error (app/test/widgets/chat_content_blocks_test.dart) unrelated to this diff and already fixed on current origin/main — leaving approved, not merging per hard floor.
|
Follow-up notes after the maintainer approval on this head — both verified against the tree, neither blocking this diff:
Fix as scoped is correct and well tested; nothing further needed from this PR. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Real query/param-injection fix (uid corrupts oauth_url/redirects in linear/hive/manual-import); scoped, hermetic tests added, verified against backend behavior.
|
Keeping this open on DIRTY + Dart Analyze red; linear/hive/manual-import uid encode + tests; kodjima APPROVE ≠ merge. kodjima APPROVE is the size gate, not maintainer merge. I am not approving or merging this SHA. |
kodjima33
left a comment
There was a problem hiding this comment.
Follow-up to the uid-reflection fix covering linear/hive/manual-import: same defect class, scoped percent-encoding fixes with hermetic tests demonstrating query-param injection pre-fix. Only red check is the same pre-existing unrelated Dart compile error.
|
Manual import, Hive, and Linear on main still interpolate a raw uid. This head quotes those sinks, and the test pins a hostile uid. — Astar, on behalf of @aryanorastar |
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
Summary
Follow-up to the setup-page
uidreflection fix — same defect class in three more plugins:oauth_urlbuilt asf"/auth/linear?uid={uid}"and rendered intohreftargets insetup.html; two post-OAuth/disconnect redirects used/?uid={uid}raw.&/#in uid corrupted the query (verified:uid=x&error=injected#fragproduced/auth/linear?uid=x&error=injected#frag).RedirectResponse(url=f"/?uid={uid}...")sites, including the API-key error path — a&in uid injected extra query params into the setup page URL.user_idinterpolated raw into the OMI API POST query.Fix:
urllib.parse.quote(value, safe="")in each URL context; the linear template now renders auid_qcontext var for href query params whileuidstays for display.Failure-Class: none
Test plan
python3 plugins/test_uid_reflection_extra.py— 5/5 pass, hermetic (FastAPI/Flask/requests/openai stubbed); drives the realhome,connect_api_key,disconnect_*, andsubmit_memorieshandlers/auth/linear?uid=x&error=injected#frag(injection survives)plugin-uid-query-encoding-extra-testsin.github/checks-manifest.yaml(local + ci lanes)Generated with Devin