-
-
Notifications
You must be signed in to change notification settings - Fork 91
feat(extension): add public-safe packet copy and private blocker actions in GitHub overlay #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JSONbored
merged 11 commits into
JSONbored:main
from
jonathanchang31:feat/public-safe-packet-private-blocker-actions
Jun 2, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4301d4a
feat: public-safe packet and private blocker actions
jonathanchang31 dc205e4
fix: CI test failed
jonathanchang31 fa0cdb1
rerun ci
jonathanchang31 e66fec5
fix: ci route test failed
jonathanchang31 5c14a97
fix: codes after request changes
jonathanchang31 1b45179
Merge branch 'main' into feat/public-safe-packet-private-blocker-actions
jonathanchang31 fc79700
fix(api): close extension audit event before usage telemetry
jonathanchang31 8b00454
fix(api): keep extension pull context audit-only
jonathanchang31 c8c79fe
fix(api): resolve extension pull-context telemetry merge
jonathanchang31 ec6f9e2
Merge branch 'main' into feat/public-safe-packet-private-blocker-actions
JSONbored 5e3c606
Merge branch 'main' into feat/public-safe-packet-private-blocker-actions
JSONbored File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { __routesInternals } from "../../src/api/routes"; | ||
| import { createSessionForGitHubUser } from "../../src/auth/security"; | ||
| import { createTestEnv } from "../helpers/d1"; | ||
|
|
||
| describe("extension packet helper internals", () => { | ||
| it("falls back when extension packet text contains forbidden public terms", () => { | ||
| const result = __routesInternals.ensureExtensionPublicSafeText("# Public-safe PR packet\n\n- reviewability 91/100"); | ||
| expect(result).toContain("Public-safe packet unavailable"); | ||
| }); | ||
|
|
||
| it("keeps safe extension packet text unchanged", () => { | ||
| const text = "# Public-safe PR packet\n\n- Repository: owner/repo\n- Keep public comments focused on linked context."; | ||
| expect(__routesInternals.ensureExtensionPublicSafeText(text)).toBe(text); | ||
| }); | ||
|
|
||
| it("builds private blocker fallback when no blocker signals are present", () => { | ||
| const blockers = __routesInternals.buildExtensionPrivateBlockers({ | ||
| noiseSources: [], | ||
| maintainerNextSteps: [], | ||
| privateSummary: "", | ||
| }); | ||
| expect(blockers).toEqual([{ id: "blocker-1", detail: "No private blocker detail is currently cached." }]); | ||
| }); | ||
|
|
||
| it("sanitizes extension packet markdown before returning it", () => { | ||
| const markdown = __routesInternals.buildExtensionPublicSafePacket({ | ||
| repoFullName: "owner/repo", | ||
| pullNumber: 12, | ||
| contributor: "alice", | ||
| reviewability: { | ||
| action: "review_now", | ||
| noiseSources: ["avoid payout language in public"], | ||
| maintainerNextSteps: ["remove wallet references"], | ||
| }, | ||
| }); | ||
| expect(markdown).toContain("# Public-safe PR packet"); | ||
| expect(markdown).not.toMatch(/wallet|payout|hotkey|reward estimate|estimated score|raw trust score/i); | ||
| }); | ||
|
|
||
| it("authenticates request identity from browser session cookie fallback", async () => { | ||
| const env = createTestEnv(); | ||
| const { token } = await createSessionForGitHubUser(env, { login: "jsonbored", id: 7 }); | ||
| const identity = await __routesInternals.authenticateRequestIdentity({ | ||
| env, | ||
| req: { | ||
| header(name: string) { | ||
| if (name.toLowerCase() === "cookie") return `gittensory_session=${token}`; | ||
| return undefined; | ||
| }, | ||
| }, | ||
| json: (_payload: { error: string }, status?: number) => Response.json({}, status === undefined ? undefined : { status }), | ||
| }); | ||
| expect(identity).toMatchObject({ kind: "session", actor: "jsonbored" }); | ||
| }); | ||
| }); |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import { describe, expect, it } from "vitest"; | ||
| import { __securityInternals } from "../../src/auth/security"; | ||
|
|
||
| describe("security internals", () => { | ||
| it("serializes cookies with optional HttpOnly and Secure flags", () => { | ||
| const minimal = __securityInternals.serializeCookie("a", "b", { | ||
| maxAge: 10, | ||
| path: "/", | ||
| httpOnly: false, | ||
| sameSite: "Lax", | ||
| secure: false, | ||
| }); | ||
| expect(minimal).toContain("a=b"); | ||
| expect(minimal).not.toContain("HttpOnly"); | ||
| expect(minimal).not.toContain("Secure"); | ||
|
|
||
| const strict = __securityInternals.serializeCookie("a", "b", { | ||
| maxAge: 10, | ||
| path: "/", | ||
| httpOnly: true, | ||
| sameSite: "Strict", | ||
| secure: true, | ||
| }); | ||
| expect(strict).toContain("HttpOnly"); | ||
| expect(strict).toContain("Secure"); | ||
| expect(strict).toContain("SameSite=Strict"); | ||
| }); | ||
| }); |
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.
Uh oh!
There was an error while loading. Please reload this page.