feat(pmf): advisory newcomer-PR auto-guide (Phase-1-lite, advisory on… - #917
feat(pmf): advisory newcomer-PR auto-guide (Phase-1-lite, advisory on…#917YB0y wants to merge 7 commits into
Conversation
…ly) (JSONbored#803) Add opt-in per-repo setting newcomerGuideMode (off/enabled, default off). When enabled, the webhook posts a one-time welcoming advisory comment on first-time-contributor PRs (0 merged PRs in the repo, reusing JSONbored#552 detection). The guide surfaces gate findings in a newcomer-friendly way: what to fix, what makes a PR merge-worthy, and an anti-slop reminder. Advisory only — never blocks, never auto-merges. All text is public-safe. - migrations/0047: add newcomer_guide_mode column (default 'off') - src/types.ts: newcomerGuideMode field on RepositorySettings - src/db/schema.ts + repositories.ts: column, defaults, parse, upsert - src/signals/newcomer-guide.ts: buildNewcomerGuideComment message builder - src/github/comments.ts: NEWCOMER_GUIDE_COMMENT_MARKER + posting helper - src/queue/processors.ts: fires after gate finalization, before public surface; independent of publicSurface/commentMode so it works even when comments are off; best-effort (try/catch + audit), idempotent (marker-based update) - src/signals/focus-manifest.ts: gate.newcomerGuide alias + settings override - src/signals/settings-preview.ts + src/openapi/schemas.ts: preview/API surface - test/unit/newcomer-guide.test.ts: 9 unit tests covering marker, welcome, finding-specific guidance, merge-worthy checklist, gate status, dedup, truncation Closes JSONbored#803
This comment has been minimized.
This comment has been minimized.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #917 +/- ##
=======================================
Coverage 96.60% 96.61%
=======================================
Files 109 110 +1
Lines 14914 14973 +59
Branches 5390 5402 +12
=======================================
+ Hits 14408 14466 +58
Misses 104 104
- Partials 402 403 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…est-effort audit catches Adds tests across the newcomer-PR auto-guide surface (mode parse/round-trip, focus-manifest gate + settings, comment wrapper, and processor post/fail/skip scenarios) to satisfy the codecov patch gate. The two advisory .catch handlers on the newcomer audit writes are marked v8 ignore next -- they only fire when the audit write itself rejects, which is unreachable in tests without also breaking the unhandled miner-detection audit earlier in the same flow.
…-guide-803 # Conflicts: # src/queue/processors.ts
| lines.push(""); | ||
| lines.push(`## Welcome, @${input.authorLogin}! 👋`); | ||
| lines.push(""); | ||
| lines.push(`Thanks for your first PR to **${input.repoFullName}** — "${truncate(input.title, 80)}".`); |
There was a problem hiding this comment.
P2: User-controlled PR title rendered in bot comment without markdown sanitization
PR title from GitHub webhook is interpolated directly into a markdown comment body, allowing content injection.
Escape or sanitize user-controlled values before including them in GitHub markdown comments.
AI prompt
Check if this security scanner issue is valid. If so, understand the root cause and fix it. If appropriate, update or add tests. Keep the change focused and preserve intended behavior.
<file name="src/signals/newcomer-guide.ts">
<violation number="1" location="src/signals/newcomer-guide.ts:84">
<priority>P2</priority>
<title>User-controlled PR title rendered in bot comment without markdown sanitization</title>
<evidence>In buildNewcomerGuideComment, the user-supplied PR title (input.title) is interpolated directly into the guide comment body at lines.push(\`Thanks for your first PR to **${input.repoFullName}** — "${truncate(input.title, 80)}".\`). The PR title originates from the GitHub webhook payload (pr.title) and is attacker-controllable. No markdown sanitization or escaping is applied. The JSDoc block incorrectly claims 'sanitized via sanitizePublicComment', but no such function exists in the codebase or is called. This allows a malicious contributor to inject arbitrary markdown (including links and formatting) into a comment posted by the trusted bot account, which could be used for phishing or social engineering.</evidence>
<recommendation>Sanitize input.title, input.authorLogin, and any other user-controlled strings before interpolating them into GitHub markdown. At minimum, escape markdown meta-characters (e.g., *, _, [, ], backtick, #, >, |). Consider using a dedicated markdown-sanitization utility, or replace the quoted title with a plain-text representation that strips markdown syntax.</recommendation>
</violation>
</file>
JSONbored
left a comment
There was a problem hiding this comment.
merge conflicts, please resubmit as a clean PR.
…d#917 - Rename newcomer-guide migration from 0047 to 0046 to close the 0045 -> 0047 gap (check-migrations requires a contiguous sequence). The final number for merge into main will be reassigned by the maintainer at land time (next free after main). - Regenerate apps/gittensory-ui/public/openapi.json so the OpenAPI artifact reflects the newcomerGuideMode schema additions.




Summary
Implements the opt-in advisory newcomer-PR auto-guide feature, closing #803 (Phase-1-lite, advisory only). Adds a new
newcomerGuideModeper-repo setting with two modes:off(default)enabledThe guide reuses the #552 newcomer detection (
authorMergedPrCount === 0), surfaces gate findings in a newcomer-friendly way (anti-slop reminders, how-to-fix tips, merge-worthy checklist), and is strictly advisory — never blocks, never auto-merges.Related Issue
Closes: #803
Change Type
.gittensory.ymlsettings block)Real Behaviour Proof
Newcomer guide comment generation (unit-testable, no network)
Non-newcomer guard (verified by processor logic)
Idempotency (verified by marker-based comment system)
Migration — additive only
Checklist
ALTER TABLE … ADD COLUMN … DEFAULT 'off') — zero downtime, safe rollbacknewcomerGuideModedefaults to"off"everywhere (DB default, code default,getRepositorySettingsmissing-row path) — existing repos are unaffectedpublicSurface/commentMode— works even when comments are offrecordAuditEvent, never aborts the gate or public surfaceauthorHistory.mergedPrCountalready computed for feat(github-app): first-time-contributor-aware gating #552 — no extra DB query<!-- gittensory-newcomer-guide:v1 -->marker to find-and-update (never duplicates)gate.newcomerGuide: enabledin.gittensory.yml+settings.newcomerGuideModeoverrideRepositorySettingsandRepoSettingsPreviewSchema