mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
The last item of docs/Compliance/README.md's P3 list, on the maintainer's decision: while ATTACHMENTS_PASSPHRASE is set (at least 16 characters), a site administrator gets Admin Panel / Attachments / Encrypt, which encrypts or decrypts every attachment on this server's disk in the background with progress, and turns on encryption of new attachments. - AES-256-CTR (server/lib/attachmentEncryption.js), so a download can start anywhere: the counter for any byte is the IV plus its block. The key is stretched from the passphrase with scrypt once per salt and kept in memory. Each file starts with WKATT1, the salt and its own IV; a file without the header is plain and read as before. - Every read goes through FileStoreStrategyFilesystem.getReadStream, which decrypts - byte ranges included - so every address, preview, export and storage move is unchanged; the board export and the WebDAV move, which read the file directly, use the same decrypting read. - New uploads are encrypted after their validation and indexing, which need the plain file; imports, e-mail to card and the REST API by an hourly sweep. Each changed attachment's meta.updatedAt is set, so the filesystem integrity scan sees the change explained. The runs and the switch are in the Audit log. - On every platform, the snap and the Helm chart (from a Secret). Tested against a live server (tests/playwright/specs/attachment-encryption.e2e.js): an attachment encrypted on disk downloads at the same address, whole and as a byte range, and decrypts back to the same bytes. Seven new strings, translated in every language. Low confidence: ace, ak, ay, bi, bm, bo, bua, chr, csb, dz, ee, ff, fj, gn, gv, haw, iu, kl, kok, ks, kw, lg, lld, nah, nap, nd, nso, fur, mg, tlh, tig, ti, wal, om, ve-PP, ve-CC, rup, zgh, uz-AR, sah, vo, wuu-Hans, se, qu, to, sm, ss, ts, ve, ny, rn, tn, st, wa, sc, scn. Thanks to xet7 !
369 lines
14 KiB
JavaScript
369 lines
14 KiB
JavaScript
'use strict';
|
|
|
|
// The Admin Panel's URLs: one per left-menu entry.
|
|
//
|
|
// The panel used to be four URLs - /setting, /people, /admin-reports,
|
|
// /attachments - each opening whatever pane its page happened to open first.
|
|
// Which pane you were looking at was ReactiveVar state and nothing else, so a
|
|
// pane could not be linked to, bookmarked, opened in a second tab, or reached
|
|
// by the back button; /setting always landed on Version even if you had just
|
|
// been in Global Webhooks.
|
|
//
|
|
// Every menu entry has a URL now, and the URL says where you are - the panel,
|
|
// the page, and the pane, all three in it:
|
|
//
|
|
// /admin/settings/version
|
|
// /admin/settings/global-webhooks
|
|
// /admin/people/login
|
|
// /admin/problems/database
|
|
// /admin/attachments/backup
|
|
//
|
|
// Under `/admin`, which the pages were not: they sat at the top level -
|
|
// /settings, /people, /attachments - as if they were pages of the app rather
|
|
// than of the Admin Panel, and /attachments collided with the path the file
|
|
// server itself serves attachments from. The prefix says which they are and
|
|
// keeps them out of everyone else's way.
|
|
//
|
|
// The DEFAULT pane is in the URL too. A bare page address showed one pane while
|
|
// naming none, so the address of "Settings showing Version" and the address of
|
|
// "Settings" were the same string; every pane is named now, including the first
|
|
// one. The bare `/admin-settings` still resolves - it redirects to the default
|
|
// pane's own address rather than being a second address for it.
|
|
//
|
|
// The slug is NOT derived from the pane id. The ids are internal and read like
|
|
// it (`tableVisibilityMode-setting`, `layout-setting`, `report-cpu`), while a
|
|
// URL is something a person types and reads; and deriving a name from another
|
|
// name is how `allBoardsMultiselectionSidebar` happened. So this is an explicit
|
|
// map, and a guard checks both directions against the real menus: every pane
|
|
// has a slug, every slug names a pane that exists, and no two panes share one.
|
|
//
|
|
// Slugs are lowercase, words separated by `-`, and say what the pane IS rather
|
|
// than what it is called internally.
|
|
//
|
|
// Pure: no Meteor, no FlowRouter. docs/Features/Admin-Panel/Admin-Panel-URLs.md
|
|
|
|
// slug -> pane id, per page. The pane id is what the page's own click handler
|
|
// and its `activeXId()` already use, so nothing inside a page has to change.
|
|
const ADMIN_PAGES = {
|
|
settings: {
|
|
base: '/admin/settings',
|
|
// Where this page used to live, kept so old links and bookmarks redirect.
|
|
legacyBase: '/settings',
|
|
routeName: 'setting',
|
|
// The pane that opens when no slug is given - the first menu entry.
|
|
defaultSlug: 'version',
|
|
panes: {
|
|
version: 'version-setting',
|
|
// Visibility became Appearance on 2026-11-19 (MOVED_PANES below).
|
|
appearance: 'tableVisibilityMode-setting',
|
|
features: 'features-setting',
|
|
'feature-profiles': 'feature-profiles-setting',
|
|
security: 'privacy-security-setting',
|
|
activities: 'activities-setting',
|
|
delete: 'delete-setting',
|
|
announcement: 'announcement-setting',
|
|
accessibility: 'accessibility-setting',
|
|
// WP-6: the legal pages and the privacy contacts.
|
|
privacy: 'legal-pages-setting',
|
|
translation: 'translation-setting',
|
|
pwa: 'layout-setting',
|
|
'global-webhooks': 'webhook-setting',
|
|
labels: 'shared-labels-setting',
|
|
},
|
|
},
|
|
people: {
|
|
base: '/admin/people',
|
|
legacyBase: '/people',
|
|
routeName: 'people',
|
|
defaultSlug: 'email',
|
|
panes: {
|
|
login: 'registration-setting',
|
|
saml: 'saml-setting',
|
|
ldap: 'ldap-setting',
|
|
oidc: 'oidc-setting',
|
|
cas: 'cas-setting',
|
|
'header-login': 'header-login-setting',
|
|
oauth: 'oauth-setting',
|
|
passwordless: 'passwordless-setting',
|
|
email: 'email-setting',
|
|
notifications: 'notify-setting',
|
|
domains: 'domains-setting',
|
|
organizations: 'org-setting',
|
|
teams: 'team-setting',
|
|
people: 'people-setting',
|
|
'locked-users': 'locked-users-setting',
|
|
'audit-log': 'audit-log-setting',
|
|
roles: 'roles-setting',
|
|
'shared-templates': 'templates-setting',
|
|
},
|
|
},
|
|
problems: {
|
|
base: '/admin/problems',
|
|
legacyBase: '/admin-reports',
|
|
// 'problems', like its siblings' 'setting' / 'people' / 'attachments' - the
|
|
// page key, which is what the menu, the URL and docs/Features all call it.
|
|
// It was 'admin-reports' from when this pane was called Reports: the one
|
|
// route whose name did not match its own address, and the same pane whose
|
|
// template was still called adminReports. Both say problems now.
|
|
//
|
|
// `legacyBase` above is NOT part of that rename and must stay: /admin-reports
|
|
// is an address people have bookmarked, and it still redirects here.
|
|
routeName: 'problems',
|
|
defaultSlug: 'summary',
|
|
panes: {
|
|
summary: 'report-summary',
|
|
// What the laws and standards look for, checked (models/lib/complianceChecks.js).
|
|
compliance: 'report-compliance',
|
|
// The Admin Panel backup's status and history (backupRunsStatus.jade).
|
|
backup: 'features-backup',
|
|
'security-report': 'report-security',
|
|
impersonation: 'report-impersonation',
|
|
// Who signs in with a password shorter than PASSWORD_MIN_LENGTH.
|
|
'password-length': 'report-password-length',
|
|
performance: 'features-performance',
|
|
speed: 'report-speed',
|
|
tests: 'report-tests',
|
|
cpu: 'report-cpu',
|
|
ram: 'report-ram',
|
|
disk: 'report-disk',
|
|
instrumentation: 'report-instrumentation',
|
|
'broken-cards': 'report-broken',
|
|
files: 'report-files',
|
|
rules: 'report-rules',
|
|
// Every webhook and who added it (webhooksReport.js).
|
|
webhooks: 'report-webhooks',
|
|
boards: 'report-boards',
|
|
cards: 'report-cards',
|
|
recovery: 'report-recovery',
|
|
// Where people log in from, grouped: an address several accounts use is an
|
|
// office, a VPN or a NAT (models/lib/loginTally.js).
|
|
office: 'report-office',
|
|
// Which REST endpoints are used, by whom, how often.
|
|
api: 'report-api',
|
|
database: 'report-database',
|
|
integrity: 'report-integrity',
|
|
// Sending and receiving email (models/lib/mailProblems.js).
|
|
mail: 'report-mail',
|
|
},
|
|
},
|
|
attachments: {
|
|
base: '/admin/attachments',
|
|
legacyBase: '/attachments',
|
|
routeName: 'attachments',
|
|
defaultSlug: 'backup',
|
|
panes: {
|
|
backup: 'backup',
|
|
'continuous-backup': 'continuous-backup',
|
|
move: 'move',
|
|
'default-save-storage': 'default-save-storage',
|
|
limits: 'limits',
|
|
retention: 'retention',
|
|
// ATTACHMENTS_PASSPHRASE only (server/lib/attachmentEncryptionRun.js).
|
|
encrypt: 'encrypt',
|
|
gridfs: 'gridfs',
|
|
filesystem: 'filesystem',
|
|
s3: 's3',
|
|
azure: 'azure',
|
|
gcs: 'gcs',
|
|
webdav: 'webdav',
|
|
'database-migration': 'database-migration',
|
|
},
|
|
},
|
|
};
|
|
|
|
// What the header bar calls a pane: "Admin Panel / Settings / Version".
|
|
//
|
|
// The address names three things and so does the title. The panel is four
|
|
// pages and each page is a stack of panes, so "Admin Panel" alone named the
|
|
// building and not the room.
|
|
//
|
|
// The two forms are the ones a left-menu entry already has - a translation key,
|
|
// or a literal label for a name that is not translated (PWA is a product name).
|
|
// A guard checks every one of these against the REAL menu entry for that pane,
|
|
// in `tests/adminUrls.test.cjs`: the title in the bar and the label of the menu
|
|
// row that opened it have to be the same words, and this is a second copy of
|
|
// them, so nothing but a guard keeps them equal.
|
|
const ADMIN_PANE_TITLES = {
|
|
settings: {
|
|
version: { titleKey: 'info' },
|
|
appearance: { titleKey: 'appearance' },
|
|
features: { titleKey: 'features' },
|
|
'feature-profiles': { titleKey: 'feature-profiles' },
|
|
security: { titleKey: 'features-security' },
|
|
activities: { titleKey: 'activities-and-notifications' },
|
|
delete: { titleKey: 'delete' },
|
|
announcement: { titleKey: 'admin-announcement' },
|
|
accessibility: { titleKey: 'accessibility' },
|
|
privacy: { titleKey: 'legal-pages' },
|
|
translation: { titleKey: 'translation' },
|
|
pwa: { title: 'PWA' },
|
|
'global-webhooks': { titleKey: 'global-webhook' },
|
|
labels: { titleKey: 'shared-labels' },
|
|
},
|
|
people: {
|
|
login: { titleKey: 'login' },
|
|
saml: { title: 'SAML' },
|
|
ldap: { titleKey: 'ldap' },
|
|
oidc: { titleKey: 'oauth2' },
|
|
cas: { titleKey: 'cas' },
|
|
'header-login': { titleKey: 'header-login' },
|
|
oauth: { titleKey: 'oauth-providers-title' },
|
|
passwordless: { titleKey: 'passwordless-title' },
|
|
email: { titleKey: 'email' },
|
|
notifications: { titleKey: 'notifications' },
|
|
domains: { titleKey: 'domains' },
|
|
organizations: { titleKey: 'organizations' },
|
|
teams: { titleKey: 'teams' },
|
|
people: { titleKey: 'people' },
|
|
'locked-users': { titleKey: 'accounts-lockout-locked-users' },
|
|
'audit-log': { titleKey: 'admin-audit-log' },
|
|
roles: { titleKey: 'roles' },
|
|
'shared-templates': { titleKey: 'shared-templates' },
|
|
},
|
|
problems: {
|
|
summary: { titleKey: 'summary' },
|
|
compliance: { titleKey: 'compliance' },
|
|
backup: { titleKey: 'backup' },
|
|
'security-report': { titleKey: 'securityReportTitle' },
|
|
impersonation: { titleKey: 'impersonationReportTitle' },
|
|
'password-length': { titleKey: 'password-length-report-title' },
|
|
performance: { titleKey: 'features-performance' },
|
|
speed: { titleKey: 'speedReportTitle' },
|
|
tests: { titleKey: 'testsReportTitle' },
|
|
cpu: { titleKey: 'cpuReportTitle' },
|
|
ram: { titleKey: 'memory-usage' },
|
|
disk: { titleKey: 'sandstorm-disk-usage' },
|
|
instrumentation: { titleKey: 'instrumentationReportTitle' },
|
|
'broken-cards': { titleKey: 'broken-cards' },
|
|
files: { titleKey: 'filesReportTitle' },
|
|
rules: { titleKey: 'rulesReportTitle' },
|
|
webhooks: { titleKey: 'webhooks-report-title' },
|
|
boards: { titleKey: 'boardsReportTitle' },
|
|
cards: { titleKey: 'cardsReportTitle' },
|
|
recovery: { titleKey: 'recoveryReportTitle' },
|
|
office: { titleKey: 'officeReportTitle' },
|
|
api: { titleKey: 'apiReportTitle' },
|
|
database: { titleKey: 'databaseReportTitle' },
|
|
integrity: { titleKey: 'integrityReportTitle' },
|
|
mail: { titleKey: 'mailReportTitle' },
|
|
},
|
|
attachments: {
|
|
backup: { titleKey: 'backup' },
|
|
'continuous-backup': { titleKey: 'continuous-backup' },
|
|
move: { titleKey: 'attachment-move' },
|
|
'default-save-storage': { titleKey: 'default-save-storage' },
|
|
limits: { titleKey: 'attachment-limits' },
|
|
encrypt: { titleKey: 'attachment-encryption' },
|
|
retention: { titleKey: 'attachment-retention' },
|
|
gridfs: { titleKey: 'mongodb-gridfs-storage' },
|
|
filesystem: { titleKey: 'filesystem-storage' },
|
|
s3: { titleKey: 's3-minio-storage' },
|
|
azure: { titleKey: 'azure-blob-storage' },
|
|
gcs: { titleKey: 'gcs-storage' },
|
|
webdav: { titleKey: 'webdav-storage' },
|
|
'database-migration': { titleKey: 'database-migration' },
|
|
},
|
|
};
|
|
|
|
// The title of a pane, in whichever of the two forms it has, or an empty object
|
|
// when the slug is not one of this page's - a caller then shows nothing rather
|
|
// than a title naming a pane that is not open.
|
|
function adminPaneTitle(page, slug) {
|
|
const byPage = ADMIN_PANE_TITLES[page];
|
|
if (!byPage || !Object.prototype.hasOwnProperty.call(byPage, slug)) return {};
|
|
return byPage[slug];
|
|
}
|
|
|
|
// Panes that moved, by their OLD page and slug -> [new page, new slug]. A
|
|
// bookmark of the old address redirects to the new one (config/router.js), so
|
|
// moving a pane never breaks a link. 2026-11-19: Settings / Visibility became
|
|
// Appearance (its Features and Feature profiles groups are panes of their own),
|
|
// and Problems / Security, Delete and Notifications moved to Settings.
|
|
const MOVED_PANES = {
|
|
settings: { visibility: ['settings', 'appearance'] },
|
|
problems: {
|
|
security: ['settings', 'security'],
|
|
delete: ['settings', 'delete'],
|
|
notifications: ['settings', 'activities'],
|
|
},
|
|
};
|
|
|
|
// The new address of a moved pane, or null.
|
|
function movedPanePath(page, slug) {
|
|
const moved = MOVED_PANES[page] && Object.prototype.hasOwnProperty.call(MOVED_PANES[page], slug)
|
|
? MOVED_PANES[page][slug] : null;
|
|
return moved ? adminPath(moved[0], moved[1]) : null;
|
|
}
|
|
|
|
const ADMIN_PAGE_KEYS = Object.keys(ADMIN_PAGES);
|
|
|
|
// The route names of the panel's four pages. The first header bar shows the
|
|
// panel's tabs on all of them, and nowhere else.
|
|
const ADMIN_PANEL_ROUTES = ADMIN_PAGE_KEYS.map(k => ADMIN_PAGES[k].routeName);
|
|
|
|
function adminPage(page) {
|
|
return ADMIN_PAGES[page] || null;
|
|
}
|
|
|
|
// The pane a slug opens, or null when the slug is not one of this page's. A URL
|
|
// can be typed, and a typo must fall back to the default pane rather than
|
|
// rendering a panel with nothing in it.
|
|
function paneIdForSlug(page, slug) {
|
|
const cfg = adminPage(page);
|
|
if (!cfg || typeof slug !== 'string') return null;
|
|
return Object.prototype.hasOwnProperty.call(cfg.panes, slug)
|
|
? cfg.panes[slug]
|
|
: null;
|
|
}
|
|
|
|
// The slug of a pane, for building the URL when a menu row is clicked.
|
|
function slugForPaneId(page, paneId) {
|
|
const cfg = adminPage(page);
|
|
if (!cfg || !paneId) return null;
|
|
const found = Object.keys(cfg.panes).find(slug => cfg.panes[slug] === paneId);
|
|
return found || null;
|
|
}
|
|
|
|
// What to open for a given slug: always a real pane id.
|
|
function resolvePaneId(page, slug) {
|
|
const cfg = adminPage(page);
|
|
if (!cfg) return null;
|
|
return paneIdForSlug(page, slug) || cfg.panes[cfg.defaultSlug];
|
|
}
|
|
|
|
// The path of a pane - always naming it, the default one included, because the
|
|
// point of the address is to say what you are looking at. An unknown pane falls
|
|
// back to the page's default rather than building a URL that resolves to
|
|
// nothing.
|
|
function adminPath(page, paneIdOrSlug) {
|
|
const cfg = adminPage(page);
|
|
if (!cfg) return null;
|
|
const slug = Object.prototype.hasOwnProperty.call(cfg.panes, paneIdOrSlug)
|
|
? paneIdOrSlug
|
|
: slugForPaneId(page, paneIdOrSlug);
|
|
return `${cfg.base}/${slug || cfg.defaultSlug}`;
|
|
}
|
|
|
|
// The route pattern for a page. The pane is REQUIRED: the bare page address is
|
|
// a redirect to the default pane's own address, not a second address for it.
|
|
function adminRoutePath(page) {
|
|
const cfg = adminPage(page);
|
|
return cfg ? `${cfg.base}/:pane` : null;
|
|
}
|
|
|
|
module.exports = {
|
|
ADMIN_PAGES,
|
|
ADMIN_PANE_TITLES,
|
|
adminPaneTitle,
|
|
ADMIN_PAGE_KEYS,
|
|
ADMIN_PANEL_ROUTES,
|
|
adminPage,
|
|
paneIdForSlug,
|
|
slugForPaneId,
|
|
resolvePaneId,
|
|
adminPath,
|
|
adminRoutePath,
|
|
MOVED_PANES,
|
|
movedPanePath,
|
|
};
|