Skip to content

Network Mapper Icon Libraries Developer Guide

Ed Mozley edited this page Nov 24, 2026 · 2 revisions

Network Mapper - Icon Libraries and My Images - 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.

In plain words

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.

Files

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

1. The tables

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.

2. The endpoints

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.

3. Icon libraries from icons.diagrams.net

3.1 The catalogue

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.

3.2 One set: the preview

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.

3.3 The browser modal

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.

3.4 The import, in batches

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.

3.5 Listing and removing

    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.

3.6 Serving an icon

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_close releases the session lock at once, so fifty lazy-loading tiles do not queue behind each other.
  • The mime allow-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 as text/html.
  • Content-Type from 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 opens icon.php?id=N directly in a tab and the picture is an SVG, the document is sandboxed (a unique origin, no script) and may load nothing except data: images and inline styles. This is the second wall behind cleanSvg().
  • 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; private keeps 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.

3.7 In the Shapes palette and on the canvas

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')) + '">&times;</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.

4. My images

4.1 Server: addUpload and deleteUpload

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:

  1. Size - MAX_UPLOAD_BYTES = 4 * 1024 * 1024. (See the Traps section: the next check has a lower limit of its own.)
  2. Magic bytes - safeImage() must recognise the first bytes as PNG, JPEG, GIF or WebP. It would also accept a cleaned SVG, so image/svg+xml is refused explicitly here: an uploaded SVG is never stored, cleaned or not. This matches UPLOAD_TYPES_IMAGE in includes/uploads.php, which leaves SVG out for the same reason.
  3. 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's w / 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.

4.2 Browser: Upload, paste and delete

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 picture

Only 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.

5. CMDB class icons

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 || null

An 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.

6. Security

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.

6.1 Outbound requests: one host, no redirects, size caps

    /** 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(), and curlFor() refuses anything that is not https://icons.diagrams.net on port 443 with no user or password part (the https://icons.diagrams.net@intranet/ trick fails because parse_url() reports intranet as 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, and curlFor() 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_HTTPS stops 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() in includes/ssl.php (the shipped CA bundle via CURLOPT_CAINFO, and the SSL_VERIFY_PEER switch in config.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_batch takes 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.

6.2 The image gate: safeImage

    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.

6.3 The SVG cleaner: cleanSvg

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.

6.4 Two walls, not one

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).

6.5 Storage

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.

6.6 Permissions and CSRF

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.

6.7 What leaves the install

  • 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 strict img-src policy 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).

7. Traps

  • πŸ”΄ TRAP (in code, includes/services/cmdb_schema.php): icon_id on a class is only changed when the caller sends it. Absent keeps the icon, null or '' clears it. Use array_key_exists(), never isset(), for any "absent means keep" field - isset() treats a sent null as 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.0 addUpload() 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 of safeImage() 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 than upload_max_filesize (2 MB on a stock PHP) never reaches addUpload(): $_FILES['file']['error'] is UPLOAD_ERR_INI_SIZE, and the endpoint answers "That picture is larger than this server accepts." To really allow 4 MB, raise upload_max_filesize and post_max_size in 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. The UPDATE ... 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 the importing row, but the browser always begins at 0, so the first batches re-download icons that are already stored and INSERT IGNORE discards them. The batch's imported count includes those ignored rows; icon_count (recounted) is the true figure.
  • ⚠️ status = 'importing' sets are invisible. They do not reach the palette (paletteIcons() joins status = 'ready') and the browser treats them as not imported, which is what lets Import resume them. A set stuck at importing is removed only through the API delete action or by importing it to the end.
  • ⚠️ An icon shape with an unknown icon_id saves as no picture, silently. That is deliberate (a stale tab must not fail its save), but it means a typo in an API caller's icon_id is 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.

8. Tests

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.

Related pages

FreeITSM

Getting Started

Modules

Multi-tenancy (planned)

Responses to feedback

Blue sky thinking

Bugs resolved

Pull requests

Links

Clone this wiki locally