Repository navigation
feat: add a privacy notice - #64
Conversation
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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideImplementationAdd request-time privacy setting parsing and validation, ignoring invalid contacts and URLs with server warnings.
UIRender the public privacy notice with deployment settings, cookie details, and disclosures about login and connected services.
Link the notice from the login page and sidebar so visitors can reach it before login and members can find it in navigation.
ConfigurationConfigure Playwright to build without privacy settings and provide them at runtime, exercising the request-time behavior.
Provide deployment-specific privacy settings to the end-to-end tests.
DocumentationDocument the optional privacy environment variables, notice behavior, and verification coverage in the README.
Explain deployment setup, runtime configuration, and the scope of the privacy notice in deployment guidance.
TestsTest that privacy settings are parsed correctly, including invalid values and environment-based defaults.
Exercise notice navigation, runtime settings, cookie behavior, and agreement between listed and actual cookies.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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'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'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're logged in
+ and doesn'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
- 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
Signed-off-by: Chitransh <[email protected]>
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:
@elixir-cloud/design);Per deployment, all optional and read at runtime (
src/lib/privacy.ts):PRIVACY_CONTROLLER: who is responsible;PRIVACY_CONTACT: an email address or anhttpsURL;PRIVACY_NOTICE_URL: the deployment's full notice;PRIVACY_LOGIN_NOTICE_URL: the login provider's notice.URLs must be
httpsand 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_URLlinks. This needs no Markdown renderer.Stacked on #63 (#51, tests). The base is
staging, because CI runs only for PRs intodev,masterandstaging. 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 themjavascript:andhttpURLs, 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 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,TestandEnd-to-end testspass. 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)
@elixir-cloud/designloads 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
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:
/privacypage describing Krini’s data processing, cookies, third-party services, and deployment-specific privacy contacts.Enhancements:
Documentation:
Tests: