Skip to content

Security

Atlas is a client-side UI library. It relies on Angular's built-in protections and adds a few of its own; the security boundary of your app is still your server.

What the library does

  • It makes no HTTP requests and reads or writes no cookies, local storage or session storage.
  • It does not evaluate code from strings (eval, new Function).
  • Data you pass in reaches the page through Angular bindings, never by building HTML strings.

Rendering and XSS

Labels, options, grid cells and the other values you give components are rendered with Angular interpolation and property bindings, which escape and sanitize them, so a value such as <img onerror=…> shows as text. Custom cell, header and item templates are your own Angular templates and get the same protection. Keep it that way in your code: avoid [innerHTML] with untrusted content and never pass it through DomSanitizer.bypassSecurityTrust*.

Icons are trusted markup

AtlasIconRegistry marks every registered SVG string as trusted HTML (Angular's sanitizer would strip SVG otherwise) and atlas-icon inserts it as is. Register only icons that ship with your build — the built-in atlas:* set, an icon package such as lucide-static, or files in your repository. Never register SVG that comes from users, an API response or a URL parameter.

src/app/icons.ts
import { fromLucide } from '@atlas/components/core';
import { Save, Trash2 } from 'lucide-static';

// SVG bundled with the app: safe to register.
export const appIcons = fromLucide({ Save, Trash2 });

// Never: registry.register({ logo: { name: 'logo', svg: response.svg } });

Exports and clipboard

In local data mode the data grid builds CSV, Excel and clipboard text in the browser. To block spreadsheet formula injection, a cell value that starts with =, +, -, @, a tab or a carriage return is prefixed with an apostrophe, so Excel shows it as text instead of running it. Column headers are only quoted, not prefixed: build them in your code, not from user input. Excel export is tab-separated text saved with an .xls extension, not a binary workbook.

Server-mode data grid

In server mode the grid emits stateChange (page, sort, filters, search) and exportRequest, and you load the data. Treat everything in those events as untrusted input on the server:

  • Allow-list sortable and filterable field names; never put them into SQL or query strings unescaped.
  • Cap the page size, and check authorization for every page and every export, not just for the first view.
  • Validate rows from rowSave and deleteRow on the server; hidden or read-only columns are a UI choice, not access control.

buildApiParams(state) turns the grid state into HttpParams for your own HttpClient call; it encodes the values but does not validate them.

Content Security Policy

  • Atlas references no external scripts, fonts or images (an avatar loads only the src you give it); styles come from your Tailwind build.
  • Angular adds component styles in <style> elements. Under a strict style-src, give Angular a nonce with the ngCspNonce attribute on the root element or the CSP_NONCE token.
  • With Trusted Types enforced, allow Angular's policies: angular, angular#bundler for lazy-loaded chunks, and angular#unsafe-bypass because the icon registry uses bypassSecurityTrustHtml.
Content-Security-Policy
require-trusted-types-for 'script';
trusted-types angular angular#bundler angular#unsafe-bypass;