You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by "KatalKavya96 (via GitHub)" <gi...@apache.org> on 2026/10/21 05:47:59 UTC
[PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
KatalKavya96 opened a new pull request, #1750:
URL: https://github.com/apache/magpie/pull/1750
## Summary
- Fixes #1730: GitHub issue search can miss security mailing-list thread IDs wrapped in Markdown backticks, causing previously imported reports to be treated as new.
- Replace search-based exact-ID deduplication with deterministic matching against an authorized, bounded tracker issue-body index, covering Gmail IDs, PonyMail archive IDs, root Message-IDs, and secondary threads.
- Fail closed on incomplete or ambiguous results, preserve least-privilege caller permissions, and add regression tests and updated evaluation fixtures.
## Type of change
- [x] Skill change (`.claude/skills/<name>/`) — eval fixtures updated below
- [x] Tool / bridge contract (`tools/<system>/*.md`)
- [x] Python package (`tools/*/` with `pyproject.toml`)
- [ ] Groovy reference impl
- [ ] Cross-cutting (RFC, AGENTS.md, sandbox, privacy-LLM)
- [x] Documentation (`docs/`, `README.md`, `CONTRIBUTING.md`)
- [ ] Project template (`projects/_template/`)
- [ ] CI / dev loop (`prek`, workflows, validators)
- [ ] Other:
## Test plan
- [x] `prek run --all-files` passes — all hooks green.
- [x] For Python packages touched: `uv run pytest` / `ruff check` / `mypy` passes — verified through workspace hooks and targeted package tests.
- [ ] For Groovy bridges touched: command-line invocation tested end-to-end
- [x] For skill changes: eval suite passes for the affected skill.
- `security-issue-import/step-2-dedup`: **4/4 passed**, 0 failed, 0 manual, 0 errored.
- [x] For skill *behaviour* changes: a new or updated eval fixture is included in this PR.
- Updated three existing fixtures to use `dedup-index` results.
- Added `case-4-backtick-threadid-match` to reproduce the reported failure.
- [x] Other:
- Tested exact identifier matching, PonyMail URLs, secondary threads, missing issue bodies, ambiguous identities, and truncated indexes.
- Verified unauthorized callers are refused, explicitly authorized read operations are allowed, and the ordinary `issue-list` operation does not expose bodies.
- Verified generated vetted-ops plugin mirrors match their source files.
## RFC-AI-0004 compliance
- [x] **HITL** — any required caller-policy change requires explicit user approval; no new mutation is introduced.
- [x] **Sandbox** — tracker access remains restricted to the vetted-ops execution boundary; no unrestricted host access is added.
- [x] **Vendor neutrality** — existing adopter placeholders are preserved in skill and tool instructions; `check-placeholders` passes.
- [ ] **Conversational + correctable** — agentic-override path documented if behaviour is adopter-tunable
- [x] **Write-access discipline** — the new operation is read-only; it does not create tracker issues or send outbound messages.
- [x] **Privacy LLM** — private tracker issue bodies are saved in the controlled workspace rather than printed into model context; matching results expose only issue summaries.
## Linked issues
Fixes #1730.
## Notes for reviewers (optional)
**Implementation:** The new `issue-import dedup-index` command reads a saved tracker index and compares identifiers against the authoritative *Security mailing list thread* field. A dedicated `issue-list-with-bodies` vetted operation requires explicit caller authorization.
**Safety:** A missing body, ambiguous mailing-thread identity, or potentially truncated 1000-issue index prevents negative deduplication claims. Jira and local-files backends are explicitly unsupported by this new body-index operation rather than silently treated as having no matches.
**Trade-off:** The bounded index avoids relying on GitHub's inconsistent search indexing, but trackers with 1000 or more returned issues require a further completeness-safe solution. This PR prioritizes preventing duplicate security imports over automatically proceeding when completeness cannot be established.
**Validation scope:** The four model evaluations use mocked tool outputs; deterministic Python tests separately verify the matching logic and vetted-ops authorization boundaries.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "KatalKavya96 (via GitHub) via commits" <co...@magpie.apache.org>.
KatalKavya96 commented on code in PR #1750:
URL: https://github.com/apache/magpie/pull/1750#discussion_r4428178049
##########
plugins/magpie-security/skills/issue-import/existing-tracker-dedup.md:
##########
@@ -5,35 +5,57 @@
## Step 2 — Deduplicate against existing <tracker> issues
-For each candidate `threadId`, check whether that ID already appears in an `<tracker>` issue body
-(the *"Security mailing list thread"* field holds it, as a `<mail-archive-url>/thread/<id>` URL or a textual note containing the Gmail `threadId`).
-Check every candidate in one pass: OR the `threadId`s into one `gh search issues` query,
-at most 6 IDs per query (GitHub search allows at most five `OR` operators).
-Write the ids as a JSON list to `<scratch>/thread-ids.json` and let the tool batch them
-(`<sm>` is `uv run --project <framework>/tools/security-management security-management issue-import`):
+For each candidate `threadId`, check the authoritative *Security mailing list
+thread* field of existing tracker issues. Do **not** use GitHub issue-body
+search as proof that a thread is untracked: search indexing can miss opaque
+identifiers enclosed in Markdown backticks.
+
+Write all candidate IDs to `<scratch>/thread-ids.json`. Use the configured
+vetted-ops policy and its `security-issue-import` caller to read the complete
+bounded GitHub tracker index:
```bash
-<sm> dedup-queries --thread-ids <scratch>/thread-ids.json --tracker <tracker>
+vetted-op-read --caller security-issue-import \
Review Comment:
Fixed in 0f84ac2. Updated the command to use uv run --project ~/.claude/magpie/vetted-ops and replaced the undefined placeholder with <workspace>/saved/security-import-index.json.
Validated with the repository hooks. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on code in PR #1750:
URL: https://github.com/apache/magpie/pull/1750#discussion_r4355088336
##########
plugins/magpie-security/skills/issue-import/existing-tracker-dedup.md:
##########
@@ -5,35 +5,57 @@
## Step 2 — Deduplicate against existing <tracker> issues
-For each candidate `threadId`, check whether that ID already appears in an `<tracker>` issue body
-(the *"Security mailing list thread"* field holds it, as a `<mail-archive-url>/thread/<id>` URL or a textual note containing the Gmail `threadId`).
-Check every candidate in one pass: OR the `threadId`s into one `gh search issues` query,
-at most 6 IDs per query (GitHub search allows at most five `OR` operators).
-Write the ids as a JSON list to `<scratch>/thread-ids.json` and let the tool batch them
-(`<sm>` is `uv run --project <framework>/tools/security-management security-management issue-import`):
+For each candidate `threadId`, check the authoritative *Security mailing list
+thread* field of existing tracker issues. Do **not** use GitHub issue-body
+search as proof that a thread is untracked: search indexing can miss opaque
+identifiers enclosed in Markdown backticks.
+
+Write all candidate IDs to `<scratch>/thread-ids.json`. Use the configured
+vetted-ops policy and its `security-issue-import` caller to read the complete
+bounded GitHub tracker index:
```bash
-<sm> dedup-queries --thread-ids <scratch>/thread-ids.json --tracker <tracker>
+vetted-op-read --caller security-issue-import \
Review Comment:
Please spell this as `uv run --project ~/.claude/magpie/vetted-ops vetted-op-read --caller security-issue-import …`, as the other runnable blocks do (AGENTS.md → Local setup, golden rule): a bare `vetted-op-read` is not on PATH and is not what the sandbox exclusion matches. Also, `<saved-index-path>` below is never defined — it is `<workspace>/saved/security-import-index.json`.
##########
tools/security-management/src/security_management/issue_import/dedup.py:
##########
@@ -106,3 +107,109 @@ def attribute(thread_ids: Iterable[object], hits: Sequence[Mapping[str, Any]]) -
"rerun": batches(unmatched, half) if truncated and unmatched else [],
"rejected_ids": bad,
}
+
+
+def attribute_index(
+ thread_ids: Iterable[object],
+ issues: Sequence[Mapping[str, Any]],
+ *,
+ body_fields: Mapping[str, str] | None = None,
+ limit: int = 1000,
+) -> dict[str, Any]:
+ """Match IDs against a bounded, complete issue-body index.
+
+ Never expose body contents in the result. Missing or ambiguous
+ authoritative fields prevent a definitive negative result when
+ they cannot be interpreted safely.
+ """
+ good, bad = valid_ids(thread_ids)
+ if bad:
+ return {
+ "ok": False,
+ "refused": "thread ids no mail-source backend emits",
+ "rejected_ids": bad,
+ }
+
+ tracked: dict[str, list[dict[str, Any]]] = {}
+ undecided: list[dict[str, Any]] = []
+
+ for issue in issues:
+ summary = {key: issue.get(key) for key in ("number", "title", "state", "url")}
+ if not isinstance(issue.get("body"), str):
+ undecided.append(
+ {
+ "number": issue.get("number"),
+ "reason": "missing or invalid issue body",
+ }
+ )
+ continue
+
+ parsed = fields.read(
+ issue["body"],
+ ["mailing_thread"],
+ body_fields,
+ )
+
+ if parsed["undecided"]:
+ undecided.append(
+ {
+ "number": issue.get("number"),
+ "reason": "ambiguous mailing_thread field",
+ }
+ )
+ continue
+
+ field_value = parsed["values"].get("mailing_thread", "")
+ if not field_value:
+ continue
+
+ identity = threads.classify(field_value)
Review Comment:
`threads.classify` picks the primary reply thread rather than listing every identifier in the field, so a maildir id (stops at the first `.`), threads recorded below a `N/A — opened from public PR` / markdown sentinel, and any second `Root Message-ID` from a merged tracker come back `complete: true, untracked: [<id>]`. Scanning every line for every shape `valid_ids` accepts would close all three; details in the review body.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "KatalKavya96 (via GitHub) via commits" <co...@magpie.apache.org>.
KatalKavya96 commented on PR #1750:
URL: https://github.com/apache/magpie/pull/1750#issuecomment-6532817512
@potiuk I've pushed 0f84ac2 addressing both review threads and the obsolete-command cleanup. All local hooks are green, and I've replied to the inline comments. Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "potiuk (via GitHub) via commits" <co...@magpie.apache.org>.
potiuk merged PR #1750:
URL: https://github.com/apache/magpie/pull/1750
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #1750:
URL: https://github.com/apache/magpie/pull/1750#issuecomment-6531765816
@KatalKavya96, I merged `main` into this branch (a3cd55e7c). The conflicts were in `tools/security-management/README.md`, where I kept your `dedup-index` row and `main`'s updated `relay-prescreen` row, and in the eval count: security-issue-import is now 43 cases across 9 steps. `main` now mirrors `tools/security-management` into `plugins/magpie-security-tools/`, so the merge also copies your dedup changes there. Please pull before pushing again. The two review threads are still open.
---
> *This comment was drafted by an AI-assisted tool and confirmed by an Apache Magpie maintainer.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "KatalKavya96 (via GitHub) via commits" <co...@magpie.apache.org>.
KatalKavya96 commented on code in PR #1750:
URL: https://github.com/apache/magpie/pull/1750#discussion_r4428175012
##########
tools/security-management/src/security_management/issue_import/dedup.py:
##########
@@ -106,3 +107,109 @@ def attribute(thread_ids: Iterable[object], hits: Sequence[Mapping[str, Any]]) -
"rerun": batches(unmatched, half) if truncated and unmatched else [],
"rejected_ids": bad,
}
+
+
+def attribute_index(
+ thread_ids: Iterable[object],
+ issues: Sequence[Mapping[str, Any]],
+ *,
+ body_fields: Mapping[str, str] | None = None,
+ limit: int = 1000,
+) -> dict[str, Any]:
+ """Match IDs against a bounded, complete issue-body index.
+
+ Never expose body contents in the result. Missing or ambiguous
+ authoritative fields prevent a definitive negative result when
+ they cannot be interpreted safely.
+ """
+ good, bad = valid_ids(thread_ids)
+ if bad:
+ return {
+ "ok": False,
+ "refused": "thread ids no mail-source backend emits",
+ "rejected_ids": bad,
+ }
+
+ tracked: dict[str, list[dict[str, Any]]] = {}
+ undecided: list[dict[str, Any]] = []
+
+ for issue in issues:
+ summary = {key: issue.get(key) for key in ("number", "title", "state", "url")}
+ if not isinstance(issue.get("body"), str):
+ undecided.append(
+ {
+ "number": issue.get("number"),
+ "reason": "missing or invalid issue body",
+ }
+ )
+ continue
+
+ parsed = fields.read(
+ issue["body"],
+ ["mailing_thread"],
+ body_fields,
+ )
+
+ if parsed["undecided"]:
+ undecided.append(
+ {
+ "number": issue.get("number"),
+ "reason": "ambiguous mailing_thread field",
+ }
+ )
+ continue
+
+ field_value = parsed["values"].get("mailing_thread", "")
+ if not field_value:
+ continue
+
+ identity = threads.classify(field_value)
Review Comment:
Addressed in 0f84ac2. The matcher now scans all recorded identifiers instead of relying on threads.classify() for extraction.
Added regression tests for maildir IDs, threads after PR/Markdown sentinels, and multiple root Message-IDs. Also removed the obsolete dedup-queries / dedup-attribute commands, docs, and tests.
All local repository hooks pass, including pytest, Ruff, and mypy.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] fix(security): deduplicate imports using authorized tracker body index [magpie]
Posted by "KatalKavya96 (via GitHub)" <gi...@apache.org>.
KatalKavya96 commented on PR #1750:
URL: https://github.com/apache/magpie/pull/1750#issuecomment-6309062492
@potiuk ,
Implemented the fix for #1730 and completed validation.
The security-import workflow now uses deterministic matching against an authorized tracker body index instead of relying on GitHub issue search, which can miss backtick-wrapped thread IDs.
**Validation:**
- `prek run --all-files` — all hooks passed.
- Full workspace tests, Ruff, and mypy — passed.
- Security-import Step 2 model evaluation — **4/4 passed**.
- Added regression coverage for backtick-wrapped Gmail IDs, archive identifiers, secondary threads, incomplete indexes, and caller authorization.
The implementation also fails closed when tracker completeness cannot be established, preventing unsafe duplicate imports.
Thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@magpie.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org