8000 feat(auth): add workspace access and connection policy hooks by redoh · Pull Request #10 · inkspect-code-review/inkspect-core · GitHub
[go: up one dir, main page]

Skip to content

feat(auth): add workspace access and connection policy hooks - #10

Merged
redoh merged 3 commits into
mainfrom
feat/workspace-access-policy
Nov 22, 2026
Merged

redoh merged 3 commits into
mainfrom
feat/workspace-access-policy

Conversation

@redoh
@redoh redoh commented Nov 20, 2026
Copy link
Copy Markdown
Contributor

Expose optional hooks for workspace access and verified connections. Keep the existing access behavior for hosts that omit the hooks.

@inkspectsi
inkspectsi Bot commented Nov 20, 2026 •
Copy link
Copy Markdown

No blocking issues found

Commit: fd70e79

The change adds optional per-auth workspace access and connection-save hooks, plus product-guide routing and chat prompt updates. The visible access checks preserve existing membership checks and remain optional. No actionable defect or source-supported secret exposure was found in the changed lines.

Change vs. PR intent: Partially aligned. The diff implements the requested optional policy hooks, but also adds product-guide retrieval and chat behavior changes beyond the stated intent.

Scores

Code quality █████ 5/5
The changed code centralizes policy registration, applies access checks at shared boundaries, and adds regression coverage for access denial and guide selection.

Security █████ 5/5
The changed checks retain membership enforcement, constrain guide selection to registered entries, and introduce no visible embedded secrets or credential exposure.

Optional workspace policies and product-guide evidence

flowchart LR
    n0["Workspace access boundary"]
    n1["Run registered access policy if present"]
    n2["Continue existing workspace handling"]
    n3["Connection-save transaction"]
    n4["Run optional access and connection-save hooks"]
    n5["Route chat using registered guide catalog"]
    n6["Gather selected guides and workspace evidence"]
    n7["Prepare grounded chat answer"]
    n0 -->|"Check application policy"| n1
    n1 -->|"Allowed or no policy registered"| n2
    n3 -->|"Before connection persistence"| n4
    n5 -->|"Validated guide IDs and selected tools"| n6
    n6 -->|"Include guide evidence within input budget"| n7
Loading

No findings on the changed lines.

View the full report in Inkspect


Reviewed by Inkspect · engine v0.0.46

const { adapter } = await auth.$context;
const member = await adapter.findOne<{ role: string }>({ model: "member", where: [{ field: "userId", value: session.user.id }, { field: "organizationId", value: organizationId }] });
if (!member) throw new ReviewError(403, "You no longer have access to this workspace.");
await workspacePolicy(auth)?.assertAccess(organizationId);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 · Enforce the workspace policy on review and chat requests

The new check protects callers of organizationAccess, but reviewAccess and handleWorkspaceChat perform independent membership checks and never consult the registered policy. A member of a workspace rejected by assertAccess can still call handleRepositories or authorizeRealtime through reviewAccess, and can access chat directly. Rejecting workspaceStatus or a dashboard request does not protect those HTTP entry points. This makes the newly introduced workspace restriction bypassable.

Suggested fix
Apply the same policy after membership verification in reviewAccess and handleWorkspaceChat. Audit other independent workspace authorization paths, such as workspace-logo access, and either enforce the policy there or explicitly define and document intentional exceptions.

Verification
Register a policy whose assertAccess always rejects, then call repository, realtime authorization, and chat handlers with an otherwise valid member session. Confirm that each rejects before reading workspace data or invoking downstream services. Also confirm that these handlers retain their previous behavior without a registered policy.

Comment @inkspectsi review again after pushing your changes to request another review.

@redoh redoh changed the title Add workspace access and connection policy hooks feat(auth): add workspace access and connection policy hooks Nov 20, 2026
@redoh
redoh merged commit 5ba51d7 into main Nov 22, 2026
4 checks passed
@redoh
redoh deleted the feat/workspace-access-policy branch November 22, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0