Profile pictures from Gravatar or the identity provider, fetched and kept by the server

Both sources are off until switched on under Settings, Sign-in. The server asks only
gravatar.com (by a hash of the email) and the identity provider's own host, accepts only
small PNG/JPEG/WebP/GIF, keeps each picture for a day and serves it from /api/avatars/<id>,
so browsers never contact either. Shown in the user menu and on the Users page, with initials
as the fallback; the Privacy page says when it is on.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-18 23:47:50 +02:00
1 parent 9782bd3252
commit c05c847d17
26 files changed
+4361 -21

No files matched your search

+14
View File
@@ -260,6 +260,20 @@ export default function Privacy() {
<strong>Certificate checks</strong> — for {outbound?.tlsCertificateChecks ?? 0} secret{outbound?.tlsCertificateChecks === 1 ? "" : "s"} with
a host to check, the app connects to that host to read its certificate — never to this server itself, a loopback or link-local address, or a cloud metadata address.
</li>
<li className="mb-2">
<strong>Profile pictures</strong> —{" "}
{outbound && (outbound.profilePictures.gravatar || outbound.profilePictures.identityProvider) ? (
<>
this server fetches pictures
{outbound.profilePictures.identityProvider ? ` from the identity provider${outbound.profilePictures.identityProviderHost ? ` (${outbound.profilePictures.identityProviderHost})` : ""}` : ""}
{outbound.profilePictures.identityProvider && outbound.profilePictures.gravatar ? " and" : ""}
{outbound.profilePictures.gravatar ? " from Gravatar, which is sent a hash of each person's email address and sees this server's IP address" : ""}. Your browser never
contacts either: it asks this app, which keeps each picture for a day.
</>
) : (
"switched off, so nothing is fetched. People are shown as their initials."
)}
</li>
<li className="mb-2">
<strong>Skatteverket</strong> — only when an admin clicks "Import from Skatteverket" under Settings → Names, the app asks
Skatteverket's open name statistics for the most common given names. The request carries a sex and a birth year, nothing about you
+7 -1
View File
@@ -9,6 +9,7 @@ import { ErrorNotice } from "../components/Notice";
import { SearchBox } from "../components/TableToolbar";
import { useTableSearch } from "../hooks/useTableSearch";
import { EmptyRow, LoadingRow } from "../components/EmptyState";
import Avatar from "../components/Avatar";
const ROLES: UserRole[] = ["viewer", "operator", "admin"];
@@ -95,7 +96,12 @@ export default function Users() {
<tbody>
{sorted?.map((u) => (
<tr key={u.id}>
<td>{u.name ?? "—"}</td>
<td>
<span className="d-inline-flex align-items-center gap-2">
<Avatar name={u.name ?? u.email ?? u.oidcSub} src={u.avatarUrl} />
{u.name ?? "—"}
</span>
</td>
<td>{u.email ?? "—"}</td>
<td style={{ maxWidth: 160 }}>
<select
+42 -3
View File
@@ -1,5 +1,5 @@
import { useEffect, useState } from "react";
import { api, type GroupRolePreview, type SignInSettings as SignInSettingsData } from "../../api/client";
import { api, type GroupRolePreview, type ProfilePictureSettings, type SignInSettings as SignInSettingsData } from "../../api/client";
import { ErrorNotice } from "../../components/Notice";
import { PageSkeleton } from "../../components/Skeleton";
import { readableError } from "../../utils/errors";
@@ -7,6 +7,7 @@ import { toast } from "../../utils/toast";
import ExportTableButton from "../../components/ExportTableButton";
const DEFAULTS: SignInSettingsData = { roleFromGroups: false, groupsClaim: "groups", adminGroups: [], operatorGroups: [], otherwise: "viewer" };
const NO_PICTURES: ProfilePictureSettings = { gravatar: false, identityProvider: false };
/** One name per line or separated by commas — whichever is easier to paste in. */
const parseNames = (text: string): string[] => [...new Set(text.split(/[\n,]/).map((s) => s.trim()).filter(Boolean))];
@@ -25,6 +26,8 @@ export default function SignInSettings() {
const [operatorText, setOperatorText] = useState("");
const [otherwise, setOtherwise] = useState<"viewer" | "keep">("viewer");
const [preview, setPreview] = useState<GroupRolePreview | null>(null);
const [loadedPictures, setLoadedPictures] = useState<ProfilePictureSettings>(NO_PICTURES);
const [pictures, setPictures] = useState<ProfilePictureSettings>(NO_PICTURES);
const [busy, setBusy] = useState<"check" | "save" | null>(null);
useEffect(() => {
@@ -38,6 +41,9 @@ export default function SignInSettings() {
setAdminText(s.adminGroups.join("\n"));
setOperatorText(s.operatorGroups.join("\n"));
setOtherwise(s.otherwise);
const p = res.settings.profilePictures ?? NO_PICTURES;
setLoadedPictures(p);
setPictures(p);
})
.catch((err) => setError(readableError(err)));
}, []);
@@ -45,7 +51,7 @@ export default function SignInSettings() {
if (!loaded) return error ? <ErrorNotice error={error} /> : <PageSkeleton />;
const draft = (): SignInSettingsData => ({ roleFromGroups: enabled, groupsClaim: claim.trim() || "groups", adminGroups: parseNames(adminText), operatorGroups: parseNames(operatorText), otherwise });
const dirty = JSON.stringify(draft()) !== JSON.stringify(loaded);
const dirty = JSON.stringify(draft()) !== JSON.stringify(loaded) || JSON.stringify(pictures) !== JSON.stringify(loadedPictures);
async function check() {
setBusy("check");
@@ -65,8 +71,9 @@ export default function SignInSettings() {
setError(null);
try {
const d = draft();
await api.settings.update({ signIn: d });
await api.settings.update({ signIn: d, profilePictures: pictures });
setLoaded(d);
setLoadedPictures(pictures);
toast.success(d.roleFromGroups ? "Saved. Roles now follow groups at each sign-in." : "Saved. Roles are set by hand on the Users page.");
} catch (err) {
setError(readableError(err));
@@ -144,6 +151,38 @@ export default function SignInSettings() {
</div>
</div>
<div className="card mb-3">
<div className="card-header">
<h3 className="card-title">Profile pictures</h3>
</div>
<div className="card-body">
<p className="text-secondary">
Without a picture a person is shown as their initials. Either source below can be allowed; the picture from the identity provider is tried first. Both are off, because each means
<strong> this server</strong> asks an outside address for a picture. People's browsers never do: the server fetches, checks (small PNG, JPEG, WebP or GIF only) and keeps the pictures for a day,
and serves them from this app. A change shows within a day, or on the next sign-in for a new picture address.
</p>
<label className="form-check mb-2">
<input type="checkbox" className="form-check-input" checked={pictures.identityProvider} onChange={(e) => setPictures({ ...pictures, identityProvider: e.target.checked })} />
<span className="form-check-label">
The picture the identity provider gives
<span className="form-hint d-block">
The <code>picture</code> claim from Authentik, kept at each sign-in. Only addresses on Authentik's own host (or Gravatar, if that is allowed too) are used.
</span>
</span>
</label>
<label className="form-check mb-0">
<input type="checkbox" className="form-check-input" checked={pictures.gravatar} onChange={(e) => setPictures({ ...pictures, gravatar: e.target.checked })} />
<span className="form-check-label">
Gravatar
<span className="form-hint d-block">
gravatar.com is sent a SHA-256 hash of the person's email address (not the address itself), and sees this server's IP address. Anyone who already knows an address can check
it against a hash, so leave this off if the email addresses are private.
</span>
</span>
</label>
</div>
</div>
{preview && (
<div className="card">
<div className="card-header">