Salta ai contenuti
HitKeep
Seleziona lingua
Seleziona tema
GitHub
Inizia gratis in Cloud

HitKeep Security Model for Analytics Deployments

Questi contenuti non sono ancora disponibili nella tua lingua.

Enterprise and government deployments require auditability at every layer. This page documents every security control in HitKeep — from the HTTP server to the browser, and everything in between.

When a visitor loads your HitKeep dashboard, their browser makes zero requests to third-party domains. Every asset — the Angular application, fonts, icons, and the tracking snippet — is served from your own instance.

Asset Source
Angular dashboard (JS, CSS) your-instance.example.com
OpenNG icons, fonts Bundled into the Angular app — served from your instance
hk.js tracking snippet your-instance.example.com/hk.js
Favicon images Server-side proxied (see below) — no browser-to-third-party requests
API calls your-instance.example.com/api/* exclusively

This is verifiable: open your browser’s Network tab with HitKeep loaded and filter by third-party requests. There are none.

This matters for:

  • Content Security Policy (CSP) — you can write a restrictive default-src 'self' policy without allowlisting external domains
  • GDPR Article 44+ — no data transfer to third countries via asset loading
  • Zero Trust network policies — HitKeep dashboard users do not need outbound internet access
  • Restricted-network deployments — the dashboard works without third-party frontend assets or external analytics calls

The dashboard displays site favicons to help identify tracked domains. Favicons are fetched via DuckDuckGo’s public favicon service (icons.duckduckgo.com), but the request is made server-side by HitKeep, not by the browser.

The browser requests:

GET /api/favicon/{domain} ← your HitKeep instance only

HitKeep’s server then fetches:

GET https://icons.duckduckgo.com/ip3/{domain}.ico

The browser never contacts DuckDuckGo. The favicon is proxied back with a 24-hour cache header.

Security properties of the proxy implementation:

  • Domain is validated and normalized before the upstream request is constructed
  • URL is built programmatically using url.URL (no string interpolation) to prevent injection
  • HTTP redirects from the upstream are NOT followed (prevents SSRF via redirect chaining)
  • 5-second upstream timeout enforced
  • The //go:build comment on the handler documents the intent explicitly: the URL is constrained to DuckDuckGo’s fixed host only

Source: internal/server/sites/handlers.go — handleGetFavicon()

HitKeep contains no telemetry, no usage reporting, and no phone-home mechanism of any kind.

What doesn’t happen Notes
Version check to external server Never performed
Crash/error reporting to external service Errors log locally via slog only
Feature flag fetch from external endpoint No feature flag service used
License validation against external server MIT license — no validation needed
Anonymous usage statistics Not collected

You can run HitKeep core analytics in a restricted network with no outbound internet access when optional outbound features, including configured operational webhooks, are disabled.

Verification: The full source is MIT-licensed on GitHub. Audit cmd/ and internal/ for outbound integrations such as favicon lookup, mail delivery, S3 backup/archive paths, or optional AI provider calls before using HitKeep in a tightly restricted network.

AI-powered product features are off by default. When HITKEEP_AI_ENABLED=true and a provider/model are configured, HitKeep can send a structured, feature-specific request to the configured provider or gateway.

For Opportunities, detectors create the recommendation candidate first. HitKeep accepts only approved translation keys, interpolation params, and cited evidence IDs from the provider response. Output that does not match the detector contract is rejected before saving.

HitKeep does not persist raw prompts, raw provider responses, raw external error bodies, or provider secrets. AI run records keep audit metadata, hashes, token/request usage where available, lifecycle events, safe error categories, and the final validated structured output.

HitKeep uses JSON Web Tokens stored in HTTP-only cookies for session authentication.

Property Value
Storage HTTP-only cookie (not accessible to JavaScript)
Expiry Short. Defaults to 15 minutes and is configured with -auth-session-minutes
Algorithm HMAC-SHA256
Secret Set via HITKEEP_JWT_SECRET environment variable — minimum 32 bytes recommended
Scope Per-user claims, not shared

HTTP-only cookies prevent JavaScript from reading the session cookie. They do not prevent a malicious script from making requests through the user’s authenticated browser.

The dashboard shows the remaining session time and opens an accessibility-friendly warning before expiry. Users can extend the session with one action. Operators can configure the warning lead time with -auth-session-warning-seconds.

If a user signs out, or the session ends before the next request can refresh it, HitKeep returns to the login screen with a short status message that distinguishes intentional sign-out from an ended session. The message is announced through an accessible polite status region; a direct visit to /login does not show either notice.

When remember-me is enabled by the user, HitKeep stores a separate HTTP-only remembered sign-in token. Its lifetime defaults to 30 days and is configured with -auth-remember-me-days. The dashboard session API exposes both the remembered expiry and configured duration so the frontend reflects the operator policy instead of hardcoding it.

Sign-out clears the current cookies and removes the current remember token. It does not instantly revoke a copied, unexpired stateless JWT. Requests also check that the human account still exists and is available; removed accounts cannot authenticate or restore remembered sessions. An unavailable authoritative account store fails closed. There is no per-device session inventory or instant remote-revocation guarantee.

Native sign-in requires HitKeep 2.17.0 or later and hands an ordinary human account session to an app through the system browser. Password, browser passkeys, configured social providers, team SSO, and applicable MFA keep their existing rules. Signup remains subject to the selected instance’s Cloud signup policy. Native sign-in and account management work with AI disabled; read-only MCP keeps its separate scoped-token authentication and does not accept these cookies.

Check the optional native_auth descriptor in GET /api/status on the selected instance. It supplies the canonical issuer, availability, endpoint URLs, supported S256 method, and browser/native passkey capabilities. A missing or unavailable descriptor requires a supported, ready server. Provider discovery and current account, team, site, and plan permissions remain authoritative.

Public client ID Exact HTTPS callback
hitkeep-ios https://hitkeep.com/auth/native/ios/callback
hitkeep-android https://hitkeep.com/auth/native/android/callback

The public IDs identify the client type; they do not authenticate an app binary. Release apps need verified OS associations for their claimed HTTPS callbacks. iOS claimed HTTPS callbacks require iOS 17.4 or later. These endpoints do not accept arbitrary redirects, wildcards, or custom-scheme fallbacks. Source support and a capability flag do not establish signed-device acceptance, provider configuration, or store availability.

  1. Save the selected full canonical instance, callback, random state, and S256 verifier before calling POST /api/auth/native/start. Its strict JSON body contains client_id, redirect_uri, code_challenge, code_challenge_method: "S256", state, intent: "login" or "signup", and optional remember_me.
  2. Open the returned authorization_url in the system browser. Sign in and complete any applicable MFA. The browser shows the final account, instance, and full account authority, then requires explicit approval for this attempt. Signing in, email verification, and opening a consent page do not approve it.
  3. Accept only the saved exact callback with matching state and iss. Success contains only code, state, and iss; denial contains error=access_denied, state, and iss. Never choose the instance or exchange endpoint from callback data.
  4. Send exactly client_id, redirect_uri, code, and code_verifier as JSON to the original instance’s POST /api/auth/native/exchange. Success returns {"status":"ok"} and fresh ordinary HTTP-only session cookies directly to the app’s cookie jar. Continue with the existing /api/user/bootstrap and session APIs.

Pending requests last at most ten minutes and exchange codes at most one minute. Codes are consumed once, before cookie issuance. Expiry, server restart or leader change, missing state, issuance failure, or a lost exchange response requires starting again. Do not replay the code. Native requests normally omit browser Origin/Referer headers; any supplied Origin must match the canonical instance origin. Ambient API, OAuth, or embed credentials cannot authorize a native exchange.

Canonical native issuers use HTTPS, lowercase the scheme and host, remove default :443 and the trailing slash, and preserve a nondefault port and case-sensitive deployment prefix. Literal and encoded UTF-8 prefixes share canonical escaping: /café and /caf%c3%a9 become /caf%C3%A9. Unicode is not normalized, so decomposed text remains distinct. Literal served characters such as ! remain literal; semicolons use %3B. Invalid UTF-8, controls, traversal, encoded separators, and nested escapes are rejected. Delegated OAuth currently rejects Unicode or escaped issuer prefixes even though native browser handoffs support them.

Isolate credentials, cookies, and caches by the full canonical instance, including its prefix. Ordinary session cookies retain Path=/; a shared host alone is not an isolation boundary. Self-hosted credentials go directly between the selected instance and app, with no credential relay through Cloud or the callback website. Keep cookies, codes, verifiers, and redirect locations out of logs. Native API responses are not cached. The exact browser consent and management pages use same-origin referrer policy for their form checks; off-origin callbacks receive no Referer.

See the API reference for exact request limits and errors, and native passkey setup for operator-controlled Android trust. Arbitrary self-hosted instances use browser passkeys; Cloud iOS native passkeys additionally need verified RP associated-domain delivery.

Apps can use the system browser to register a passkey, link a configured social provider, or connect Google Search Console for one exact team the user can manage. Discover the optional native_auth.management descriptor in /api/status: it provides start_url, complete_url, and actions_supported. An advertised action still needs its provider configuration and current permissions.

POST /api/auth/native/management/start requires the app’s current ordinary human session. It uses the fixed client/callback, state, and S256 fields above, plus exactly one action:

Action Additional target fields
passkey_register None; enter the passkey name in the browser
social_link provider, from configured provider discovery
search_console_connect team_id, the exact authorized team UUID

The server fixes the actual account, instance, and target. The browser requires fresh primary authentication as that same user, all applicable MFA, and explicit approval of the exact action. It uses the existing passkey, social, or Search Console flow in its own cookie jar. Search Console permissions and native authorization are checked again when the connection is saved. Credentials and provider tokens are not transferred to the app.

After persistence, a second explicit browser confirmation returns a short-lived one-use receipt through the same fixed callback. POST /api/auth/native/management/complete takes exactly the four native exchange fields and the app’s current ordinary session. It checks the saved user, action, target, issuer, callback, S256 binding, expiry, and committed result. Success is only {"status":"ok"}, with no Set-Cookie. A missing or expired session returns plain-text 401 Unauthorized without consuming a valid receipt; restore or extend the ordinary session through its existing APIs first. Remember-only credentials do not restore a session here.

Login codes, deletion proofs, and management receipts cannot replace one another. After cancellation, browser closure, callback loss, or a lost completion response, refresh /api/user/security or the exact team’s Search Console status before starting again. A missing receipt does not prove the change was not saved and does not authorize a mutation retry.

In HitKeep 2.17.0 or later, use the account-deletion section in Settings to review removal of your own account. Export any data you need first. Preparation shows affected teams and sites, ownership requirements, and any explicitly selected Cloud team closures before a fresh sign-in and separate final confirmation.

  • Shared teams, their analytics, site IDs, subscriptions, and team credentials survive personal account removal. Where your sites must remain with a team, explicitly select an existing owner of that same team as successor. A sole team owner with other members must transfer ownership through the normal team controls first.
  • Only a truly solo Cloud team can be explicitly selected for closure. Closure removes its analytics immediately after verified cancellation of future subscription renewals at the end of the paid period. It does not issue a refund or end the paid billing period early. Required billing/legal records remain.
  • Self-hosted account deletion does not close teams. The last instance owner must hand over operator authority before removing their account.

The API requires a current ordinary human cookie; API-client, OAuth, and embed credentials are rejected even alongside a cookie. The sequence is:

  1. POST /api/user/account/deletion/prepare with successors and close_team_ids. Empty arrays discover consequences and blockers without deleting anything. Only an unblocked plan gets an attempt_id, consequence_hash, and expiry of at most ten minutes.
  2. Follow reauth.return_path in the browser, or start a native login with paired purpose: "account_delete" and reauth_attempt: "<attempt_id>", using intent: "login". Complete an actual linked primary method and all applicable configured MFA as the same account, even if already signed in. Native exchange binds proof to the newly issued app session, not the intermediate browser session.
  3. Read GET /api/user/account/deletion/{attempt_id} to recover the immutable summary and current-session reauth.verified status. Reading it never grants proof or performs removal. Email verification, password recovery, cookie restoration, session extension, and consent alone do not establish deletion proof. Credential, email, factor, or linked-primary changes invalidate prior proof.
  4. Show the consequences again and obtain separate final approval. Send DELETE /api/user/account with attempt_id, consequence_hash, and confirm: true. A successful 200 returns status: "deleted" and provider_revocations. Clear the app’s human/remembered credentials and account/analytics caches.

Apple revocation outcomes contain only provider: "apple" and status: "revoked" or "manual_revocation_required"; the array is empty when none applies. A failed bounded Apple revocation does not block local deletion. Show Apple Account management when manual revocation is required.

Changed ownership or billing consequences return 409; prepare and review again. Billing cancellation failure returns 503 before destructive cleanup; a still-valid authorized attempt can retry. Interrupted persisted removal requires service/storage recovery and resumes server-side. Removal is resumable across storage and billing boundaries, not one cross-provider transaction. Canceling sign-in does not authorize deletion or justify discarding the original valid app credentials. See the API reference for payloads and error categories.

RFC 6238 time-based one-time passwords. Compatible with any standard authenticator app (Authy, Google Authenticator, 1Password, Bitwarden).

  • Secret stored per-user in DuckDB on your server
  • QR code is generated server-side and shown once during enrollment
  • TOTP is enforced at every login after enrollment

FIDO2-compliant challenge-response authentication. Supports hardware security keys (YubiKey, etc.) and platform authenticators such as Face ID and Touch ID.

  • No password required
  • Private key never leaves the user’s device or security key
  • Phishing-resistant by design (origin-bound)

See Two-Factor Authentication →

Instance operators can enable Google, GitHub, Microsoft, and Apple as additional primary login methods. All use authorization code flow with browser-bound one-time state. Google, GitHub, and Microsoft use PKCE S256; Google and Microsoft also validate an OIDC nonce. GitHub uses its numeric user ID plus a primary verified email. Apple uses email-only form_post with saved nonce and original-browser Lax binding restored by a one-use receipt; it does not use upstream PKCE. Provider access and ID tokens are discarded. Apple retains one authenticated encrypted refresh token tied to the Services ID and immutable subject for bounded revocation on unlink/deletion; other providers retain no upstream tokens. Unavailable revocation requires manual Apple Account guidance and does not block local deletion.

Google and GitHub must return a verified email. Microsoft identities are keyed by tenant ID plus object ID and require HitKeep email confirmation when an authenticated session or matching invitation has not already proved the target account. Existing HitKeep MFA still runs before a social login receives a browser session.

Users can link or unlink providers under Settings → Security. HitKeep refuses to remove the last usable primary login method.

See Configure Social Sign-In →

Team owners and admins can connect a team to one OpenID Connect provider. HitKeep uses Authorization Code flow with PKCE S256, provider discovery, state, nonce, issuer and audience validation, and a required verified-email claim. Provider tokens are not stored after HitKeep creates its normal browser session. Managed-cloud discovery and provider requests are restricted to bounded HTTPS responses from publicly routable addresses; self-hosted operators can use reachable internal providers.

SSO is an additional login method. Password and passkey sign-in remain available, and provider groups are not mapped to HitKeep roles. HitKeep Cloud gates team SSO behind the Business plan; self-hosted deployments include it without a plan gate.

See Configure OIDC Single Sign-On →

HitKeep enforces role-based access control at two levels:

Level Roles
Instance owner (full instance control), admin (operational administration), user (site-scoped access)
Site owner (full site control), admin (site administration), editor (goals and funnels), viewer (read-only)

All role checks are enforced server-side in Go. The Angular dashboard reflects the current user’s roles, but access control is not dependent on frontend enforcement. Instance user management requires an instance owner. Owners can change another user’s instance role, but cannot change their own role; concurrent updates cannot remove the last instance owner.

See Permissions & Roles →

HitKeep limits requests per IP address on public and authenticated endpoints. Each limit allows short bursts of requests.

Endpoint Default behavior
POST /ingest Per-IP rate limited to absorb burst traffic safely
POST /api/ingest/server/* API-client or scoped OAuth server-side ingest for non-browser clients. Does not require browser Origin/Referer headers, uses the ingest limiter, and forwards from followers to the leader in clustered deployments
POST /api/login Stricter rate limit to prevent brute-force attacks
GET /api/* Per-IP rate limited

Rate limits are configurable via flags. See Configuration Reference →

MCP uses the API limiter and accepts API-client bearer tokens or resource-bound OAuth access tokens with explicit site consent and current user authority. AI fetch ingest uses the authenticated API surface, so crawler log forwarders should use scoped API client tokens instead of dashboard cookies.

HitKeep uses Go’s standard cross-origin protection as a defense-in-depth control for cookie-authenticated browser requests. Unsafe browser methods such as POST, PUT, PATCH, and DELETE are rejected when Sec-Fetch-Site identifies a cross-site or same-site initiator. When Fetch Metadata is unavailable, the server compares Origin with the request host.

Safe GET, HEAD, and OPTIONS requests remain available for normal navigation and token-bound authentication callbacks. Requests without Sec-Fetch-Site or Origin are treated as same-origin or non-browser traffic and continue to normal authentication and authorization. Server-to-server API clients, MCP clients, signed webhooks, and crawler forwarders should not synthesize browser-only headers.

The three public tracker ingest routes intentionally accept cross-origin browser POSTs. Their handlers validate the browser Origin, resolve the matching site, apply custom tracking-host checks, and enforce ingest rate limits before accepting analytics data.

This protection complements JWT authentication, API-client bearer tokens, callback state validation, and SameSite cookies; it does not replace them.

HitKeep serves HTTP on the configured port. TLS termination is handled by your reverse proxy (Caddy, Traefik, nginx, or a cloud load balancer). This is the standard practice for Go applications.

Recommendation for production: Run behind Caddy with automatic HTTPS — it handles Let’s Encrypt certificate provisioning and renewal with a single reverse_proxy directive.

Configure security headers at your reverse proxy layer. Recommended headers for HitKeep deployments:

Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';
X-Frame-Options: DENY
X-Content-Type-Options: nosniff
Referrer-Policy: strict-origin-when-cross-origin
Permissions-Policy: geolocation=(), camera=(), microphone=()

Because HitKeep serves all assets from the same origin, a default-src 'self' policy is achievable without allowlisting external CDNs.

HitKeep core analytics can run with no outbound internet access:

  • No license server calls
  • No telemetry
  • No external CDN dependencies for assets
  • Optional features such as favicon lookup, SMTP delivery, S3 backups, Search Console sync, configured operational webhooks, and AI provider enrichment can add outbound calls
  • Docker image can be pulled once, pushed to a private registry, and used offline indefinitely

HitKeep has a coordinated disclosure policy. To report a security vulnerability, use GitHub Security Advisories.

See SECURITY.md on GitHub →

HitKeep Cloud uses the same product security model in managed EU or US infrastructure with region-specific hosting. Start with HitKeep Cloud →