Repository navigation
Network Mapper Icon Libraries Developer Guide
What it does for the analyst: Network Mapper Β· the basics of the editor: Network Mapper - Developer Guide Β· shapes, pages, layers and connectors: Network Mapper - Shapes and Layers - Developer Guide Β· Knowledge links and PNG / PDF export: Network Mapper - Knowledge and Export - Developer Guide
This page covers three pieces of GH #433, built in November 2026: icon libraries imported from icons.diagrams.net (commit a005676dc), My images - uploaded and pasted pictures (the images half of commit 0077f702f) - and CMDB class icons (commit e76d62a8c). It assumes the editor basics from the overview page and does not repeat them.
icons.diagrams.net is draw.io's catalogue of about a thousand icon sets (IBM Carbon, Azure, Cisco, Kubernetes, Font Awesome and many community sets). The Libraries button on the Shapes tab opens a browser of that catalogue. An analyst picks a set, sees every icon with its licence, author and source, and presses Import. The server then downloads the icons in batches and copies them into the database, so a diagram never depends on that site staying up and opening a diagram never contacts it.
Every downloaded picture passes a gate before it is stored: PNG, JPEG, GIF and WebP are recognised by their first bytes; SVG is parsed and cleaned of everything that can run or reach out (script, event handlers, foreignObject, outside references, DOCTYPE tricks); anything else is skipped. The stored icons are served by one small endpoint, api/network-mapper/icon.php, with a sandbox Content-Security-Policy and nosniff, so even an SVG opened directly in a tab runs nothing.
My images reuses the same tables. An analyst can upload PNG / JPEG / GIF / WebP pictures (never SVG) or paste a screenshot with Ctrl+V; the picture lands in a shared library with the slug my-images and, on the current version, is placed on the diagram at the mouse position.
On the canvas an icon is a normal shape with shape_type = 'icon' and an icon_id pointing at the stored picture. Removing a library or a picture never deletes shapes: the foreign key sets icon_id to NULL, and the shape stays where it was with a dashed outline and no picture.
CMDB class icons are a different thing: they are the built-in glyphs from cmdb_icons (not imported pictures). A class can now pick one in CMDB settings, and a node with no icon of its own shows its class's icon.
Key: ποΈ schema Β· π read Β· βοΈ write Β· π₯οΈ UI Β· π security Β· π§ͺ test
| π¨ | File | What it does |
|---|---|---|
| ποΈ | database/freeitsm.sql |
network_icon_libraries, network_icon_library_icons, network_diagram_shapes.icon_id and the foreign keys fk_net_icon_lib and fk_net_shape_icon
|
| ποΈ | includes/db_verify_schema.php |
The same two tables for Database Verification |
| ποΈ | includes/db_verify_indexes.php |
Generated index list: uq_net_iconlib_slug, uq_net_icon_lib_sort, ix_net_shape_icon
|
| ποΈ | api/system/db_verify.php |
Adds the two foreign keys, and before that cleans orphans with the same meaning (SET NULL for shapes, CASCADE for icons) |
| βοΈ | includes/services/network_icons.php |
NetworkIconService - catalogue, preview, import, My images, the image gate and the SVG cleaner, the outbound fetch rules |
| βοΈ | api/network-mapper/icon_libraries.php |
Thin JSON adapter: catalogue, preview, libraries, palette (GET); import_start, import_batch, delete, upload, delete_image (POST) |
| π π | api/network-mapper/icon.php |
Serves one stored picture with its own type, nosniff, a sandbox CSP and a one-day private cache |
| π | api/network-mapper/get_diagram.php |
Returns icon_id on every shape; joins cmdb_icons for each node's class_icon
|
| βοΈ | includes/services/network_mapper.php |
replaceContents() keeps a shape's icon_id only when the icon exists; createVersion() copies it |
| π₯οΈ | assets/js/network-mapper.js |
The palette section, the library browser, the import loop, uploadImages(), onPaste(), deleteMyImage(), and drawing an icon shape as an <img>
|
| π₯οΈ | assets/js/network-mapper-shapes.js |
Defines the icon shape type (no outline, label underneath) |
| π₯οΈ | network-mapper/diagram.php |
The #iconLibModal markup, its CSS, and the click-outside close |
| π₯οΈ |
network-mapper/help.php, lang/en/network-mapper.php
|
The help tips (shapes_tip_icons, shapes_tip_images) and every iconlib.* string (22 languages under lang/) |
| π₯οΈ | includes/feature_bingo/cards/network-mapper.php |
Bingo cards network-mapper.icon_libraries and network-mapper.my_images
|
| βοΈ | includes/services/cmdb_schema.php |
CmdbSchemaService::saveClass() - the "absent keeps the icon" fix |
| βοΈ | api/cmdb/save_class.php |
The class save endpoint (CMDB module access plus Cap::CMDB_CLASSES) |
| π | api/cmdb/get_classes.php |
Returns icon_id, icon_key and icon_label per class |
| π₯οΈ |
cmdb/settings/index.php, cmdb/settings/settings.js
|
The class icon picker (window.cmdbClassIcons, classIconRenderGrid(), classIconPick(), classIconClear()) |
| π |
includes/csrf.php, assets/js/csrf.js
|
The central CSRF check every POST here relies on |
| π | includes/ssl.php |
sslApplyCurl() - the install's TLS settings, applied to every outbound request |
| π | includes/uploads.php |
The install-wide upload rules; SVG is left out of UPLOAD_TYPES_IMAGE for the same reason My images refuses it |
| π§ͺ | tests/network-mapper-icon-libraries.php |
The cleaner, the image gate, icon shapes, versions, removal, My images |
| π§ͺ | tests/cmdb-schema-service.php |
Three checks for the class icon fix |
From database/freeitsm.sql:
CREATE TABLE IF NOT EXISTS `network_icon_libraries` (
`id` INT NOT NULL AUTO_INCREMENT,
`slug` VARCHAR(120) NOT NULL,
`title` VARCHAR(255) NOT NULL,
`licence` VARCHAR(255) NULL,
`author` VARCHAR(255) NULL,
`author_url` VARCHAR(500) NULL,
`source` VARCHAR(500) NULL,
`icon_total` INT NOT NULL DEFAULT 0,
`icon_count` INT NOT NULL DEFAULT 0,
`status` VARCHAR(20) NOT NULL DEFAULT 'importing',
`created_datetime` DATETIME NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_net_iconlib_slug` (`slug`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;One row per imported set. slug is the set's name on icons.diagrams.net and is unique, which is what makes "already imported" a single lookup. icon_total is how many icons the set's library file lists; icon_count is how many actually made it through the image gate. status is importing until the last batch, then ready - only ready sets reach the palette. My images is just another row in this table, with the slug my-images, made on first upload.
CREATE TABLE IF NOT EXISTS `network_icon_library_icons` (
`id` INT NOT NULL AUTO_INCREMENT,
`library_id` INT NOT NULL,
`sort` INT NOT NULL DEFAULT 0,
`title` VARCHAR(255) NULL,
`tags` VARCHAR(1000) NULL,
`mime` VARCHAR(40) NOT NULL,
`data` MEDIUMBLOB NOT NULL,
`w` INT NOT NULL DEFAULT 64,
`h` INT NOT NULL DEFAULT 64,
-- GH #433: who added a My images picture (NULL for imported sets). Only they, or an
-- admin, may remove it from the shared group.
`uploaded_by_analyst_id` INT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `uq_net_icon_lib_sort` (`library_id`, `sort`),
CONSTRAINT `fk_net_icon_lib` FOREIGN KEY (`library_id`) REFERENCES `network_icon_libraries` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;The picture itself is in data. Nothing is written to a web-served folder, so there is no file on disk for a web server to execute or serve with a guessed type - the only way out is api/network-mapper/icon.php. sort is the icon's position in the set, and the unique key on (library_id, sort) is what makes a retried batch safe: the import uses INSERT IGNORE, so a batch that runs twice cannot double the icons. w / h are the icon's natural size (from the library file for imports, from getimagesizefromstring() for uploads) and are used to size the shape when it is placed.
The link from a diagram:
-- An icon from an imported icon library (shape_type 'icon'); NULL for drawn shapes, and
-- for an icon whose library was removed (the shape keeps its place, loses the picture).
`icon_id` INT NULL,
...
KEY `ix_net_shape_icon` (`icon_id`),
...
ALTER TABLE `network_diagram_shapes`
ADD CONSTRAINT `fk_net_shape_icon` FOREIGN KEY (`icon_id`) REFERENCES `network_icon_library_icons` (`id`) ON DELETE SET NULL;ON DELETE SET NULL is the design decision for removal: a library or a picture can go, and every diagram that used it keeps its shapes. The service also clears icon_id explicitly before deleting (see section 4), so the rule holds even on an install where Database Verification has not yet added the foreign key.
Database Verification cleans orphans before it adds the keys, with the same meaning, from api/system/db_verify.php:
if ($tableExists('network_icon_library_icons')) {
// ...and an icon that is gone becomes no icon (SET NULL semantics).
$conn->exec("UPDATE network_diagram_shapes s LEFT JOIN network_icon_library_icons i ON i.id = s.icon_id
SET s.icon_id = NULL WHERE s.icon_id IS NOT NULL AND i.id IS NULL");
}
...
if ($tableExists('network_icon_library_icons') && $tableExists('network_icon_libraries')) {
$conn->exec("DELETE i FROM network_icon_library_icons i LEFT JOIN network_icon_libraries l ON l.id = i.library_id WHERE l.id IS NULL");
} ['network_diagram_shapes', 'fk_net_shape_icon', "ALTER TABLE network_diagram_shapes ADD CONSTRAINT fk_net_shape_icon FOREIGN KEY (icon_id) REFERENCES network_icon_library_icons (id) ON DELETE SET NULL"],
...
['network_icon_library_icons', 'fk_net_icon_lib', "ALTER TABLE network_icon_library_icons ADD CONSTRAINT fk_net_icon_lib FOREIGN KEY (library_id) REFERENCES network_icon_libraries (id) ON DELETE CASCADE"],All three tables are install-wide: there is no tenant_id. An imported set or a picture in My images is visible to every analyst with Network Mapper access, whatever their company.
api/network-mapper/icon_libraries.php is one adapter for every action. Its header is the map:
* GET ?action=catalogue[&refresh=1] every set on the site (cached a day)
* GET ?action=preview&slug=X one set: licence, author, every icon (remote addresses)
* GET ?action=libraries the sets imported into this install
* GET ?action=palette every imported icon (no picture data) for the Shapes tab
* POST {action:'import_start', slug} -> {id, total}
* POST {action:'import_batch', id, offset} -> {next, total, imported, skipped, done}
* POST {action:'delete', id}
* POST multipart: action=upload, file=<picture> -> {icon} (My images: PNG / JPEG / GIF / WebP, 4 MB)
* POST {action:'delete_image', id} (one picture out of My images)
*
* Changes are POST only. Any analyst with Network Mapper access may import or remove a set -
* an imported set is shared by the whole install.How it reads its input and routes:
requireModuleAccessJson('network-mapper');
try {
$method = $_SERVER['REQUEST_METHOD'] ?? 'GET';
$isUpload = $method === 'POST' && isset($_FILES['file']);
$data = $isUpload ? $_POST : ($method === 'POST' ? (json_decode(file_get_contents('php://input'), true) ?: []) : $_GET);
$action = (string)($data['action'] ?? '');Three input shapes in one file: a multipart upload reads $_POST, every other POST reads a JSON body, a GET reads the query string. The two catalogue actions return before connectToDatabase() because they never touch the database.
if ($method !== 'POST') {
http_response_code(405);
echo json_encode(['success' => false, 'error' => 'Unknown action']);
exit;
}
@set_time_limit(180);
$ctx = ActorContext::fromSession($conn);Every read action has returned by this point, so anything that writes is reachable only by POST - that is the same guarantee csrfRequireWriteMethod() gives other endpoints, written out by hand. The 180-second limit is for import_batch, which downloads up to 80 icons in parallel with a 45-second cURL timeout each.
NetworkIconService::catalogue() reads the site's home page and turns it into [{slug, title, count, group}]:
public static function catalogue(bool $refresh = false): array
{
$cache = self::cachePath('catalogue.json');
if (!$refresh && is_file($cache) && filemtime($cache) > time() - self::CATALOGUE_TTL) {
$c = json_decode((string)file_get_contents($cache), true);
if (is_array($c) && $c) return $c;
}
$html = self::fetchSite(self::SITE . '/', 3 * 1024 * 1024);
$sets = [];
$seen = [];
$group = '';
// Walk the page in order: an <h3> names the vendor group of the links after it; the
// "Icon sets (N)" <h2> starts the community list.
$re = '~<h2[^>]*>(.*?)</h2>|<h3[^>]*>(.*?)</h3>|<a href="/sets/([A-Za-z0-9_.-]+)">([^<]*)</a>\s*<span class="n">(\d+)</span>~s';
preg_match_all($re, $html, $m, PREG_SET_ORDER);
foreach ($m as $hit) {
if (($hit[1] ?? '') !== '') { $group = ''; continue; }
if (($hit[2] ?? '') !== '') { $group = trim(html_entity_decode(strip_tags($hit[2]), ENT_QUOTES | ENT_HTML5, 'UTF-8')); continue; }
$slug = $hit[3] ?? '';
if ($slug === '' || isset($seen[$slug])) continue;
$seen[$slug] = true;
$sets[] = [
'slug' => $slug,
'title' => trim(html_entity_decode($hit[4], ENT_QUOTES | ENT_HTML5, 'UTF-8')),
'count' => (int)$hit[5],
'group' => $group,
];
}
if (!$sets) {
throw new ServiceError('upstream', 'upstream_format', 'icons.diagrams.net answered, but no icon sets could be read from the page.');
}
@file_put_contents($cache, json_encode($sets));
return $sets;
}There is no catalogue API on that site, so the page is read with one regular expression that matches three things in document order: an <h2> (resets the group - the community list starts), an <h3> (a vendor heading such as "carbon" or "fortinet"), and a set link with its icon count. A walk in order is the only way to know which vendor a link belongs to. The slug part of the pattern is [A-Za-z0-9_.-]+, so nothing else can be captured as a slug. An empty result is an error, not an empty list, so a change to the site's markup shows as a clear message instead of "no sets". The result is cached for a day (CATALOGUE_TTL = 86400); ?refresh=1 skips the cache.
The cache lives in the system temp folder, one folder per install:
private static function cachePath(string $name): string
{
$dir = rtrim(sys_get_temp_dir(), '/\\') . DIRECTORY_SEPARATOR . 'freeitsm-icon-cache-' . substr(md5(__DIR__), 0, 10);
if (!is_dir($dir)) @mkdir($dir, 0700, true);
return $dir . DIRECTORY_SEPARATOR . preg_replace('~[^A-Za-z0-9_.-]~', '_', $name);
}md5(__DIR__) keeps two installs on one server apart; the folder is 0700; the file name is reduced to safe characters even though every caller already passes a checked slug.
library($slug) fetches https://icons.diagrams.net/libs/<slug>/1/library.xml (cached an hour, LIBRARY_TTL) and reads two things from it. First the comment at the top, which carries the credits:
// <!-- Title | License: X | Author: Name (url) | Source: Y | Generated from ... -->
if (preg_match('~<!--(.*?)-->~s', $xml, $c)) {
foreach (array_map('trim', explode('|', $c[1])) as $i => $part) {
if ($i === 0) { $out['title'] = $part; continue; }
if (stripos($part, 'License:') === 0) $out['licence'] = trim(substr($part, 8));
elseif (stripos($part, 'Author:') === 0) {
$a = trim(substr($part, 7));
if (preg_match('~^(.*?)\s*\((https?://[^)\s]+)\)\s*$~', $a, $am)) { $a = $am[1]; $out['author_url'] = $am[2]; }
$out['author'] = $a;
} elseif (stripos($part, 'Source:') === 0) $out['source'] = trim(substr($part, 7));
}
}author_url is only ever taken from an (http://...) or (https://...) group, so the browser's author link can never be a javascript: URL. Then the <mxlibrary> element, whose text is a JSON array of draw.io library entries:
if (preg_match('~<mxlibrary(?:\s+title="([^"]*)")?\s*>(.*)</mxlibrary>~s', $xml, $lm)) {
if (($lm[1] ?? '') !== '') $out['title'] = html_entity_decode($lm[1], ENT_QUOTES | ENT_XML1, 'UTF-8');
$entries = json_decode(html_entity_decode($lm[2], ENT_QUOTES | ENT_XML1, 'UTF-8'), true);
if (!is_array($entries)) {
throw new ServiceError('upstream', 'upstream_format', 'The library file for this set could not be read.');
}
foreach ($entries as $e) {
if (!is_array($e)) continue;
$src = self::entryImage($e);
if ($src === null) continue;
$out['icons'][] = [
'title' => mb_substr(trim((string)($e['title'] ?? '')), 0, 255),
'tags' => mb_substr(trim((string)($e['tags'] ?? '')), 0, 1000),
'w' => max(8, min(1024, (int)($e['w'] ?? 64) ?: 64)),
'h' => max(8, min(1024, (int)($e['h'] ?? 64) ?: 64)),
'src' => $src,
];
}
}Titles and tags are cut to their column lengths here, and sizes are clamped to 8-1024 px, so a library file cannot ask for a 100,000 px shape. Each entry's picture is found by entryImage():
private static function entryImage(array $e): ?string
{
$candidates = [];
if (isset($e['data']) && is_string($e['data'])) $candidates[] = $e['data'];
if (isset($e['xml']) && is_string($e['xml'])) {
$x = html_entity_decode($e['xml'], ENT_QUOTES | ENT_XML1, 'UTF-8');
if (preg_match('~image=(data:image/[a-z+.-]+,[A-Za-z0-9+/=%]+|https?://[^;"\s]+)~', $x, $im)) $candidates[] = $im[1];
}
foreach ($candidates as $c) {
if (strpos($c, 'data:image/') === 0) return $c;
if (self::isSiteUrl($c)) return $c;
}
return null;
}A draw.io entry either carries the picture directly in data, or carries a cell style in xml with image=... inside it. Only two kinds of answer survive: a data:image/... URI, or an https URL on icons.diagrams.net. An entry that points anywhere else is dropped here, before anything is downloaded - that is the first half of the outbound-request rule in section 6.1.
The markup is #iconLibModal in network-mapper/diagram.php: a search box (#libSearch, calling NM.onLibSearchInput), a three-way segment #libFilter (All / Vendors / Imported, calling NM.setLibFilter), the list #libList and the preview pane #libMain. A click on the overlay itself closes it, and Escape closes every modal through the editor's existing handler.
openLibraryBrowser() fetches the catalogue once per page load (libCatalogue) and draws the list:
function renderLibraryList() {
const box = document.getElementById('libList');
if (!box) return;
document.querySelectorAll('#libFilter button').forEach(b => b.classList.toggle('active', b.dataset.value === libFilter));
let sets = (libCatalogue || []).slice();
// Imported sets that the catalogue does not list (offline, renamed) still appear.
iconLibs.forEach(l => { if (l.slug !== MY_IMAGES && !sets.some(s => s.slug === l.slug)) sets.push({ slug: l.slug, title: l.title, count: l.icon_count, group: '' }); });
const q = libSearch.trim().toLowerCase();
if (q) sets = sets.filter(s => s.title.toLowerCase().indexOf(q) >= 0 || s.slug.toLowerCase().indexOf(q) >= 0 || (s.group || '').toLowerCase().indexOf(q) >= 0);
if (libFilter === 'vendor') sets = sets.filter(s => s.group);
if (libFilter === 'imported') sets = sets.filter(s => isImported(s.slug));"Vendors" simply means "has a group heading"; "Imported" means "a ready library with this slug exists here". Imported sets are merged in even when the catalogue is missing them (site down, set renamed), so a set can always be found to remove it. My images is left out of this list: it is not a set from the site.
Choosing a set calls selectLibrary(slug), which fetches ?action=preview once per slug (libPreviews) and then renderLibraryPreview() draws the header and up to 240 icons (LIMIT, with a Show all button):
const author = lib.author ? (lib.author_url ? '<a href="' + escapeAttr(lib.author_url) + '" target="_blank" rel="noopener noreferrer">' + escapeHtml(lib.author) + '</a>' : escapeHtml(lib.author)) : unknown;
...
+ '<span><strong>' + escapeHtml(t('network-mapper.iconlib.licence')) + ':</strong> ' + (lib.licence ? escapeHtml(lib.licence) : unknown) + '</span>'
+ '<span><strong>' + escapeHtml(t('network-mapper.iconlib.author')) + ':</strong> ' + author + '</span>'
+ (lib.source ? '<span><strong>' + escapeHtml(t('network-mapper.iconlib.source')) + ':</strong> ' + escapeHtml(lib.source) + '</span>' : '')
...
+ '<div class="nm-lib-grid">' + shown.map(i =>
'<div class="nm-lib-icon" title="' + escapeAttr(i.title + (i.tags ? ' - ' + i.tags : '')) + '"><img src="' + escapeAttr(i.src) + '" alt="" loading="lazy" referrerpolicy="no-referrer"><span>' + escapeHtml(i.title) + '</span></div>').join('') + '</div>'Every value from the remote file goes through escapeHtml() / escapeAttr(). The preview is the one place the browser talks to icons.diagrams.net directly: the <img src> is the remote address (or a data: URI) from entryImage(), with referrerpolicy="no-referrer" so the install's address is not sent. A picture inside an <img> never runs script, SVG included, so previewing an uncleaned SVG is safe. Nothing is stored until Import. The licence is shown when "not stated" too (iconlib.not_stated), and the modal footer (iconlib.licence_note) reminds the analyst that each set keeps its own licence.
The action area is one of three states: a progress bar while this set imports, Imported plus Remove (and "used by N shapes") when a ready row exists, or an Import button with the icon count.
The browser drives the import; the server does the downloading. importLibrary():
async function importLibrary(slug) {
if (libImporting) return;
const lib = libPreviews[slug];
libImporting = { slug, done: 0, total: lib ? lib.icons.length : 0 };
renderLibraryPreview();
let skipped = 0;
try {
const start = await libPost({ action: 'import_start', slug });
libImporting.total = start.total;
let offset = 0;
for (;;) {
const b = await libPost({ action: 'import_batch', id: start.id, offset });
skipped += b.skipped || 0;
offset = b.next;
libImporting.done = offset;
if (libSelected === slug) renderLibraryPreview();
if (b.done) break;
}
libImporting = null;
await loadIconPalette();
const added = iconLibs.find(l => l.slug === slug);
if (added) iconLibOpen[added.id] = true;
setPaletteTab('shapes');One import at a time per page (libImporting). Each round trip moves offset on and redraws the bar from done / total. Splitting the work into requests keeps each one well inside PHP's time limit and gives the analyst a moving bar instead of a frozen modal. When the last batch says done, the palette reloads, the new set is expanded and the Shapes tab is shown; the toast reports how many icons came in and how many were skipped.
importStart() makes the library row:
public static function importStart(PDO $conn, ActorContext $ctx, string $slug): array
{
$lib = self::library($slug);
if (!$lib['icons']) {
throw new ServiceError('validation', 'invalid_field', 'This set has no icons that can be imported.');
}
$chk = $conn->prepare("SELECT id, status FROM network_icon_libraries WHERE slug = ?");
$chk->execute([$lib['slug']]);
if ($row = $chk->fetch(PDO::FETCH_ASSOC)) {
if ($row['status'] === 'ready') {
throw new ServiceError('conflict', 'conflict', 'This set is already imported.');
}
// An import that was interrupted carries on where it stopped.
return ['id' => (int)$row['id'], 'total' => count($lib['icons'])];
}
$conn->prepare(
"INSERT INTO network_icon_libraries (slug, title, licence, author, author_url, source, icon_total, icon_count, status, created_datetime)
VALUES (?, ?, ?, ?, ?, ?, ?, 0, 'importing', UTC_TIMESTAMP())"
)->execute([
$lib['slug'], mb_substr($lib['title'], 0, 255), mb_substr($lib['licence'], 0, 255),
mb_substr($lib['author'], 0, 255), mb_substr($lib['author_url'], 0, 500), mb_substr($lib['source'], 0, 500),
count($lib['icons']),
]);
return ['id' => (int)$conn->lastInsertId(), 'total' => count($lib['icons'])];
}An importing row left by a closed tab is reused rather than refused. Because the palette and the browser only treat ready rows as imported, that set still shows an Import button, and pressing it again picks up the same row. (The browser starts again from offset 0; INSERT IGNORE on the (library_id, sort) key makes the icons already stored a no-op, so "carries on" in practice means "re-downloads and ignores duplicates".)
importBatch() does the work:
public static function importBatch(PDO $conn, int $libraryId, int $offset, int $limit = 80): array
{
$row = self::loadLibraryRow($conn, $libraryId);
$lib = self::library($row['slug']);
$total = count($lib['icons']);
$limit = max(1, min(200, $limit));
$slice = array_slice($lib['icons'], max(0, $offset), $limit, true);
// data: URIs decode in place; https URLs download together through curl_multi.
$bodies = [];
$mh = curl_multi_init();
$handles = [];
foreach ($slice as $i => $icon) {
if (strpos($icon['src'], 'data:') === 0) {
$bodies[$i] = self::decodeDataUri($icon['src']);
continue;
}
$ch = self::curlFor($icon['src'], self::MAX_ICON_BYTES);
$handles[$i] = $ch;
curl_multi_add_handle($mh, $ch);
}
if ($handles) {
do {
$status = curl_multi_exec($mh, $running);
if ($running) curl_multi_select($mh, 1.0);
} while ($running && $status === CURLM_OK);
foreach ($handles as $i => $ch) {
$body = curl_multi_getcontent($ch);
$code = (int)curl_getinfo($ch, CURLINFO_HTTP_CODE);
$bodies[$i] = ($code === 200 && is_string($body) && strlen($body) <= self::MAX_ICON_BYTES) ? $body : null;
curl_multi_remove_handle($mh, $ch);
}
}
curl_multi_close($mh);The library file is read again on every batch (from the one-hour cache), so the browser only ever sends an id and an offset - never an icon address. The client cannot make the server fetch anything that is not in the set's own library file. array_slice(..., true) keeps the original keys, and that key becomes sort. Downloads run in parallel through curl_multi, each handle built by curlFor() (section 6.1), each body kept only if it is a 200 of at most 512 KB.
$ins = $conn->prepare(
"INSERT IGNORE INTO network_icon_library_icons (library_id, sort, title, tags, mime, data, w, h) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
);
$imported = 0; $skipped = 0;
foreach ($slice as $i => $icon) {
$safe = self::safeImage($bodies[$i] ?? null);
if ($safe === null) { $skipped++; continue; }
$ins->bindValue(1, $libraryId, PDO::PARAM_INT);
$ins->bindValue(2, (int)$i, PDO::PARAM_INT);
$ins->bindValue(3, $icon['title']);
$ins->bindValue(4, $icon['tags']);
$ins->bindValue(5, $safe['mime']);
$ins->bindValue(6, $safe['data'], PDO::PARAM_LOB);
$ins->bindValue(7, $icon['w'], PDO::PARAM_INT);
$ins->bindValue(8, $icon['h'], PDO::PARAM_INT);
$ins->execute();
$imported++;
}
$next = min($total, max(0, $offset) + $limit);
$done = $next >= $total;
$cnt = $conn->prepare("SELECT COUNT(*) FROM network_icon_library_icons WHERE library_id = ?");
$cnt->execute([$libraryId]);
$conn->prepare("UPDATE network_icon_libraries SET icon_count = ?, status = ? WHERE id = ?")
->execute([(int)$cnt->fetchColumn(), $done ? 'ready' : 'importing', $libraryId]);
return ['next' => $next, 'total' => $total, 'imported' => $imported, 'skipped' => $skipped, 'done' => $done];
}What is stored is $safe['data'], the output of the gate - for an SVG that is the cleaned document, never the downloaded bytes. A failed download or a refused picture is counted as skipped, not fatal: one broken icon must not stop a set of 500. icon_count is recounted from the table rather than incremented, so it stays right after a retried batch.
data: URIs are decoded, not fetched:
private static function decodeDataUri(string $uri): ?string
{
if (!preg_match('~^data:image/[a-z+.-]+(;base64)?,(.*)$~is', $uri, $m)) return null;
$payload = $m[2];
// draw.io writes data:image/svg+xml,<base64> without ";base64" - try base64 first.
$b = base64_decode(strtr($payload, ' ', '+'), true);
if ($b !== false && $b !== '') return $b;
return rawurldecode($payload);
}The declared image/... type is ignored after this point: the decoded bytes go through the same safeImage() gate as a download.
public static function libraries(PDO $conn): array
{
$rows = $conn->query(
"SELECT l.id, l.slug, l.title, l.licence, l.author, l.author_url, l.source, l.icon_total, l.icon_count, l.status, l.created_datetime,
(SELECT COUNT(*) FROM network_diagram_shapes s JOIN network_icon_library_icons i ON i.id = s.icon_id WHERE i.library_id = l.id) AS used
FROM network_icon_libraries l
ORDER BY l.title"
)->fetchAll(PDO::FETCH_ASSOC);used counts shapes across every diagram and every version, and is what the browser shows beside Remove so nobody removes a set without knowing what it touches.
public static function paletteIcons(PDO $conn, int $analystId = 0): array
{
$rows = $conn->query(
"SELECT i.id, i.library_id, i.title, i.tags, i.w, i.h, i.uploaded_by_analyst_id
FROM network_icon_library_icons i
JOIN network_icon_libraries l ON l.id = i.library_id AND l.status = 'ready'
ORDER BY i.library_id, i.sort"
)->fetchAll(PDO::FETCH_ASSOC);
$admin = $analystId > 0 && analystIsAdmin($conn, $analystId);
foreach ($rows as &$r) {
foreach (['id', 'library_id', 'w', 'h'] as $k) $r[$k] = (int)$r[$k];
// whether this analyst may remove it (My images only - the palette shows the cross)
$r['can_delete'] = $admin || ($analystId > 0 && (int)$r['uploaded_by_analyst_id'] === $analystId);
unset($r['uploaded_by_analyst_id']);
}can_delete replaces the uploader's id in the answer, so the browser learns only whether this analyst may remove the picture, not who added it. The palette list deliberately leaves out data: the editor loads a few hundred bytes per icon once, and each picture arrives separately through api/network-mapper/icon.php (lazily, as tiles scroll into view).
public static function deleteLibrary(PDO $conn, int $libraryId): void
{
$lib = self::loadLibraryRow($conn, $libraryId);
// My images is not an imported set: its pictures are removed one at a time, each by its uploader.
if ($lib['slug'] === self::MY_IMAGES) {
throw new ServiceError('validation', 'invalid_field', 'My images cannot be removed as a whole.');
}
$conn->beginTransaction();
try {
$conn->prepare("UPDATE network_diagram_shapes s JOIN network_icon_library_icons i ON i.id = s.icon_id SET s.icon_id = NULL WHERE i.library_id = ?")
->execute([$libraryId]);
$conn->prepare("DELETE FROM network_icon_library_icons WHERE library_id = ?")->execute([$libraryId]);
$conn->prepare("DELETE FROM network_icon_libraries WHERE id = ?")->execute([$libraryId]);
$conn->commit();
} catch (Exception $e) {
if ($conn->inTransaction()) $conn->rollBack();
throw $e;
}
}The same thing the foreign keys would do, spelled out and in one transaction. Note delete takes any library id, including My images - removing that row from the browser is not possible (My images is not listed there) but the API would accept it.
api/network-mapper/icon.php, whole:
session_start(['read_and_close' => true]);
require_once '../../config.php';
require_once '../../includes/functions.php';
require_once '../../includes/services/network_icons.php';
if (!isset($_SESSION['analyst_id'])) {
http_response_code(401);
exit;
}
requireModuleAccessJson('network-mapper');
$id = (int)($_GET['id'] ?? 0);
$icon = $id > 0 ? NetworkIconService::iconData(connectToDatabase(), $id) : null;
$allowed = ['image/png', 'image/jpeg', 'image/gif', 'image/webp', 'image/svg+xml'];
if (!$icon || !in_array($icon['mime'], $allowed, true)) {
http_response_code(404);
exit;
}
header('Content-Type: ' . $icon['mime']);
header('Content-Length: ' . strlen($icon['data']));
header('Content-Disposition: inline');
header('X-Content-Type-Options: nosniff');
header('Cache-Control: private, max-age=86400');
header("Content-Security-Policy: default-src 'none'; img-src data:; style-src 'unsafe-inline'; sandbox");
echo $icon['data'];Header by header:
-
Session and module access - a picture is only for analysts with Network Mapper access.
read_and_closereleases the session lock at once, so fifty lazy-loading tiles do not queue behind each other. -
The
mimeallow-list - even though only the gate writes this column, the endpoint re-checks it. A row with any other type (written by hand, or by a future bug) is a 404, never served astext/html. -
Content-Typefrom the row - the type the gate decided from the bytes, not anything a client said. -
X-Content-Type-Options: nosniff- the browser must not second-guess the type (for example treat a PNG/HTML polyglot as HTML). -
Content-Security-Policy ... sandbox- if someone opensicon.php?id=Ndirectly in a tab and the picture is an SVG, the document is sandboxed (a unique origin, no script) and may load nothing exceptdata:images and inline styles. This is the second wall behindcleanSvg(). -
Cache-Control: private, max-age=86400- an icon never changes once stored (a re-import is a new id), so the browser may keep it a day;privatekeeps shared proxies out because the response depends on a login.
Because these headers are sent by PHP's header(), they do not depend on mod_headers or a web.config - unlike the folder-level CSP that includes/uploads.php writes for web-served upload folders, which a stock WAMP silently ignores.
loadIconPalette() runs once in init() (loadIconPalette(); // GH #433: imported icon libraries) and fills three lookups:
async function loadIconPalette() {
try {
const r = await fetch(ICON_API + '?action=palette', { credentials: 'same-origin' });
const d = await r.json();
if (!d.success) throw new Error(d.error || 'load failed');
iconLibs = (d.libraries || []).filter(l => l.status === 'ready');
iconsById = {};
iconsByLib = {};
(d.icons || []).forEach(i => {
iconsById[i.id] = i;
(iconsByLib[i.library_id] = iconsByLib[i.library_id] || []).push(i);
});
} catch (e) {
iconLibs = [];
}
if (paletteTab === 'shapes') renderShapePalette();
if (elCanvasInner && shapes.some(s => s.icon_id)) renderShapes();
}A failure leaves an empty section, never a broken editor. renderShapePalette() appends iconPaletteHtml(q) after the drawn shapes and then calls bindIconPalette(body). Each set is a collapsible group (iconLibOpen), the shape search box also filters icons by title and tags (a search opens every group with a hit), and at most 300 tiles are drawn per group:
html += '<div class="nm-shape-grid">' + hits.slice(0, 300).map(i =>
'<div class="nm-shape-tile nm-icon-tile" draggable="true" data-icon="' + i.id + '" title="' + escapeAttr((i.title || '') + ' - ' + t('network-mapper.shapes.tile_title')) + '">'
+ '<img src="' + iconUrl(i.id) + '" alt="" loading="lazy" draggable="false">'
+ (mine && canEdit() && i.can_delete ? '<button type="button" class="nm-icon-del" data-del="' + i.id + '" title="' + escapeAttr(t('network-mapper.iconlib.delete_image')) + '">×</button>' : '')
+ '</div>').join('') + '</div>';Placing works exactly like any other shape: a drag puts {kind: 'nm-shape', shape_type: 'icon', icon_id} on dataTransfer and onCanvasDrop() calls addShapeAt('icon', x, y, { icon_id }); a click calls addShapeInView(), which centres it in the visible canvas. The icon-specific part of addShapeAt():
if (type === 'icon') {
// An imported icon, at most 64px on its longer side, keeping its proportions.
const ic = iconsById[(extra || {}).icon_id];
if (!ic) return;
iconId = ic.id;
const maxSide = (extra && extra.maxSide) || 64; // a picture of your own may be bigger than an icon
const k = Math.min(1, maxSide / Math.max(ic.w || 64, ic.h || 64));
w = Math.max(16, Math.round((ic.w || 64) * k));
h = Math.max(16, Math.round((ic.h || 64) * k));
}Scale down only (Math.min(1, ...)), keep the aspect ratio, never under 16 px. The icon shape type itself is defined in assets/js/network-mapper-shapes.js:
// An icon from an imported library (GH #433): no drawn outline by default, the picture is an
// <img> the editor adds, and the label sits underneath like draw.io's.
add('icon', { cat: 'library', w: 64, h: 64, rounded: true, style: { fill: 'none', stroke: 'none', valign: 'top', fontSize: 12 }, draw: (w, h, r) => ({ d: rrect(0, 0, w, h, r) }), text: (w, h) => box(-40, h + 2, w + 80, 44) });Its category library is not in NM_SHAPE_CATS, so it never shows among the drawn shapes - it only arrives through an icon tile. When a shape is rendered:
if (s.shape_type === 'icon') {
// GH #433: an <img>, not an SVG <image> - html2canvas draws an <img> on export, but an
// SVG rasterised from markup may not load anything outside itself.
if (s.icon_id) html += '<img class="nm-shape-img" src="' + iconUrl(s.icon_id) + '" alt="" draggable="false">';
else el.classList.add('is-missing');
} .nm-shape-img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.nm-shape.is-missing { outline: 1px dashed #94a3b8; }object-fit: contain keeps the picture's proportions whatever the shape is resized to. An icon shape whose icon_id is NULL (library or picture removed) shows as a dashed box, still holding its label, connectors and place. How shapes are saved, versioned and moved is in Network Mapper - Shapes and Layers - Developer Guide; how the <img> reaches a PNG or PDF is in Network Mapper - Knowledge and Export - Developer Guide.
The server half of "a shape keeps only an icon that exists" is in NetworkMapperService::replaceContents():
// icon_id must name an icon that exists - anything else saves as no icon.
$iconIds = array_values(array_unique(array_filter(array_map(fn($s) => is_array($s) ? (int)($s['icon_id'] ?? 0) : 0, $shapesIn))));
$knownIcons = [];
if ($iconIds) {
try {
$ph = implode(',', array_fill(0, count($iconIds), '?'));
$q = $conn->prepare("SELECT id FROM network_icon_library_icons WHERE id IN ($ph)");
$q->execute($iconIds);
$knownIcons = array_flip(array_map('intval', $q->fetchAll(PDO::FETCH_COLUMN)));
} catch (PDOException $e) {
$knownIcons = [];
}
}and later, per shape, isset($knownIcons[(int)($s['icon_id'] ?? 0)]) ? (int)$s['icon_id'] : null. Unlike the strict node rules on the overview page, an unknown icon id is not an error: a second tab that still holds a just-deleted picture can save without failing, and the shape simply loses the picture. createVersion() copies icon_id with the rest of the shape row.
The upload branch of the endpoint:
if ($isUpload && $action === 'upload') {
// GH #433: an uploaded or pasted picture, into My images. Read from PHP's own temp file
// and stored in the database - nothing is written to a served folder.
$f = $_FILES['file'];
$err = $f['error'] ?? UPLOAD_ERR_NO_FILE;
if ($err === UPLOAD_ERR_INI_SIZE || $err === UPLOAD_ERR_FORM_SIZE) {
// PHP's upload_max_filesize (2 MB on a stock install) can be lower than the 4 MB allowed here
throw new ServiceError('validation', 'too_big', 'That picture is larger than this server accepts.');
}
if ($err !== UPLOAD_ERR_OK || !is_uploaded_file($f['tmp_name'])) {
throw new ServiceError('validation', 'not_image', 'The picture did not arrive.');
}
$bytes = (string)file_get_contents($f['tmp_name']);
echo json_encode(['success' => true, 'icon' => NetworkIconService::addUpload($conn, $ctx, $bytes, (string)($f['name'] ?? 'picture'))]);is_uploaded_file() proves the temp path came from PHP's own upload handling. No move_uploaded_file(): the bytes are read and the temp file is left for PHP to delete. The client's file name and declared type are never trusted - the name only becomes a title, the type is decided from the bytes.
public static function addUpload(PDO $conn, ActorContext $ctx, string $data, string $name): array
{
if ($data === '' || strlen($data) > self::MAX_UPLOAD_BYTES) {
throw new ServiceError('validation', 'too_big', 'That picture is over 4 MB.');
}
// TRAP: pass the upload limit - safeImage() defaults to the 512 KB library-icon cap, which
// turned away every picture between 512 KB and the 4 MB promised here as "not a picture".
$safe = self::safeImage($data, self::MAX_UPLOAD_BYTES);
$size = @getimagesizefromstring($data);
if (!$safe || $safe['mime'] === 'image/svg+xml' || !$size || $size[0] < 1 || $size[1] < 1) {
throw new ServiceError('validation', 'not_image', 'Only PNG, JPEG, GIF or WebP pictures can be added.');
}Three checks in a row:
-
Size -
MAX_UPLOAD_BYTES = 4 * 1024 * 1024. (See the Traps section: the next check has a lower limit of its own.) -
Magic bytes -
safeImage()must recognise the first bytes as PNG, JPEG, GIF or WebP. It would also accept a cleaned SVG, soimage/svg+xmlis refused explicitly here: an uploaded SVG is never stored, cleaned or not. This matchesUPLOAD_TYPES_IMAGEinincludes/uploads.php, which leaves SVG out for the same reason. -
A real picture -
getimagesizefromstring()must parse it and give a size of at least 1 Γ 1. A file that only starts with a PNG signature (the test uses eight signature bytes and twenty zero bytes) is refused; the size it returns also becomes the icon'sw/h.
$lib = $conn->prepare("SELECT id FROM network_icon_libraries WHERE slug = ?");
$lib->execute([self::MY_IMAGES]);
$libId = (int)$lib->fetchColumn();
if (!$libId) {
$conn->prepare("INSERT INTO network_icon_libraries (slug, title, licence, author, source, icon_total, icon_count, status, created_datetime)
VALUES (?, 'My images', NULL, NULL, 'Uploaded in FreeITSM', 0, 0, 'ready', UTC_TIMESTAMP())")->execute([self::MY_IMAGES]);
$libId = (int)$conn->lastInsertId();
}
$title = trim(preg_replace('/[^\p{L}\p{N} _.-]+/u', ' ', pathinfo($name, PATHINFO_FILENAME)));
$title = mb_substr($title !== '' ? $title : 'Picture', 0, 255);
$sort = (int)$conn->query("SELECT COALESCE(MAX(sort), -1) + 1 FROM network_icon_library_icons WHERE library_id = " . $libId)->fetchColumn();
$ins = $conn->prepare("INSERT INTO network_icon_library_icons (library_id, sort, title, tags, mime, data, w, h, uploaded_by_analyst_id) VALUES (?, ?, ?, '', ?, ?, ?, ?, ?)");The shared library is created ready on first use, so it appears in the palette at once. MY_IMAGES = 'my-images' contains a hyphen and real set slugs on icons.diagrams.net can too, so if the site ever published a set called my-images the unique slug would make importing it fail with "already imported" - harmless, and unlikely. The title keeps only letters, digits, spaces, _, . and - from the file name without its extension ("ZZ server rack.png" becomes "ZZ server rack"; a pasted screenshot arrives as "pasted.png" and becomes "pasted"). sort is the next free position; the $libId concatenated into that query is an (int) from the database, not input.
There is one My images library per install, shared by every analyst. uploaded_by_analyst_id (bound from $ctx->actorId, NULL for the system) records who added each picture, because removing one is theirs to do - or an admin's. The column is in includes/analyst_lifecycle.php as history: a leaver's pictures stay, and an admin can remove them.
public static function deleteUpload(PDO $conn, int $iconId, int $analystId): void
{
$st = $conn->prepare("SELECT i.library_id, i.uploaded_by_analyst_id FROM network_icon_library_icons i JOIN network_icon_libraries l ON l.id = i.library_id
WHERE i.id = ? AND l.slug = ?");
$st->execute([$iconId, self::MY_IMAGES]);
$row = $st->fetch(PDO::FETCH_ASSOC);
if (!$row) throw new ServiceError('not_found', 'not_found', 'Picture not found in My images.');
$libId = (int)$row['library_id'];
// My images is shared, so the picture is the uploader's to remove - or an admin's.
if ((int)$row['uploaded_by_analyst_id'] !== $analystId && !analystIsAdmin($conn, $analystId)) {
throw new ServiceError('forbidden', 'forbidden', 'Only the person who added this picture, or an administrator, can remove it.');
}
$conn->prepare("UPDATE network_diagram_shapes SET icon_id = NULL WHERE icon_id = ?")->execute([$iconId]);
$conn->prepare("DELETE FROM network_icon_library_icons WHERE id = ?")->execute([$iconId]);
$conn->prepare("UPDATE network_icon_libraries SET icon_count = GREATEST(icon_count - 1, 0) WHERE id = ?")->execute([$libId]);
}Two guards. Ownership: the endpoint passes the session's analyst, and only the uploader or an admin gets past the check - before 5.11.0 any analyst with Network Mapper access could remove anyone's picture. And the join on l.slug = 'my-images': delete_image can only remove a picture from My images, never one icon out of an imported set (sets are removed whole). Shapes that showed the picture are cleared first, in every diagram and every version, including read-only history - the same as the foreign key would do.
The Upload button is only drawn when canEdit() is true (the current version is open). It builds a file input on the fly:
const up = body.querySelector('#uploadImages');
if (up) up.addEventListener('click', () => {
const inp = document.createElement('input');
inp.type = 'file';
inp.accept = 'image/png,image/jpeg,image/gif,image/webp';
inp.multiple = true;
inp.addEventListener('change', () => uploadImages(Array.from(inp.files || [])));
inp.click();
});uploadImages() sends one request per picture:
async function uploadImages(files, at) {
const ok = files.filter(f => /^image\/(png|jpeg|gif|webp)$/.test(f.type));
if (!ok.length) {
if (files.length && window.showToast) showToast(t('network-mapper.iconlib.not_image'), 'error');
return;
}
let placed = 0;
for (let i = 0; i < ok.length; i++) {
const fd = new FormData();
fd.append('action', 'upload');
fd.append('file', ok[i], ok[i].name || 'pasted.png');
try {
const r = await fetch(ICON_API, { method: 'POST', credentials: 'same-origin', body: fd });
const d = await r.json();
if (!d.success) throw new Error(d.error || 'upload failed');
const ic = d.icon;
iconsById[ic.id] = ic;
(iconsByLib[ic.library_id] = iconsByLib[ic.library_id] || []).push(ic);
if (!iconLibs.some(l => l.id === ic.library_id)) iconLibs.push({ id: ic.library_id, slug: MY_IMAGES, title: 'My images', status: 'ready', icon_count: 1 });
iconLibOpen[ic.library_id] = true;
if (canEdit()) {
const p = at || viewCentre();
addShapeAt('icon', p.x + i * 30, p.y + i * 30, { icon_id: ic.id, maxSide: 240 });
placed++;
}
} catch (e) {
if (window.showToast) showToast(t('network-mapper.iconlib.error', { message: e.message }), 'error');
}
}The type filter here is a convenience (the browser's guess from the extension); the server decides. The answer {id, library_id, title, tags, w, h} is added straight into the lookups, so no palette reload is needed. Each picture is placed at the given point (or the middle of the view) with a 30 px step so several do not stack exactly, and with maxSide: 240 - a picture of your own may be larger than a 64 px icon, but never larger than 240 px on its longer side. Proportions are kept by addShapeAt() above. The request carries the CSRF token without any code here: assets/js/csrf.js wraps fetch() for every same-origin POST, FormData included.
Paste is a document-level paste listener added in bindCanvasEvents(), with the last mouse position tracked alongside it:
document.addEventListener('paste', onPaste); // GH #433: pictures from the clipboard
elCanvas.addEventListener('mousemove', e => { lastCanvasPoint = canvasModelCoords(e); });
elCanvas.addEventListener('mouseleave', () => { lastCanvasPoint = null; }); function onPaste(e) {
const a = document.activeElement;
if (a && (a.tagName === 'INPUT' || a.tagName === 'TEXTAREA' || a.tagName === 'SELECT' || a.isContentEditable)) return;
if (document.querySelector('.nm-modal-overlay.active')) return;
const files = Array.from((e.clipboardData && e.clipboardData.files) || []).filter(f => /^image\//.test(f.type));
if (files.length && canEdit()) {
e.preventDefault();
uploadImages(files, lastCanvasPoint);
return;
}
if (pasteClipboard()) e.preventDefault();
}Typing in a field or an open modal is left alone. A picture on the clipboard (a screenshot, an image copied from a browser) is uploaded and placed where the mouse is in model coordinates (canvasModelCoords() already divides by zoom), or in the middle of the view when the mouse is off the canvas. Anything else falls through to the editor's own copy / paste of diagram items. That is why the keyboard handler does nothing for Ctrl+V:
if (mod && (e.key === 'v' || e.key === 'V')) return; // handled by the paste event: it may be a pictureOnly the paste event can see the clipboard's files; a keydown handler cannot.
Deleting: the small Γ on a My images tile (shown on hover, only when canEdit()):
async function deleteMyImage(id) {
if (!confirm(t('network-mapper.iconlib.delete_image_confirm'))) return;
try {
await libPost({ action: 'delete_image', id: id });
shapes.forEach(s => { if (s.icon_id === id) s.icon_id = null; });
await loadIconPalette();
renderShapes();
} catch (e) {
if (window.showToast) showToast(t('network-mapper.iconlib.error', { message: e.message }), 'error');
}
}The confirmation text says what happens: "Diagrams that use it keep the shape, but the picture disappears." The open diagram mirrors the server by clearing icon_id in memory, so its shapes turn into dashed boxes at once. It does not mark the diagram dirty, because the database already holds the same change.
A node's icon is chosen in the browser, in buildNodeEl():
const iconKey = n.icon_override || n.class_icon || 'box';So the order is: the node's own override (picked in the editor, stored in network_diagram_nodes.icon_override), then the class's icon, then the built-in box. class_icon comes from api/network-mapper/get_diagram.php, which joins it on every load:
SELECT n.id, n.cmdb_object_id, ...,
o.name, o.is_planned,
c.id AS class_id, c.name AS class_name, i.icon_key AS class_icon
FROM network_diagram_nodes n
JOIN cmdb_objects o ON o.id = n.cmdb_object_id
JOIN cmdb_classes c ON c.id = o.class_id
LEFT JOIN cmdb_icons i ON i.id = c.icon_id
WHERE n.diagram_id = ?These are glyph keys from cmdb_icons drawn by nmRenderIcon() in assets/js/network-mapper-icons.js - not pictures from the icon libraries above. A node placed in this session gets class_icon: cls ? cls.icon_key : 'box' from the palette's class list (api/cmdb/get_classes.php, which returns icon_id, icon_key and icon_label).
The fallback already existed; what was missing was a way to set a class's icon, and a bug that kept wiping it. The bug, now fixed in CmdbSchemaService::saveClass():
// TRAP: icon_id is only changed when the caller SENDS it. Before GH #433 the settings
// form never sent it, so every edit of a class silently wiped the icon that starter
// classes and the demo data had given it. Absent = keep; null / '' = clear.
$iconGiven = array_key_exists('icon_id', $in);
$iconId = $iconGiven && $in['icon_id'] !== '' && $in['icon_id'] !== null ? (int)$in['icon_id'] : null; if (!$iconGiven) {
$cur = $conn->prepare("SELECT icon_id FROM cmdb_classes WHERE id = ?");
$cur->execute([$id]);
$v = $cur->fetchColumn();
$iconId = ($v === false || $v === null) ? null : (int)$v;
}The old line used isset(), which cannot tell "not sent" from "sent as null", and the settings form never sent the field, so every class edit wrote icon_id = NULL. array_key_exists() makes the three cases distinct: absent keeps, null or '' clears, a number sets. Any other caller (the REST API, a script) that leaves the field out now keeps the icon too.
The form now sends it. cmdb/settings/index.php loads the active glyphs into the page:
$cmdbClassIcons = [];
try {
$cmdbClassIcons = connectToDatabase()->query(
"SELECT id, icon_key, label FROM cmdb_icons WHERE is_active = 1 ORDER BY display_order, label"
)->fetchAll(PDO::FETCH_ASSOC);
} catch (Exception $e) {
// No icon table on this install - the picker shows nothing to pick and the page still works.
} <script>window.cmdbClassIcons = <?php echo json_encode($cmdbClassIcons, JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT); ?>;</script>
<script src="../../assets/js/network-mapper-icons.js?v=3"></script>The JSON_HEX_* flags make the labels safe inside a <script> block. The class modal has a hidden #classIconId, a preview, a Clear button and a grid; cmdb/settings/settings.js fills it:
function classIconRenderGrid() {
const grid = document.getElementById('classIconGrid');
if (!grid) return;
// nmRenderIcon returns our own SVG markup from a fixed library, never user input.
grid.innerHTML = (window.cmdbClassIcons || []).map(i =>
`<button type="button" class="ic-tile" data-icon-id="${Number(i.id)}" title="${escapeHtml(i.label)}" onclick="classIconPick(${Number(i.id)})">
${window.nmRenderIcon ? window.nmRenderIcon(i.icon_key, 22) : ''}
</button>`).join('');
classIconShowSelected();
}and saveClass() adds the field to the payload:
is_active: document.getElementById('classIsActive').checked,
icon_id: document.getElementById('classIconId').value || nullAn empty picker sends null (clear) on purpose: from this form the field is always present, so the "absent keeps" rule only protects other callers. The classes list also shows each class's icon (classIconHtml(c, 16)). Saving needs CMDB module access and Cap::CMDB_CLASSES (api/cmdb/save_class.php); the CMDB side is covered in CMDB - Developer Guide.
Two things enter the install here from outside: files from a third-party website, and files from an analyst's computer or clipboard. Each defence below is listed with what it stops.
/** True for an https URL on icons.diagrams.net - the only host this service talks to. */
private static function isSiteUrl(string $url): bool
{
$p = parse_url($url);
return is_array($p) && ($p['scheme'] ?? '') === 'https' && strtolower($p['host'] ?? '') === 'icons.diagrams.net'
&& !isset($p['user']) && !isset($p['pass']) && (!isset($p['port']) || (int)$p['port'] === 443);
}
/** A cURL handle for an icons.diagrams.net URL: https only, no redirects, a size cap. */
private static function curlFor(string $url, int $maxBytes)
{
if (!self::isSiteUrl($url)) {
throw new ServiceError('validation', 'invalid_field', 'Only icons.diagrams.net can be fetched.');
}
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false,
CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_TIMEOUT => 45,
CURLOPT_USERAGENT => 'FreeITSM Network Mapper',
CURLOPT_NOPROGRESS => false,
CURLOPT_PROGRESSFUNCTION => function ($ch, $dlTotal, $dlNow) use ($maxBytes) { return $dlNow > $maxBytes ? 1 : 0; },
]);
if (defined('CURLOPT_PROTOCOLS') && defined('CURLPROTO_HTTPS')) curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTPS);
if (function_exists('sslApplyCurl')) sslApplyCurl($ch);
return $ch;
}-
Server-side request forgery. Every request - the catalogue, every library file, every icon - goes through
curlFor(), andcurlFor()refuses anything that is nothttps://icons.diagrams.neton port 443 with no user or password part (thehttps://icons.diagrams.net@intranet/trick fails becauseparse_url()reportsintranetas the host). A library file that names an internal address cannot make the server fetch it:entryImage()drops such entries before an import even starts, andcurlFor()would refuse them anyway. -
Redirects are not followed (
CURLOPT_FOLLOWLOCATION => false), so the allowed host cannot bounce a request somewhere else; a 301 is just a non-200 and the icon is skipped.CURLOPT_PROTOCOLS = CURLPROTO_HTTPSstops a scheme change at the cURL level too. -
Size caps. The progress callback aborts a download as soon as it passes its cap: 3 MB for the catalogue page, 30 MB for a library file (
MAX_LIBRARY_BYTES), 512 KB for one icon (MAX_ICON_BYTES). Timeouts are 10 s to connect, 45 s overall. -
TLS follows the install's one global policy through
sslApplyCurl()inincludes/ssl.php(the shipped CA bundle viaCURLOPT_CAINFO, and theSSL_VERIFY_PEERswitch inconfig.php), so this service never sets its own, weaker certificate rules. -
Slugs pass
checkSlug()before they reach a URL or a cache file name:
private static function checkSlug(string $slug): string
{
$slug = trim($slug);
if (!preg_match('~^[A-Za-z0-9_.-]{1,120}$~', $slug) || strpos($slug, '..') !== false) {
throw new ServiceError('validation', 'invalid_field', 'That is not an icon set name.');
}
return $slug;
}and are rawurlencode()d into the path as well.
-
The client never names a URL.
import_batchtakes a library id and an offset; the icon addresses come from the server's own parse of the library file. -
robots.txt. The service header notes that the site disallows
/libs/for crawlers. This is not a crawler: a library is fetched only when a person opens it, exactly as draw.io itself does.
public static function safeImage(?string $body, int $maxBytes = self::MAX_ICON_BYTES): ?array
{
if ($body === null || $body === '' || strlen($body) > $maxBytes) return null;
$head = substr($body, 0, 16);
if (strncmp($head, "\x89PNG\r\n\x1a\n", 8) === 0) return ['mime' => 'image/png', 'data' => $body];
if (strncmp($head, "\xFF\xD8\xFF", 3) === 0) return ['mime' => 'image/jpeg', 'data' => $body];
if (strncmp($head, 'GIF8', 4) === 0) return ['mime' => 'image/gif', 'data' => $body];
if (strncmp($head, 'RIFF', 4) === 0 && substr($body, 8, 4) === 'WEBP') return ['mime' => 'image/webp', 'data' => $body];
$svg = self::cleanSvg($body);
return $svg === null ? null : ['mime' => 'image/svg+xml', 'data' => $svg];
}The stored type is decided by the file's own signature, never by an HTTP Content-Type, a data: URI's declared type, a file extension or a browser's File.type. Raster formats are stored byte for byte (they cannot carry script when served as an image with nosniff). Anything that is not one of those four signatures must parse as an SVG and survive cleaning, or it is refused. HTML pretending to be an icon fails both.
Raster pictures are not re-encoded, so metadata such as a JPEG's EXIF (camera, sometimes GPS) is kept in My images exactly as uploaded.
SVG is XML and can carry script in several ways. This is the whole function:
public static function cleanSvg(string $body): ?string
{
if (stripos($body, '<svg') === false) return null;
if (preg_match('~<!DOCTYPE|<!ENTITY~i', $body)) return null; // no entity tricks
$prev = libxml_use_internal_errors(true);
$doc = new DOMDocument();
$ok = $doc->loadXML($body, LIBXML_NONET | LIBXML_NOBLANKS);
libxml_clear_errors();
libxml_use_internal_errors($prev);
if (!$ok || !$doc->documentElement || strtolower($doc->documentElement->localName) !== 'svg') return null;
$xp = new DOMXPath($doc);
$bad = ['script', 'foreignobject', 'iframe', 'embed', 'object', 'audio', 'video', 'handler', 'listener', 'set', 'animate'];
foreach (iterator_to_array($xp->query('//*')) as $el) {
if (!$el->parentNode) continue; // already gone with a removed parent
if (in_array(strtolower($el->localName), $bad, true)) {
$el->parentNode->removeChild($el);
continue;
}
foreach (iterator_to_array($el->attributes) as $attr) {
$name = strtolower($attr->name);
$val = trim($attr->value);
if (strpos($name, 'on') === 0) { $el->removeAttribute($attr->nodeName); continue; }
if ($name === 'href' || $name === 'xlink:href' || substr($name, -5) === ':href') {
if ($val !== '' && $val[0] !== '#' && stripos($val, 'data:image/') !== 0) $el->removeAttribute($attr->nodeName);
continue;
}
if (preg_match('~javascript:|url\(\s*["\']?\s*(?!#)~i', $val)) $el->removeAttribute($attr->nodeName);
}
}
foreach (iterator_to_array($xp->query('//*[local-name()="style"]')) as $st) {
// A <style> element may pull outside resources through @import / url(): drop those.
$st->textContent = preg_replace('~@import[^;]*;|url\(\s*["\']?\s*(?!#)[^)]*\)~i', '', $st->textContent);
}
$out = $doc->saveXML($doc->documentElement);
return ($out !== false && strlen($out) <= self::MAX_ICON_BYTES) ? $out : null;
}Rule by rule:
| Rule | What it stops |
|---|---|
Must contain <svg
|
Cheap early refusal of anything that is plainly not an SVG |
Any <!DOCTYPE or <!ENTITY refuses the whole file |
XML external entities (SYSTEM "file:///etc/passwd"), entity-expansion bombs ("billion laughs"), and DTD-defined attributes. Real icons never need a DTD, so refusing is simpler and safer than trying to disarm one |
LIBXML_NONET |
libxml may never touch the network while parsing, whatever the document says |
| Errors swallowed, then restored | A malformed icon becomes "not an SVG" (null), not a PHP warning in the log; the previous libxml error mode is put back for the rest of the request |
Root element must be svg
|
An XHTML or other XML document with an <svg> somewhere inside it is refused |
Remove script
|
Script elements |
Remove foreignObject
|
Embedded HTML (and its scripts and forms) inside an SVG |
Remove iframe, embed, object
|
Embedded documents and plugins |
Remove audio, video
|
Media that loads from elsewhere |
Remove handler, listener
|
SVG Tiny / XML Events ways of attaching script without an on* attribute |
Remove set, animate
|
SMIL animation can change an attribute at run time - for example <set attributeName="href" to="javascript:..."> - which would undo the href rule below |
Remove every attribute starting on
|
Event handlers: onload, onclick, onbegin, and any future one. No real SVG presentation attribute starts with on
|
href / xlink:href / any *:href must be empty, a local #fragment, or a data:image/...
|
Links to javascript: URLs and loading anything from outside (<image href="https://..."> is a tracking pixel and a request from every viewer's browser). Local references such as <use href="#ok"> keep working |
Any other attribute containing javascript: or a url( that does not start with # is removed |
Script in other attributes, and outside resources through presentation attributes such as style="fill:url(https://...)". Local gradients and filters (fill="url(#g)") keep working |
In <style> elements, @import ...; and non-local url(...) are deleted |
Stylesheets pulling in outside CSS or images |
Output is saveXML($doc->documentElement)
|
Only the root element is written: anything outside it (an XML declaration, a processing instruction such as xml-stylesheet, comments before the root) is dropped |
| Output must still be at most 512 KB | Nothing grows past the stored cap |
The loop walks a snapshot (iterator_to_array) of every element, so removing a node does not upset the iteration, and a descendant of a removed element is skipped by the !$el->parentNode check. In PHP's DOM, $attr->name is the local name (href for xlink:href), so the first comparison already catches namespaced links; removeAttribute($attr->nodeName) removes it by its full name.
The service header says it in one line: "neither defence is trusted alone". An SVG is cleaned on import and served by api/network-mapper/icon.php with default-src 'none'; ... sandbox and nosniff. In the editor the picture is only ever used as an <img>, where browsers never run SVG script at all. Even if a future bypass of the cleaner let a script through, opening the icon's address directly gives a sandboxed document with no script and no network. The preview in the browser modal shows remote SVGs before any cleaning, but only inside <img>, which is why that is safe.
For My images the line is simpler still: SVG is never accepted, and raster pictures are checked twice (signature and getimagesizefromstring()). The install-wide rule against SVG uploads, and why it exists, is in Security Hardening 2026-08 Round Three - Developer Guide (the api/system/save_branding.php SVG finding).
Pictures live in a MEDIUMBLOB, never in a folder under the web root. There is no file for a misconfigured server to execute, list or serve with a guessed type, and no upload path to traverse. The cost is database size: a large set (a few hundred SVGs) is typically a few MB, a My images picture up to the upload limit.
| Action | Who may | Enforced by |
|---|---|---|
| Browse the catalogue, preview a set | Any analyst with Network Mapper access | requireModuleAccessJson('network-mapper') |
| Import a set, remove a set | Any analyst with Network Mapper access | the same - there is no admin check and no finer capability |
| Upload or paste a picture | Any analyst with Network Mapper access | requireModuleAccessJson('network-mapper') |
| Remove a picture from My images | The analyst who added it, or an admin |
deleteUpload() checks uploaded_by_analyst_id / analystIsAdmin(); the palette only draws the Γ when can_delete
|
| Remove My images as a whole | Nobody |
deleteLibrary() refuses the my-images slug (the UI never offered it; the API delete action could) |
| See a stored icon | Any analyst with Network Mapper access |
api/network-mapper/icon.php checks the session and module access |
| Set a CMDB class icon | CMDB access plus Cap::CMDB_CLASSES
|
api/cmdb/save_class.php |
This is a deliberate choice written in the endpoint header ("an imported set is shared by the whole install"), and matches the rest of the module, which has no capabilities beneath module access (see the overview page). The Upload button and the Γ on tiles are only drawn when the current version is open (canEdit()), but that is a UI rule; the server does not tie uploads to a diagram.
CSRF: neither endpoint calls a CSRF function itself. includes/functions.php loads includes/request_guard.php, which runs csrfEnforce() on every request: a POST from a signed-in session must carry the session's token and come from this origin. assets/js/csrf.js adds the X-CSRF-Token header to every same-origin fetch(), which covers both the JSON POSTs (libPost()) and the multipart upload. Every write in api/network-mapper/icon_libraries.php sits behind its own if ($method !== 'POST') exit, so a link on another site (a GET, which the Lax cookie does carry) can at most re-read the catalogue. See CSRF protection - Developer Guide.
- The server contacts icons.diagrams.net when someone opens the browser (the catalogue, once a day at most), previews a set (its library file, once an hour at most) and imports one. Opening or exporting a diagram never contacts it.
-
The analyst's browser contacts icons.diagrams.net while a preview is on screen, because preview tiles load straight from the site (
referrerpolicy="no-referrer"). An install that sets its own strictimg-srcpolicy at the web server would see empty preview tiles; import is unaffected. The app ships no page CSP of its own (see Content Security Policy hardening).
- π΄ TRAP (in code,
includes/services/cmdb_schema.php):icon_idon a class is only changed when the caller sends it. Absent keeps the icon,nullor''clears it. Usearray_key_exists(), neverisset(), for any "absent means keep" field -isset()treats a sentnullas absent. - π΄ Two size caps, one gate.
safeImage()is shared by downloaded library icons (512 KB,MAX_ICON_BYTES) and uploads (4 MB,MAX_UPLOAD_BYTES), so its cap is a parameter that defaults to the icon one. Until 5.11.0addUpload()did not pass it, and every picture between 512 KB and 4 MB was refused as "Only PNG, JPEG, GIF or WebP pictures can be added" - the wrong message for the wrong reason. Any new caller ofsafeImage()must decide which cap it means; the test now has a 1 MB positive control. β οΈ PHP's own upload limits come first. A picture larger thanupload_max_filesize(2 MB on a stock PHP) never reachesaddUpload():$_FILES['file']['error']isUPLOAD_ERR_INI_SIZE, and the endpoint answers "That picture is larger than this server accepts." To really allow 4 MB, raiseupload_max_filesizeandpost_max_sizein PHP. A pasted screenshot goes through the same multipart upload, so the same limit applies to Ctrl+V.β οΈ Removing a set or a picture changes history. TheUPDATE ... SET icon_id = NULL(and the foreign key) reach every diagram, read-only versions included. That is the point of keeping the shapes, but an old version will no longer look exactly as it did.β οΈ The catalogue is screen-scraped.catalogue()depends on the site's<h2>/<h3>/<a href="/sets/...">...<span class="n">markup. A redesign of icons.diagrams.net breaks the browser with "no icon sets could be read from the page" until the regex is updated; imported sets and diagrams are unaffected. The library file format (<mxlibrary>JSON) is draw.io's own and far more stable.β οΈ An interrupted import restarts from offset 0.importStart()reuses theimportingrow, but the browser always begins at 0, so the first batches re-download icons that are already stored andINSERT IGNOREdiscards them. The batch'simportedcount includes those ignored rows;icon_count(recounted) is the true figure.β οΈ status = 'importing'sets are invisible. They do not reach the palette (paletteIcons()joinsstatus = 'ready') and the browser treats them as not imported, which is what lets Import resume them. A set stuck atimportingis removed only through the APIdeleteaction or by importing it to the end.β οΈ An icon shape with an unknownicon_idsaves as no picture, silently. That is deliberate (a stale tab must not fail its save), but it means a typo in an API caller'sicon_idis not reported.
There are no TRAP: comments in includes/services/network_icons.php, api/network-mapper/icon_libraries.php or api/network-mapper/icon.php. For the house rule on these comments see Code Traps.
tests/network-mapper-icon-libraries.php needs a throwaway database and two CMDB objects; it never contacts icons.diagrams.net:
FREEITSM_TEST_DATABASE=<throwaway db> FREEITSM_TEST_URL=http://localhost/<that install> php tests/network-mapper-icon-libraries.php
It makes its own library with a zz-test- slug and its own diagrams, and removes them in finally. My images is removed afterwards only if the test created it and it is empty again.
The SVG cleaner
- a plain icon survives, local gradient reference kept
- script, foreignObject and every on* handler are gone
- javascript: and outside addresses are gone, a local #ref stays
- an entity / DOCTYPE trick is refused
- something that is not an SVG is refused
The hostile sample used for the second and third checks:
$evil = '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="alert(1)">'
. '<script>alert(2)</script><foreignObject><body xmlns="http://www.w3.org/1999/xhtml">x</body></foreignObject>'
. '<a xlink:href="javascript:alert(3)"><rect onclick="alert(4)" style="fill:url(https://evil.example/x)"/></a>'
. '<image href="https://evil.example/track.png"/><use href="#ok"/><style>@import url(https://evil.example/s.css); .a{fill:url(https://evil.example/y)}</style></svg>';Accepted image types
- PNG by its bytes
- an SVG comes back cleaned
- HTML pretending to be an icon is refused
- ...and nothing at all is refused
Libraries and shapes
- a retried batch cannot duplicate an icon (library_id + sort is unique)
- iconData returns the picture
- the palette lists the ready library's icons without their data
- an icon shape keeps a real icon; an unknown icon id saves as none
- a new version keeps the icon
- the library knows how many shapes use it
- removing the library keeps the shapes, with no picture
- ...and its icons are gone
- cleaned up
My images (uploads and pastes)
- a PNG goes into My images with its size and a readable title
- an SVG is refused, even a clean one
- HTML named .png is refused
- a PNG header with no real picture behind it is refused
- over 4 MB is refused
- POSITIVE CONTROL: a 1 MB picture goes in (not held to the 512 KB cap for library icons)
- a diagram can use the picture
- deleteUpload will not touch an icon from an imported set (runs only when an imported set exists)
- the palette offers the cross to the uploader and an admin, not to a colleague (needs two non-admin analysts)
- a colleague cannot remove someone else's picture
- ...the uploader can
- My images cannot be removed as a whole set
- removing the picture keeps the shape, with no picture
tests/cmdb-schema-service.php gained three checks for the class icon fix (they run when cmdb_icons has a row):
- an icon can be set on a class
- ...an edit that does not send icon_id keeps it
- ...and sending icon_id null clears it
Not covered by any test: the outbound fetch rules (isSiteUrl() / curlFor()), the headers of api/network-mapper/icon.php, the browser code. The full list of suites is on Developer Tests.
- Network Mapper Β· Network Mapper - Developer Guide Β· Network Mapper - Shapes and Layers - Developer Guide Β· Network Mapper - Knowledge and Export - Developer Guide
- CMDB - Developer Guide Β· CSRF protection - Developer Guide Β· Content Security Policy hardening Β· Security Hardening 2026-08 Round Three - Developer Guide
-
Feature Bingo - Developer Guide - the cards
network-mapper.icon_libraries(done when a set isready) andnetwork-mapper.my_images(done when My images has a picture)
FreeITSM β an open-source IT Service Management platform Β· github.com/edmozley/freeitsm Β· MIT licence
- Installation
- β° Scheduled tasks (cron jobs)
-
Architecture
- β³ π§Ή Root folder tidy (URL routing)
- β³ π Database Integrity (FKs & constraints)
- β³ π οΈ Database Verification β Developer Guide
- β³ π§© Service Layer (UI + API share code)
- β³ πͺ€ Code traps (the TRAP: comments)
- β³ π Commenting for the Engineering wiki
- β³ π οΈ Engineering wiki scanner - Developer Guide
- β³ π Service-Layer progress
- π€ Contributing (read before a pull request)
- π§ͺ Developer tests
- π PDF exports moved to PDFKit (#254)
- AI Providers
- Internationalisation (i18n)
- Timezones & Time Handling
- π Date & Time Formats
- π± Currencies
- π§ The sidebar (optional module rail)
- π§© Preference templates
- π Display order (modules, Watchtower cards) β Developer Guide
- Theming & Dark Mode
- ποΈ Recent β getting back to what you were doing
- β¨οΈ Command palette (βK)
- π Searching inside tickets
- π Attached documents
-
MobileβFriendly
- β³ π« Mobile: Tickets
- β³ π» Mobile: Assets
- β³ π Mobile: Calendar
- β³ π Mobile: Knowledge
- β³ π¦ Mobile: Service Status
- β³ πΌ Mobile: Watchtower
- β³ π§© Mobile: Problem Management
- β³ π Mobile: Change Management
- β³ πΏ Mobile: Software
- β³ β Mobile: Tasks
- β³ π Mobile: Forms
- β³ π Mobile: Contracts
- β³ π Mobile: Domains
- β³ π Mobile: People
- β³ π Mobile: Projects
- β³ ποΈ Mobile: Files
- β³ π Mobile: LMS
- β³ πΊοΈ Mobile: CMDB
- β³ πΊοΈ Mobile: Network Mapper
- β³ π§ Mobile: Process Mapper
- β³ βοΈ Mobile: Workflow
- β³ π₯οΈ Mobile: System
- β³ π Mobile: Reporting
- β³ π Mobile: System Wiki
- β³ π Mobile: Self-Service Portal
- β³ π§° Mobile: Techniques & Tricks
-
Security
- Layer 1 β which modules you can enter
- β³ π§© Module Access Control
- β³ π οΈ Module Access β Developer Guide
- β³ π Switching modules off
- β³ π οΈ Module availability β Developer Guide
- β³ π Module availability β design (#217)
- Layer 2 β what you can administer
- β³ π Roles & Permissions
- β³ π οΈ Roles β Developer Guide
- β³ π€ Why capabilities are constants
- Layer 3 β the System module
- β³ π Admin Access Control
- Hardening
- β³ π Security review response 2026-08
- β³ π‘οΈ Security hardening 2026-08
- β³ π οΈ Security hardening 2026-08 β Developer Guide
- β³ π‘οΈ Round three β plain English
- β³ π οΈ Round three β Developer Guide
- β³ π‘οΈ CSRF protection (S4) β Developer Guide
- Single Sign-On (SSO)
- ποΈ LDAP & Active Directory
-
π¦ Microsoft Entra ID
- β³ π₯ Importing people and groups
- β³ π» Intune: assets to their primary user
- β³ π’ Organisation chart
- β³ π οΈ Entra directory sync β Developer Guide
- β³ π οΈ Entra import - review (#235)
- β³ π οΈ Entra follow-ups - review (#237-#240)
- β³ π οΈ Intune primary user - review (#236)
- β³ π οΈ Intune after an Entra import - review (#334)
- β³ π οΈ Intune primary user history - review (#338)
- β³ π οΈ Intune asset types - review (#339)
- β³ π οΈ Intune scheduled syncs - review (#344)
- β³ π οΈ Microsoft 365 in Integrations - review (#352)
- β³ π οΈ Organisation chart - reviews (#242, #265)
- π CardDAV contact sync
- Browser Extension
- API Reference
-
π REST API β how it works
- β³ π Script library (PowerShell + Python)
- β³ π Proposal: custom fields, inventory import and change evidence (#194)
- β³ π οΈ Custom fields, evidence + inventory - review (#195-#197)
- β³ π οΈ Long forms in a task's Work view - review (#198)
- β³ π οΈ Empty Procedures fold - review (#247)
- β³ π« REST API: Tickets
- β³ π» REST API: Assets
- β³ π΄ REST API: Problems
- β³ π REST API: Changes
- β³ π REST API: Knowledge
- β³ β REST API: Tasks
- β³ ποΈ REST API: CMDB
- β³ π REST API: Contracts
- β³ ποΈ REST API: Calendar
- β³ πΏ REST API: Software
- β³ π REST API: Domains
- β³ π¦ REST API: Service Status
- β³ βοΈ REST API: Morning Checks
- β³ π REST API: Forms
- β³ βοΈ REST API: Workflow
- β³ π·οΈ REST API: Cost centres
- β³ π’ REST API: Companies
- β³ π REST API: Chart of accounts
- β³ π REST API: Projects
- β³ π‘οΈ API threat protection
- β³ π§βπΌ REST API: Analysts
- β³ πΊοΈ REST API: Network Mapper
- β³ π§ Using the API docs page
- β³ π OpenAPI specification
- β³ β OpenAPI: kept correct
- β³ π οΈ Maintaining the catalogue
- Watchtower
-
Tickets
- β³ Reply subject and replying to one message
- β³ π Live updates
- β³ π οΈ Watching a ticket - Developer Guide (1 of 2)
- β³ βοΈ Ticket address suggestions - Developer Guide
- β³ π οΈ CSAT delay and reminder - Developer Guide
- β³ π οΈ Ticket checklist step types - Developer Guide (1 of 2)
- β³ π οΈ Right-click Attach checklist - Developer Guide
- β³ π οΈ Checklists in the REST API - Developer Guide
- β³ π A ticket's related block and attachments - Developer Guide
- β³ π οΈ Inbox.js map β Developer Guide
- β³ π οΈ Floating windows & the file viewer β Developer Guide
- β³ π οΈ Tickets settings β Developer Guide
- β³ π Simpler ticket and task forms - design (#218)
- β³ ποΈ The ticket workspace
- β³ π Forms on tickets
- β³ π The ticket table
- β³ π Rota copy and paste β Developer Deep Dive
- β³ β Checklists & SOPs
- β³ βοΈ Mandatory fields
- β³ π§Ύ Custom ticket fields
- β³ π·οΈ Ticket categories
- β³ π§Ύ A type for every new ticket
- β³ π₯ Assigning tickets to a team, and escalation
- β³ π’ One board across every company
- β³ π Many companies: searchable lists (#358)
- β³ π Ticket dashboard β Developer Guide
- β³ Mailbox Authentication
- β³ π€ Email send log
- β³ βοΈ Emailed reports
- β³ π Attachment size limits and large emails
-
β³ Basic IMAP mailboxes
- β³ π Basic IMAP without the PHP extension (#257)
- β³ π οΈ Basic IMAP client β Developer Guide
- β³ π§ͺ Basic IMAP client β Testing and verifying
- β³ π οΈ Basic IMAP - Sent copy - Developer Guide (#270)
- β³ π€ PR #400 Sending through a relay without a login
- β³ π οΈ Verifying a mail folder β Developer Guide
- β³ π οΈ Mailbox providers β Developer Guide
- β³ π οΈ How Gmail mail collection works β Developer Guide
- β³ Email rendering & images
- β³ SLA Management
- β³ WhatsApp channel
-
β³
βοΈ Telegram channel - β³ β CSAT company scope and filters β Developer Guide
- β³ π₯ Microsoft Teams channel
- β³ π¨οΈ Mattermost channel
- β³ π¬ Web chat channel
- β³ π£ Slack channel
- β³ π Linking tickets
- β³ β Record previews
- β³ π Ticket notes: internal or shared
- β³ ποΈ Canned responses
- β³ βοΈ Limiting replies to particular senders
- β³ π¨ Telling the analyst a ticket is theirs
- β³ βοΈ Email signatures
- β³ π The public web address
- β³ π’ Ticket numbering
- β³ π Raising a ticket for someone else
- β³ π Merging tickets
- β³ π Confidential tickets
- β³ π₯ Portal managers
- β³ π Who has seen a ticket
- β³ π Reading long tickets
- β³ β¨ Reply Cleanup prompt and history
- β³ β Splitting tickets
- β³ β Selecting several tickets
- β³ ποΈ The folder pane
- β³ π½ Just my tickets, or no closed ones
- β³ π οΈ Snoozing tickets β Developer Guide
- β³ π₯ Collision detection
- β³ β±οΈ Time tracking
- β³ π Case reports - a ticket and its work as one PDF
- β³ π Scheduled work in your own calendar
- Problem Management
-
Tasks
- β³ π οΈ Task ID and hover card - review (#405)
- β³ π οΈ Task ID, Company column and hover card β Developer Guide
- β³ π οΈ Task board and subtasks β Developer Guide
- β³ π§βπ€βπ§ People on a task ("Involved")
- β³ π Repeating tasks
- β³ π Complete history for tasks and tickets - design (#430)
- β³ π’ Moving a task between companies
- π Projects
-
Assets
- β³ π οΈ Asset list by type - review (#340)
- β³ π’ Moving an asset between companies
- β³ π Shared asset locations
- β³ π§βπΌ Assigning assets to analysts
- β³ π Warranty and lease alerts
- β³ π Leases
- β³ π Saved table views
- β³ π¨οΈ Recording anything, and importing it
- β³ π§© Asset type layouts
- β³ π Inventory freshness
- β³ π Linked configuration item
- β³ π Connected assets
- β³ π Asset review
- β³ π Missing information
- β³ π¦ Consumables
-
β³ π·οΈ QR asset labels
- β³ π οΈ QR asset labels β Developer Guide
- β³ π Asset label designer - design (#229)
- β³ π· Asset scanning β Developer Guide
- β³ π οΈ Asset tag numbering β Developer Guide
- β³ π οΈ Asset reconciliation β Developer Guide
- β³ π οΈ Reconciliation, tags + labels - review (#164)
- β³ π Who holds what, and handover documents
- β³ π₯οΈ The inventory agent (PowerShell)
- β³ ποΈ Proxmox VE servers
- β³ βοΈ VMware Cloud Director servers
- β³ πͺ Hyper-V and Failover Clusters
- β³ π Linking equipment to tickets
- β³ βοΈ Follow-up tasks on a ticket
- Knowledge
- Change Management
- Calendar
- Morning Checks
- Reporting
- Software
-
Forms
- β³ π¨ The form designer β Developer Guide
- β³ π Layout & the grid β Developer Guide
- β³ ποΈ Collections β grouping submissions
- β³ π Submissions as PDFs
- β³ β‘ What happens next β a form's own actions
- β³ π οΈ Sections & conditional logic β Developer Guide
- β³ π οΈ Lookup fields β Developer Guide
- β³ π οΈ Calculated totals β Developer Guide
-
β³ π‘οΈ Catalogue request approvals
- β³ π οΈ Catalogue approvals β Developer Guide
- β³ π οΈ Approval steps and chains β Developer Guide
- β³ π οΈ Portal approvals β Developer Guide
- β³ π οΈ Approvers change a request's answers β Developer Guide
- β³ π Catalogue group approvals β design (#220)
- β³ π Catalogue as a shop β design (#348)
- β³ π Financial approvals - design (#160)
- People
- Starters & leavers
- Domains
-
ποΈ Files
-
β³ π οΈ Files - Developer Guide
- β³ Versions
- β³ Save to Files
- β³ Storage: server folder or S3
- β³ π S3 storage - PR review
- β³ ποΈ Recycle bin
- β³ π Thumbnails and gallery - design (#424)
- β³ π Recycle bin - design
- β³ π Recycle bin - PR review
- β³ π Deleting or moving a folder
- β³ π Storage series - follow-ups
- β³ π οΈ Floating windows & the file viewer β Developer Guide
-
β³ π οΈ Files - Developer Guide
- Contracts
- Service Status
- π Notifications
- π¨ War Room
-
Self-Service Portal
- β³ π¨ Branding the portal
- β³ π What people can do
- β³ π Help Centre
- β³ πͺ Landing page
- β³ π¨ Login screen designer
- β³ π οΈ Back to your page after sign-in - review (#407)
- β³ π οΈ Back to your page after sign-in β Developer Guide
- β³ π Request catalogue
- β³ π Portal privacy
- β³ π₯ Portal managers
- β³ π Contact details
- β³ π οΈ Developer guide
- LMS
- Process Mapper
-
CMDB
- β³ π§± Designing your CMDB
- β³ π οΈ CMDB β Developer Guide
- β³ π οΈ Impact analysis β Developer Guide
- β³ π οΈ Data quality β Developer Guide
- β³ π οΈ Record references β Developer Guide
- β³ π οΈ CMDB assistant - Developer Guide
- β³ π Linked assets
- β³ π Linking an asset to its CI - design (#201)
- β³ π Discovery and redundancy-aware impact - design (#199)
- β³ π οΈ Relationship wording - review (#297)
- Network Mapper
-
Workflows
- β³ π Branches: If / Otherwise and Choose by value
- β³ π οΈ Workflow engine β Developer Guide
- β³ π οΈ Workflows for tasks β Developer Guide
- β³ π οΈ Workflow notes on a ticket β Developer Guide
- β³ π οΈ Workflow category routing β Developer Guide
- β³ π Workflows in order, child tickets - design (#304)
- β³ β° Time-Based Triggers
- β³ πͺ Webhooks
- β³ π¬ Webhook Message Formats
- β³ π HTTPS Certificates & CA Bundles
- β³ π οΈ SSL Verification β the Global Setting
- β³ π Workflow & Webhook Pitfalls
- Issue trackers (Jira, Azure DevOps)
- π‘ Zabbix (monitoring)
- π¬ Microsoft Teams alerts
- π 3CX (phone system)
-
System
- β³ π οΈ System cards by topic - review (#347)
- β³ π¦ Microsoft 365 (Entra ID and Intune)
- β³ π οΈ Preferences β Developer Guide
- β³ ποΈ Settings on one page
- β³ π§Ή Maintenance
- β³ πΎ Storage usage
- β³ βοΈ Emailed reports
- β³ π Finding people in the Analysts list
- β³ πͺ When an analyst leaves
- β³ π οΈ System β Branding β Developer Guide
- β³ π©Ί Page health (D019) β Developer Guide
- β³ β Feature Bingo
- β³ π Locations
- β³ π·οΈ Cost centres
- β³ π Chart of accounts
- β³ π· Photo Album
- β³ Demo Data
- β³ π οΈ Demo Data β Developer Guide
-
Overview
- β³ π Progress tracker
- β³ Concepts & vocabulary
- β³ Email routing & mailboxes
- β³ Settings: global vs per-company
- β³ Users & self-service
- β³ Staff cross-company access
- β³ One company supporting another
- β³ π’ One board across every company
- β³ Worked examples
- β³ Pitfalls & gotchas
- β³ Scope: what it's for
- β³ π οΈ Developer Guide (make a module multi-company)
- β³ ποΈ Case study: CMDB (a linked graph)
- β³ π§ͺ Test harness (prove it's isolated)
- What this is
-
π Bugs resolved
- β³ π» #436 Intune Last seen not updating
- β³ π #429 Trust duration ignored
- β³ π #423 Knowledge PDF lost formatting
- β³ π§Ύ #427 SOP checklist picker always empty
- β³ π #425 Label beside left a wide gap
- β³ π #422 Calendar Open in inbox link
- β³ π #420 Lookup answers unusable after submit
- β³ π #413 Reading pane too narrow on tablets
- β³ π± #412 Sign-in card cramped on phones
- β³ π§ #411 Header buttons out of reach
- β³ π± #386 Project stuck in an old currency
- β³ π₯οΈ #393 Header ran off the screen
- β³ π±οΈ #395 Ticket flyouts ran off the bottom
- β³ π PR #401 Change editor used hardcoded priorities
- β³ π Knowledge drafts could not be published
- β³ π§© #392 Project dialogs shared element ids
- β³ πΌοΈ #391 Knowledge images from your computer
- β³ π #375 REST API wall-clock times
- β³ π #374 Calendar popup ran off the screen
- β³ π’ #373 All companies: Changes, CMDB, Starters
- β³ π’ #356 Assets People and All companies
- β³ π #366 LMS demo data would not import
- β³ π #362/#365 Team handover showed only a name
- β³ π #365 The bell credited the wrong person
- β³ ποΈ #369 Inbox empty until Database Verification
- β³ πͺ #360 Links opened inside the ticket
- β³ π #354 Workspace Links missed tasks
- β³ π Two access fixes (5.9.1)
- β³ π Task company checks in the API (5.5.0)
- β³ π Asset holders through the API (5.4.0)
- β³ π Files folder delete did not check inside (5.4.0)
- β³ π The Intune tab did not check the company
- β³ π #332 Files viewer would not open
- β³ π #333 Note attachments downloaded
- β³ πͺ #326/#327 Form webhook Full record
- β³ π #325 Form PDF download failed
- β³ π Small fixes in 5.1.0
- β³ π CMDB relationships read backwards (5.1.0)
- β³ π #301 CSAT delay was never applied
- β³ π #281 Comments imported from Jira never arrived
- β³ π #288 A change failed to open with Enforce approvals on
- β³ π Long non-Latin articles never got an embedding
- β³ π« #280 Email lookups scanned the whole table
- β³ β #266 Dragging a task told nobody
- β³ π #255 Article previews showed HTML codes
- β³ π #252 A link to a Knowledge article did not open
- β³ π #254 PDFs could not print Polish
- β³ π #250 Clicking a folder left the open article on screen
- β³ π« #260 The dashboard cog did nothing
- β³ π« #248 A department rule never matched on four routes
- β³ π A directory account could be matched to someone else
- β³ π« #244 Reply went to the assigned analyst
- β³ π Mailbox sign-in was not checked
- β³ π Four weaknesses around signing in
- β³ π A lookup answer could name any record
- β³ π« #227 A mailbox could not be deleted
- β³ π« #226 A picture on a note could not be closed
- β³ π» #222 The Assets page never loaded in 4.3.0
- β³ βοΈ #214 A "contains" condition did not match capitals
- β³ βοΈ #216 A workflow email from a chosen mailbox always failed
- β³ π³ The Docker image was missing PHP extensions
- β³ π A failed DNS lookup read as a missing record
- β³ π A link could change data
- β³ π Access outlived its removal
- β³ π Knowledge articles could run scripts
- β³ π Knowledge writes ignored permissions
- β³ π Company boundaries (Oct 2026)
- β³ π Smaller gaps (Oct 2026)
- β³ π Escaped text could leave its attribute
- β³ π Task descriptions were not cleaned
- β³ π Task documents ignored company scope
- β³ π Repeating tasks ignored company scope
- β³ π¬ #183 Mailbox checks overlapped
- β³ π #188 Transfer lock shown off when unknown
- β³ β #184 Subtask names and Overdue
- β³ π§© #186 Teams: the buttons did nothing
- β³ π Text in a change could run script
- β³ π AI settings changed without the AI permission
- β³ πͺ #178 Deleting an analyst failed
- β³ π« A team with no departments showed 0 tickets
- β³ π Projects: adding a phase did nothing on Save
- β³ π Leavers could still sign in
- β³ πΌοΈ Logo and courses broke on Apache with PHP-FPM
- β³ π’ Chat tickets ignored your ticket numbering
- β³ π Dates shown as a dash, or in server time
- β³ π Assets β Users showed people from other companies
- β³ π Restricted analysts could read other modules' data
- β³ πΌοΈ Replies with a picture in the thread failed to send
- β³ π Reply attachments never reached the customer
- β³ π οΈ Outbound email attachments β Developer Guide
- β³ π A global SSO provider was missing from the portal
- β³ π Behind a proxy, the SSO redirect said http
- β³ βοΈ The portal tagline moved when you saved it
- β³ π¨ The portal settings screen forgot what you saved
- β³ π‘οΈ The approvals inbox said "Error" and nothing else
- β³ π A table's answers were missing from the PDF
- β³ β A single-select column let you tick every option
- β³ π The portal ignored a form's field widths
- β³ π The tasks board stopped taking clicks
- β³ ποΈ #121 The index list is out of date after upgrading
- β³ π #133 The calendar subscription was empty
- β³ π #131 Tasks always reopened on the board
- β³ π₯ #129 Every page returned HTTP 500 after upgrading
- β³ π³ #127 A PHP warning above the System page
- β³ π #126 Notes stamped with the server's clock
- β³ π Storing every date in UTC
- β³ πͺ The portal was down for everyone signed in
- β³ βοΈ #120 Workflow notes could never be written
- β³ βοΈ #123 Three errors when running Database Verification
- β³ π #122 The description box was a stub in the corner
- β³ π£ Demo data deleted real accounts
- β³ π #117 Sign-in redirected to the wrong address
- β³ π¨ #108 The priority dot was invisible
- β³ β±οΈ #116 Time logged from the right-click menu
- β³ π #114 API keys refused by our own guard
- β³ ποΈ #110 Assigning a task told nobody
- β³ πͺ #107 Signed out while still working
- β³ π #103 "Share with Requester" reached nobody
- β³ π #102 Search found nothing for hyphens
- β³ πͺ #101 Source code editor opened behind
- β³ βοΈ #88 Subtasks could not be ticked off
- β³ π» #84 Asset deep link selected nothing
- β³ π« #79 A new ticket arrived with no status
- β³ π§ #79 A ticket from email did not say so
- β³ π #78 Bell opened to nothing
- β³ π¬ #77 Mail only collected from Inbox
- β³ π #74 The default password could not be changed
- β³ π¦ #70 Renaming an impact level
- β³ π€ #67 App-only mailboxes could not send
- β³ π #45 Verify only ever worked for Microsoft
- β³ π #45 IMAP reported as not authenticated
- β³ βοΈ An email template stopped escaping itself
- β³ π The portal dashboard showed the wrong time
- β³ π’ The folder said 99 and the list showed 96