Skip to content

feat: add a privacy notice - #64

Merged
AnonymousXC merged 11 commits into
stagingfrom
docs/9-privacy-notice
Nov 13, 2026
Merged

AnonymousXC merged 11 commits into
stagingfrom
docs/9-privacy-notice

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a privacy notice at /privacy, following the proposal in #9.

  • Reachable before login: linked from the login page and the sidebar ("About" → "Privacy"). Krini has no page footer, so the sidebar takes the footer's place.

  • What Krini processes: no tracking or analytics; the user info that the login provider releases (name, email, identifier, groups), shown and not stored on the server; display settings; every cookie with its purpose and lifetime, as the auth routes and the sidebar set them.

  • What happens elsewhere:

    • the login provider (login, account, access requests);
    • the services that run tasks and workflows: the browser contacts them directly, also without login. WES services get the access token and record the user's identifier. TES services are called without a token for now (feat: run TES tasks with the Cloud Components #41, feat(auth): send the user's token to services #44);
    • cdn.jsdelivr.net, which serves the Ace worker of the code editor in the workflow form (from @elixir-cloud/design);
    • the registry, which is read without user data.
  • Per deployment, all optional and read at runtime (src/lib/privacy.ts):

    • PRIVACY_CONTROLLER: who is responsible;
    • PRIVACY_CONTACT: an email address or an https URL;
    • PRIVACY_NOTICE_URL: the deployment's full notice;
    • PRIVACY_LOGIN_NOTICE_URL: the login provider's notice.

    URLs must be https and have no user info. Invalid values are ignored, with a warning in the server log. Without settings, the page says that the operator hasn't named anyone. Nothing is deployment-specific.

  • Retiring tracking (point 4 of the proposal): the rewrite has no Google Analytics and no cookie banner, and this PR doesn't bring them back. The deployment guide says that this is why no consent banner is needed.

  • Docs: README configuration and docs/deployment.md.

Deviation from the proposal: the proposal suggested that the text itself might come from configuration ("e.g. a Markdown file or URL"). Here the text is fixed and the same for every deployment, because it describes what Krini does. Deployment-specific content (purposes, legal basis, retention, rights) goes into the deployment's own notice, which PRIVACY_NOTICE_URL links. This needs no Markdown renderer.

Stacked on #63 (#51, tests). The base is staging, because CI runs only for PRs into dev, master and staging. Until #63 is merged, the diff also shows its commits. Review only the last four commits ("feat: add a privacy notice" and the three "docs:" commits after it).

Closes #9

Verification

  • bun run lint: clean.

  • bun run test:coverage: 117 tests, 100% coverage. That includes 15 new tests of the settings, among them javascript: and http URLs, user info in URLs and invalid email addresses (also with empty domain labels).

  • End-to-end, in the Playwright image as CI runs it: 22 passed (11 tests × Chromium, Firefox). The new tests check:

    • the links from the login page and the sidebar;
    • that the page shows the settings it reads at runtime;
    • that visitors get no cookies;
    • that members get only the session's cookies;
    • that only the logout marker is left after logout;
    • that the notice lists exactly the cookies that the app sets across the visitor (incl. sidebar toggle), login, session and logout flows.

    The app is built without the PRIVACY_* settings and started with them. So the tests also fail if the notice were rendered at build time.

  • CI: Lint, Build, Test and End-to-end tests pass. The org Vercel deployment fails, as it does on feat: cc wes workflows rewrite #61 and test: add unit and end-to-end tests #63. That is a setting of the Vercel project.

Review: both reviewer subagents ran on the first version. Their findings were cookie lifetimes, third-party contacts, an overstated claim about scripts, and test gaps. All are fixed in the last two commits. The second round couldn't run as a subagent, because the session's subagent limit was reached. I reviewed those two commits myself against the code instead. The automated review found six points (server-side WES checks, cookies readable by page scripts, the cookie of a started login, which user info is shown, email domain labels, the default-settings test); all are fixed in "docs: sharpen the privacy notice after review". The end-to-end tests for that commit ran in CI only; the text changes leave the tested elements as they were.

Findings while writing the notice (not changed here)

  • The code editor of @elixir-cloud/design loads its Ace worker from cdn.jsdelivr.net. Serving it from Krini would avoid the third party. That's a change for cloud-components.

Declined review findings

  • An optional Markdown text from configuration. Instead, deployments link their own full notice (see "Deviation" above).
  • An end-to-end case without PRIVACY_* settings, for the fallback texts. It would need a second app server with other settings. The fallback is two plain sentences, and the parsing of empty settings is unit-tested.

Open questions

None.

🤖 Generated with Claude Code

https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV

Summary by Sourcery

Add a publicly accessible, deployment-configurable privacy notice and verify that it accurately reflects Krini’s data handling and cookie behavior.

New Features:

  • Add a public /privacy page describing Krini’s data processing, cookies, third-party services, and deployment-specific privacy contacts.
  • Link the privacy notice from the login page and the authenticated sidebar.

Enhancements:

  • Support optional runtime privacy configuration with validation for the controller, contact, deployment notice, and login-provider notice.
  • Document privacy configuration and deployment guidance, including Krini’s lack of analytics and visitor cookies.

Documentation:

  • Document the privacy settings, runtime behavior, cookie policy, and deployment-specific notice requirements.

Tests:

  • Add unit and end-to-end coverage for privacy settings, links, runtime configuration, and cookie behavior across visitor, login, session, and logout flows.

uniqueg and others added 9 commits November 12, 2026 05:49
Add Vitest with v8 coverage, following cloud-registry-ui: tests of
the auth routes (login redirect, callback, refresh, token, user info,
logout), the registry and service info routes, and the helpers in
src/lib. The covered code is at 100% and the threshold keeps it so.

The tests describe the current behaviour. The concurrency guard of
the WES probe is unreachable and excluded from coverage.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Add Playwright tests of the main user journey in Chromium and
Firefox: browse the WES services anonymously, log in, submit a
workflow with the user's token, see the run, and log out. One mock
process plays the login provider, the registry and a WES service
over https with a self-signed certificate; no real service is called.

CI gets a Test job (unit tests with the coverage threshold) and an
End-to-end tests job in the Playwright image, as in
cloud-registry-ui. The README documents both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
The rewrite lives on staging until it replaces dev, so pull requests
into staging got no checks. Run them there as well.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
- Drop the unreachable guard of the WES probe instead of excluding
  it from coverage.
- Test that deadline() aborts with a timeout; drop tests of constants.
- The mock login provider checks response_type, state and the
  redirect URI, also at the token exchange; a new test rejects a
  forged callback.
- Keep ports, client and the request type in e2e/settings.ts; add an
  accessToken() helper.
- Add a timeout to the Test job; the README names the prerequisites
  and what isn't covered yet.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
- .dockerignore matches env files, keys and certificates at any depth
  and leaves out e2e/ and playwright.config.ts, so the generated test
  certificate never reaches the build context.
- The mock serves service info for the http WES entry, so only the
  https rule can drop it.
- setUp() unsets OIDC_SCOPE; the refresh tests check the log for a
  distinctive token value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
The mock WES service parses the run request, rejects an invalid
workflow URL, type or version, and records the fields, so the journey
checks what the app submits, not only that it submits.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
Add a privacy notice at /privacy, reachable without login and linked
from the login page and the sidebar. It says what Krini processes
(session cookies, the user info of the login provider, display
settings; no tracking) and what happens at the login provider, the
services that run tasks and workflows, and the registry.

Who is responsible, their contact and links to the deployment's full
notice and the login provider's notice come from optional settings
(PRIVACY_*), read at runtime; invalid values are ignored with a
warning.

End-to-end tests check the page and that visitors get no cookies and
members only the session's.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
The notice now lists every cookie with its purpose and lifetime, as
the auth routes and the sidebar set them, and names group
memberships among the user info. End-to-end tests check that the
notice lists every cookie, and that only the logout marker is left
after logout. The deployment guide explains the settings, that they
are read at runtime, and where deployment-specific text goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
- Say that browsers contact the selected services directly, also
  without login, that only WES services get the token for now, and
  that the workflow form's code editor loads a script from
  cdn.jsdelivr.net.
- Narrow the claim about scripts: the page gets the access token.
- The end-to-end test compares the notice's cookies with those the
  app sets across the visitor, login and logout flows, and the build
  runs without the privacy settings, so prerendering would fail it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@vercel

vercel Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
krini Ready Ready Preview Nov 13, 2026 12:46pm UTC

@uniqueg
uniqueg changed the base branch from test/51-unit-e2e to staging November 12, 2026 07:49
@sourcery-ai

sourcery-ai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Implementation

Add request-time privacy setting parsing and validation, ignoring invalid contacts and URLs with server warnings.

  • src/lib/privacy.ts L1-90

UI

Render the public privacy notice with deployment settings, cookie details, and disclosures about login and connected services.

  • src/app/privacy/page.tsx L1-206

Link the notice from the login page and sidebar so visitors can reach it before login and members can find it in navigation.

  • src/app/auth/login/page.tsx L3, L9, L28-36
  • src/components/shared/app-sidebar/app-sidebar.tsx L2, L35-44

Configuration

Configure Playwright to build without privacy settings and provide them at runtime, exercising the request-time behavior.

  • playwright.config.ts L9, L51-53, L68-71

Provide deployment-specific privacy settings to the end-to-end tests.

  • e2e/settings.ts L19-26, L43

Documentation

Document the optional privacy environment variables, notice behavior, and verification coverage in the README.

  • README.md L60-65, L77-81, L115

Explain deployment setup, runtime configuration, and the scope of the privacy notice in deployment guidance.

  • docs/deployment.md L118-120

Tests

Test that privacy settings are parsed correctly, including invalid values and environment-based defaults.

  • src/lib/privacy.test.ts L1-88

Exercise notice navigation, runtime settings, cookie behavior, and agreement between listed and actual cookies.

  • e2e/privacy.spec.ts L1-102

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@uniqueg uniqueg closed this Nov 12, 2026
@uniqueg uniqueg reopened this Nov 12, 2026
@uniqueg
uniqueg marked this pull request as ready for review November 12, 2026 07:55

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 6 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="src/app/privacy/page.tsx" line_range="166-167" />
<code_context>
+                        <span className="font-medium">
+                            The services that run tasks and workflows
+                        </span>{" "}
+                        are contacted by your browser directly once you select
+                        one, also without login, so they see your IP address and
+                        browser. Workflow services (WES) also get your access
+                        token and record your user identifier with each
</code_context>
<issue_to_address>
**WES probes are undisclosed**

When a visitor loads the WES service list and the registry contains WES services, `GET /api/workflows/get-wes-servers` probes every registered WES service before the visitor selects one, so those services receive the deployment server’s IP address even though the notice describes only browser requests after selection.

Update the notice to disclose the server-side requests to registered WES services and the IP address those services receive.

Also at `docs/deployment.md:120`.
</issue_to_address>

### Comment 2
<location path="src/app/privacy/page.tsx" line_range="132-133" />
<code_context>
+                <p>
+                    All cookies except the sidebar setting are strictly
+                    necessary for logging in and staying logged in. Only Krini
+                    reads them. Scripts on the page can&apos;t read the refresh
+                    and ID tokens. The page gets the access token from Krini, to
+                    send it to the services you use.
+                </p>
</code_context>
<issue_to_address>
**Cookie access is understated**

When a visitor reads the cookie disclosure, the notice says only Krini reads the cookies, but `token_expires_at` and `sidebar_state` are not HttpOnly, so page scripts can read them; scripts loaded from the CDN run in the page context too. Visitors are given an inaccurate account of cookie access.

Clarify that scripts running in the page can access non-HttpOnly cookies, or make those cookies HttpOnly where client-side access is not required.
</issue_to_address>

### Comment 3
<location path="src/app/privacy/page.tsx" line_range="108-109" />
<code_context>
+                    <li>
+                        <span className="font-medium">No tracking.</span> Krini
+                        has no analytics and no advertising, and it sets no
+                        cookies for visitors who don&apos;t log in, apart from
+                        the display setting below.
+                    </li>
+                    <li>
</code_context>
<issue_to_address>
**Abandoned login still sets a cookie**

When a visitor starts login but does not complete the callback, `/auth/api/login-redirect` sets an `authState-*` cookie before authentication, and an abandoned login leaves it until its 10-minute expiry. The notice therefore incorrectly says visitors who don't log in get no cookies apart from the display setting.

Change the claim to distinguish visitors who do not start login from visitors who abandon a login in progress.
</issue_to_address>

### Comment 4
<location path="src/app/privacy/page.tsx" line_range="115-116" />
<code_context>
+                        <span className="font-medium">Your user info</span> from
+                        the login provider: what it releases to Krini, such as
+                        your name, email address, identifier and group
+                        memberships. Krini shows it while you&apos;re logged in
+                        and doesn&apos;t store it on its server.
+                    </li>
+                    <li>
</code_context>
<issue_to_address>
**Group claims aren't displayed**

When the login provider releases group memberships in its user-info response, `useUserInfo` receives the provider's user-info object, but the account menu displays only the name, email, or subject; no UI displays group memberships. The notice says Krini shows the listed information, so users are told that group claims are displayed when they are not.

Distinguish information Krini receives from the specific user fields it displays.
</issue_to_address>

### Comment 5
<location path="src/lib/privacy.ts" line_range="21" />
<code_context>
+
+type Env = Record<string, string | undefined>;
+
+const EMAIL = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
+
+/**
</code_context>
<issue_to_address>
**Invalid contact address is shown**

When `PRIVACY_CONTACT` is set to an address with consecutive dots in its domain, `EMAIL.test` accepts malformed addresses such as `[email protected]`, so `contactOf` renders a broken `mailto:` link and visitors cannot reach the configured privacy contact.

Validate email domain labels so malformed addresses are rejected with a warning.
</issue_to_address>

### Comment 6
<location path="src/lib/privacy.test.ts" line_range="82" />
<code_context>
+    });
+
+    it("reads the environment by default", () => {
+        expect(privacySettings()).toHaveProperty("controller");
+    });
+});
</code_context>
<issue_to_address>
**Default settings go unverified**

When `privacySettings()` is changed to return defaults instead of reading `process.env`, the test named `reads the environment by default` only checks that the result has a `controller` property. `privacySettings()` can stop reading `process.env` and always return null settings, and this test still passes; the privacy page uses this default call and would ignore deployment settings.

Stub a known `PRIVACY_CONTROLLER` value and assert that the no-argument call returns it.
</issue_to_address>

Sourcery assessment

Approval pending. 6 findings to address first.

Blocking findings: src/app/privacy/page.tsx:167, src/app/privacy/page.tsx:133, src/app/privacy/page.tsx:109, src/app/privacy/page.tsx:116, src/lib/privacy.ts:21, and 1 more


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread src/app/privacy/page.tsx Resolved
Comment thread src/app/privacy/page.tsx Resolved
Comment thread src/app/privacy/page.tsx Resolved
Comment thread src/app/privacy/page.tsx Resolved
Comment thread src/lib/privacy.ts Resolved
Comment thread src/lib/privacy.test.ts Resolved
- A started login sets a cookie, also when it is abandoned.
- Krini shows the name and the email address or identifier, not all
  user info.
- Page scripts can read token_expires_at and sidebar_state.
- Krini's server checks the registered WES services, without user
  data (also in the deployment guide).
- Reject email contacts with empty domain labels, and test that the
  settings are read from the environment by default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_011FSoqMpmDCfbACLj3uy6xV
@vercel
vercel Bot temporarily deployed to Preview – krini November 12, 2026 08:29 Inactive
@vercel
vercel Bot temporarily deployed to Preview – krini November 13, 2026 12:46 Inactive

@AnonymousXC AnonymousXC left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@AnonymousXC
AnonymousXC merged commit 5442ddb into staging Nov 13, 2026
7 checks passed
@AnonymousXC
AnonymousXC deleted the docs/9-privacy-notice branch November 14, 2026 05:50
This was referenced Nov 14, 2026

This branch was previously deployed

1 inactive deployment
Preview – krini — 18eb73e7 Deployed Nov 13, 2026 by vercel[bot]
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.

2 participants