Package com.kingsrook.qqq.backend.core.actions.profile


package com.kingsrook.qqq.backend.core.actions.profile
  • Class
    Description
    Turns an uploaded image into the standard avatar sizes, safely: - the type comes from the file's magic bytes only (PNG, JPEG, GIF, WebP); SVG, HTML and everything else is refused, so no script can be served; - the size and the pixel dimensions are bounded before decoding (a decompression bomb is refused from its header); - the image is decoded, centre-cropped square, turned upright (JPEG EXIF orientation), resized, and re-encoded as PNG: re-encoding drops all metadata (EXIF and its GPS position, XMP, comments).
    A user's chosen Gravatar, fetched by the server and re-encoded like an uploaded photo: browsers never contact Gravatar (no viewer IP, no email hash in any URL), and nothing Gravatar returns is served as-is.
    Fetches a Gravatar's raw image bytes, or null when there is none.
    Installs the core user profile: the user_profile table, the "profile" preferences section (photo, display name, optional Gravatar) and the UserProfilesMetaData settings.
    Preferences provider of the core "profile" section (photo, display name and, when the app allows it, Gravatar).
    Read side and security of the core user profile: a user's row, their avatar (addressed by an opaque avatarId, never by user id or email) and its storage objects, the record-lock keys for sessions, and the values a session sends to its frontend.
    What GET /avatars serves for an avatarId: the user's photo (avatarKey), or their chosen Gravatar (fetched and re-encoded by the server, so neither the email hash nor the viewer reaches Gravatar's URL from a browser).