Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions apps/web/src/app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,27 @@ export default function LoginPage() {
<div key={group.title}>
<dt className="font-medium text-foreground">{group.title}</dt>
<dd>{group.detail}</dd>
{group.collection ? (
<dd className="mt-1">
<code className="break-all rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground">
{group.collection}
</code>
</dd>
) : null}
{group.permissions ? (
<dd>
<ul className="mt-2 space-y-1.5 border-l border-border pl-3">
{group.permissions.map((permission) => (
<li key={permission.action}>
<span className="font-medium text-foreground">
{permission.action}:
</span>{" "}
{permission.detail}
</li>
))}
</ul>
</dd>
) : null}
</div>
))}
</dl>
Expand Down
24 changes: 24 additions & 0 deletions apps/web/src/lib/oauthScopeDisclosure.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@ describe("OAuth scope disclosure", () => {
expect(OAUTH_SCOPE_DISCLOSURE_GROUPS.at(-1)?.webOnly).toBe(true);
});

test("breaks out community bookmark record access by action", () => {
const bookmarkGroup = OAUTH_SCOPE_DISCLOSURE_GROUPS.find(
({ title }) => title === "Bookmarks"
);

expect(bookmarkGroup?.collection).toBe(
"community.lexicon.bookmarks.bookmark"
);
expect(bookmarkGroup?.permissions).toEqual([
{
action: "Create",
detail: "Save links as new public bookmark records.",
},
{
action: "Update",
detail: "Edit tags on existing bookmark records.",
},
{
action: "Delete",
detail: "Remove bookmark records from your repository.",
},
]);
});

test("states the important access limitations", () => {
expect(OAUTH_SCOPE_LIMITATION_DISCLOSURE).toContain("cannot post to feeds");
expect(OAUTH_SCOPE_LIMITATION_DISCLOSURE).toContain("read messages or email");
Expand Down
22 changes: 22 additions & 0 deletions apps/web/src/lib/oauthScopeDisclosure.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,35 @@
export type OAuthScopeDisclosurePermission = Readonly<{
action: "Create" | "Update" | "Delete";
detail: string;
}>;

export type OAuthScopeDisclosureGroup = Readonly<{
title: string;
detail: string;
collection?: string;
permissions?: readonly OAuthScopeDisclosurePermission[];
webOnly?: boolean;
}>;

export const OAUTH_SCOPE_DISCLOSURE_GROUPS: readonly OAuthScopeDisclosureGroup[] = [
{
title: "Bookmarks",
detail: "Create, update, and delete community bookmark records in your public repository.",
collection: "community.lexicon.bookmarks.bookmark",
permissions: [
{
action: "Create",
detail: "Save links as new public bookmark records.",
},
{
action: "Update",
detail: "Edit tags on existing bookmark records.",
},
{
action: "Delete",
detail: "Remove bookmark records from your repository.",
},
],
},
{
title: "Reading State",
Expand Down