mirror of
https://github.com/wekan/wekan.git
synced 2026-12-05 18:49:44 -05:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cf3465b4e | ||
|
|
a691d7bdd5 | ||
|
|
0aea400b27 | ||
|
|
e6edeadc57 | ||
|
|
d8c299d48e | ||
|
|
2428d28338 | ||
|
|
e774aff816 | ||
|
|
0f17b7b00b | ||
|
|
335d0c90b7 | ||
|
|
b4ab00409b |
No files matched your search
@@ -97,6 +97,44 @@ Which databases WeKan supports
|
||||
|
||||
</details>
|
||||
|
||||
# v13.45 2026-12-05 WeKan ® release
|
||||
|
||||
**In short:** Card attachment tiles show previews for **DXF drawings** and
|
||||
**legacy Word, Excel and PowerPoint files**. Previews follow the board's
|
||||
attachment settings and the original file's access rules. The release also
|
||||
updates **DOMPurify** to address a template sanitization advisory.
|
||||
|
||||
This release adds the following new features:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/0f17b7b00bccd237ebaf3598358e427182ba83e0">Show DXF and legacy Office thumbnails on cards</a>. Thanks to SylcoDev and xet7.</summary>
|
||||
|
||||
ASCII DXF tiles show outlines of supported 2D model-space geometry. Legacy
|
||||
Office tiles show the opening Word text, the first rows and columns of the
|
||||
Excel worksheet, or text from the first PowerPoint slide. WeKan caches the
|
||||
WebP previews and shows an extension tile when conversion is unavailable.
|
||||
|
||||
[Issue #6997](https://github.com/wekan/wekan/issues/6997) and
|
||||
[Issue #6996](https://github.com/wekan/wekan/issues/6996).
|
||||
|
||||
</details>
|
||||
|
||||
and fixes the following bugs:
|
||||
|
||||
<details>
|
||||
<summary><a href="https://github.com/wekan/wekan/commit/e6edeadc5759bd4ad1c6ea856efc8f27f7bfd2d6">Separate personal API token lookup and audit digests</a>. Thanks to xet7.</summary>
|
||||
|
||||
The personal API audit groups requests by metadata such as IP address and
|
||||
country. Its grouping key is computed separately from the lookup digest for
|
||||
random bearer tokens, addressing CodeQL alert 621. Existing tokens and stored
|
||||
audit groups retain their keys.
|
||||
|
||||
</details>
|
||||
|
||||
and updates the following dependencies:
|
||||
|
||||
- [Update DOMPurify to 3.5.1](https://github.com/wekan/wekan/commit/2428d2833894ec4b7dd93763e2504632c7419b3d). Fixes [CVE-2026-144292](https://github.com/advisories/GHSA-hrxw-jjj6-2g2j). Thanks to dependabot and xet7.
|
||||
|
||||
# v13.44 2026-12-04 WeKan ® release
|
||||
|
||||
**In short:** Opened cards show thumbnails for PDFs, Word documents, Excel
|
||||
|
||||
+9
-13
@@ -5,6 +5,15 @@ each one changed and the project status are in
|
||||
Written by `node releases/changelog-short.mjs` from CHANGELOG-big.md:
|
||||
make changes there.
|
||||
|
||||
# v13.45 2026-12-05 WeKan ® release
|
||||
|
||||
Card attachment tiles show previews for **DXF drawings** and
|
||||
**legacy Word, Excel and PowerPoint files**. Previews follow the board's
|
||||
attachment settings and the original file's access rules. The release also
|
||||
updates **DOMPurify** to address a template sanitization advisory.
|
||||
|
||||
[All changes in v13.45](CHANGELOG-big.md#v1345-2026-12-05-wekan--release)
|
||||
|
||||
# v13.44 2026-12-04 WeKan ® release
|
||||
|
||||
Opened cards show thumbnails for PDFs, Word documents, Excel
|
||||
@@ -37,16 +46,3 @@ can turn due dates red before the deadline. REST list moves between boards
|
||||
honor the requested position and keep moved cards on visible lists.
|
||||
|
||||
[All changes in v13.41](CHANGELOG-big.md#v1341-2026-12-03-wekan--release)
|
||||
|
||||
# v13.40 2026-12-02 WeKan ® release
|
||||
|
||||
Native **WeKan board imports** preserve required list fields
|
||||
and handle **Notion** and **Planka** synchronization metadata. Multiline
|
||||
board labels save correctly. **OpenProject** transfers preserve assignees and
|
||||
milestone dates and budgets. List Sync can write back compatible type
|
||||
changes and budget choices.
|
||||
**Jira** transfers retain description panels and API exports preserve inline
|
||||
formatting. List Sync can also read and update Jira start dates. The
|
||||
**Univention App Center** package starts with the shell-free WeKan image.
|
||||
|
||||
[All changes in v13.40](CHANGELOG-big.md#v1340-2026-12-02-wekan--release)
|
||||
+1
-1
@@ -62,7 +62,7 @@ FROM --platform=$BUILDPLATFORM debian:trixie AS bundle
|
||||
|
||||
ARG TARGETARCH
|
||||
ARG TARGETVARIANT
|
||||
ARG VERSION=13.44
|
||||
ARG VERSION=13.45
|
||||
ARG DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
COPY --chmod=755 releases/check-telemetry.py /tmp/check-telemetry.py
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
appId: wekan-public/apps/77b94f60-dec9-0136-304e-16ff53095928
|
||||
appVersion: "v13.44.0"
|
||||
appVersion: "v13.45.0"
|
||||
files:
|
||||
userUploads:
|
||||
- README.md
|
||||
|
||||
@@ -108,11 +108,11 @@ template(name="attachmentGallery")
|
||||
i.fa.fa-file-o(aria-hidden="true")
|
||||
span.attachment-thumbnail-ext= extension
|
||||
else if link
|
||||
if(isImage)
|
||||
img.attachment-thumbnail(src="{{attachmentPreviewUrl this}}" title="{{cleanFilename name}}" alt="{{cleanFilename name}}" loading="lazy")
|
||||
else if documentThumbnailUrl this
|
||||
if documentThumbnailUrl this
|
||||
img.attachment-thumbnail.attachment-document-thumbnail(src="{{documentThumbnailUrl this}}" title="{{cleanFilename name}}" alt="" loading="lazy")
|
||||
span.attachment-thumbnail-text.attachment-document-fallback(hidden)= extension
|
||||
else if isImage
|
||||
img.attachment-thumbnail(src="{{attachmentPreviewUrl this}}" title="{{cleanFilename name}}" alt="{{cleanFilename name}}" loading="lazy")
|
||||
else if($eq extension 'svg')
|
||||
img.attachment-thumbnail(src="{{link}}" title="{{cleanFilename name}}" alt="{{cleanFilename name}}" type="image/svg+xml")
|
||||
else if($eq extension 'mp3')
|
||||
|
||||
@@ -10,7 +10,7 @@ This is without container (without Docker or Snap).
|
||||
|
||||
Right click and download files 1-4:
|
||||
|
||||
1. [wekan-13.44-win64.zip](https://github.com/wekan/wekan/releases/download/v13.44/wekan-13.44-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
1. [wekan-13.45-win64.zip](https://github.com/wekan/wekan/releases/download/v13.45/wekan-13.45-win64.zip) or newest available at https://github.com/wekan/wekan/releases/
|
||||
|
||||
2. [node.exe](https://nodejs.org/dist/latest-v26.x/win-x64/node.exe)
|
||||
|
||||
@@ -22,7 +22,7 @@ Right click and download files 1-4:
|
||||
|
||||
6. Double click `mongodb-windows-x86_64-7.0.34-signed.msi` . In installer, uncheck downloading MongoDB compass.
|
||||
|
||||
7. Unzip `wekan-13.44-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
7. Unzip `wekan-13.45-win64.zip` , inside it is directory `bundle`, to it copy other files:
|
||||
|
||||
```
|
||||
bundle (directory)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
## Simafri
|
||||
|
||||

|
||||
|
||||
Managed VPS: our step-by-step guide runs WeKan with Docker Compose and MongoDB 7, while Simafri keeps the server updated, monitors it 24/7 and backs it up every night, encrypted.
|
||||
|
||||
https://www.simafri.com/en/guides/self-host-wekan/
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 7.7 KiB |
@@ -44,6 +44,10 @@ function canThumbnail(attachment) {
|
||||
}
|
||||
|
||||
const DOCUMENT_TYPES = new Map([
|
||||
['doc', 'application/msword'],
|
||||
['xls', 'application/vnd.ms-excel'],
|
||||
['ppt', 'application/vnd.ms-powerpoint'],
|
||||
['dxf', 'application/dxf'],
|
||||
['pdf', 'application/pdf'],
|
||||
['docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'],
|
||||
['xlsx', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'],
|
||||
@@ -59,9 +63,13 @@ function documentThumbnailKind(attachment) {
|
||||
for (const [kind, mime] of DOCUMENT_TYPES) if (type === mime) return kind;
|
||||
const ext = String(attachment.extension || /\.([^./]+)$/.exec(attachment.name || '')?.[1] || '')
|
||||
.replace(/^\./, '').toLowerCase();
|
||||
if (['image/vnd.dxf', 'image/x-dxf', 'application/x-dxf'].includes(type)) return 'dxf';
|
||||
if (!DOCUMENT_TYPES.has(ext)) return null;
|
||||
if (!type || type === 'application/octet-stream' || type === 'binary/octet-stream'
|
||||
|| (ext !== 'pdf' && type === 'application/zip')) return ext;
|
||||
|| (['docx', 'xlsx', 'pptx', 'odt', 'ods', 'odp'].includes(ext) && type === 'application/zip')
|
||||
|| (ext === 'dxf' && type === 'text/plain')
|
||||
|| (['doc', 'xls', 'ppt'].includes(ext)
|
||||
&& ['application/x-ole-storage', 'application/x-cfb', 'application/cdfv2'].includes(type))) return ext;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
Generated
+6
-6
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.44.0",
|
||||
"version": "v13.45.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "wekan",
|
||||
"version": "v13.44.0",
|
||||
"version": "v13.45.0",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
@@ -41,7 +41,7 @@
|
||||
"bson": "^7.3.1",
|
||||
"chart.js": "^4.6.2",
|
||||
"dhtmlx-gantt": "^10.0.3",
|
||||
"dompurify": "^3.4.18",
|
||||
"dompurify": "^3.5.1",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"fflate": "^0.8.3",
|
||||
"file-type": "^22.2.0",
|
||||
@@ -7602,9 +7602,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/dompurify": {
|
||||
"version": "3.4.18",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.18.tgz",
|
||||
"integrity": "sha512-ofe3wI/uNm68HInABYFJYqQxRw1EaKAjNdrFVKqjUY+UZurvNd2L/HuQe097s/4RivWiZyP6tT7aoT8atjfhwg==",
|
||||
"version": "3.5.1",
|
||||
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.5.1.tgz",
|
||||
"integrity": "sha512-9fRTM0QJhaSDzR2y4Ym59AW3J3wvNIsQrFQmDilCsExEA/Daks2t5UXh75tE38PB7v8S2/3+JP1UT89Zo9YvEg==",
|
||||
"license": "(MPL-2.0 OR Apache-2.0)",
|
||||
"optionalDependencies": {
|
||||
"@types/trusted-types": "^2.0.7"
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "wekan",
|
||||
"version": "v13.44.0",
|
||||
"version": "v13.45.0",
|
||||
"description": "Open-Source kanban",
|
||||
"private": true,
|
||||
"repository": {
|
||||
@@ -89,7 +89,7 @@
|
||||
"bson": "^7.3.1",
|
||||
"chart.js": "^4.6.2",
|
||||
"dhtmlx-gantt": "^10.0.3",
|
||||
"dompurify": "^3.4.18",
|
||||
"dompurify": "^3.5.1",
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"fflate": "^0.8.3",
|
||||
"file-type": "^22.2.0",
|
||||
|
||||
@@ -79,6 +79,43 @@ function drawRows(rows, sheet) {
|
||||
return canvas;
|
||||
}
|
||||
|
||||
function drawDxf(paths) {
|
||||
const canvas = createCanvas(edge, edge);
|
||||
const ctx = canvas.getContext('2d');
|
||||
ctx.fillStyle = '#fff';
|
||||
ctx.fillRect(0, 0, edge, edge);
|
||||
let minX = Infinity;
|
||||
let minY = Infinity;
|
||||
let maxX = -Infinity;
|
||||
let maxY = -Infinity;
|
||||
for (const outline of paths) {
|
||||
for (const [x, y] of outline) {
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
maxY = Math.max(maxY, y);
|
||||
}
|
||||
}
|
||||
const span = Math.max(maxX - minX, maxY - minY);
|
||||
if (!span) throw new Error('DXF geometry has no extent');
|
||||
const size = edge - 32;
|
||||
const left = (edge - (maxX - minX) / span * size) / 2;
|
||||
const top = (edge - (maxY - minY) / span * size) / 2;
|
||||
ctx.strokeStyle = '#202832';
|
||||
ctx.lineWidth = 2;
|
||||
ctx.beginPath();
|
||||
for (const outline of paths) {
|
||||
outline.forEach(([x, y], i) => {
|
||||
const px = left + (x - minX) / span * size;
|
||||
const py = top + (maxY - y) / span * size;
|
||||
if (i === 0) ctx.moveTo(px, py);
|
||||
else ctx.lineTo(px, py);
|
||||
});
|
||||
}
|
||||
ctx.stroke();
|
||||
return canvas;
|
||||
}
|
||||
|
||||
async function renderOffice() {
|
||||
const { openDocxDocument, openXlsxWorkbook, openPptxPresentation } = await import(
|
||||
pathToFileURL(load.resolve('@wekan/office-open-xml-viewer/node')).href);
|
||||
@@ -128,7 +165,8 @@ async function renderOffice() {
|
||||
if (kind === 'embedded') image = Buffer.from(input);
|
||||
else {
|
||||
const canvas = kind === 'pdf' ? await renderPdf()
|
||||
: rows ? drawRows(rows, kind === 'ods') : await renderOffice();
|
||||
: kind === 'dxf' ? drawDxf(input)
|
||||
: rows ? drawRows(rows, kind === 'ods' || kind === 'xls') : await renderOffice();
|
||||
image = canvas.toBuffer('image/png');
|
||||
}
|
||||
const webp = await sharp(image, { limitInputPixels: 4_000_000, failOn: 'error' })
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
<head>
|
||||
<meta charset="utf8" />
|
||||
<title>WeKan REST API v13.44</title>
|
||||
<title>WeKan REST API v13.45</title>
|
||||
<!-- needed for adaptive design -->
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<style>
|
||||
@@ -498,11 +498,11 @@ data-styled.g662[id="sc-hFhjrW"]{content:"gelAUe,"}/*!sc*/
|
||||
|
||||
<body>
|
||||
|
||||
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
|
||||
<div id="redoc"><div class="sc-dPmKWx eXwHqO redoc light" style="--navbar-height:0px;--navbar-stack-height:0px"><div hidden=""><script>try{var r=document.querySelectorAll(".redoc");r=r[r.length-1];var h=document.documentElement,p=h.classList,a=[h.getAttribute("data-bs-theme"),h.getAttribute("data-theme")];var m=p.contains("dark")||a.indexOf("dark")>-1?"dark":p.contains("light")||a.indexOf("light")>-1?"light":localStorage.getItem("redoc.colorMode");if(m!=="light"&&m!=="dark")m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";r.classList.remove("light","dark");r.classList.add(m)}catch(e){}</script></div><div class="sc-hHttOM iMkNMJ menu-content"><div class="sc-jokKPH fejYuX"><div data-testid="search-trigger" class="sc-cRcubC kWLWEm"><div class="sc-gzhUzI ejGLvh"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" data-component-name="icons/SearchIcon/SearchIcon" class="sc-bUAICN hRyRtS"><path d="M14.5 13.7931L10.724 10.017C11.6313 8.9277 12.0838 7.5305 11.9872 6.11608C11.8907 4.70165 11.2525 3.37891 10.2055 2.423C9.15857 1.4671 7.78336 0.951637 6.36602 0.983845C4.94867 1.01605 3.5983 1.59345 2.59582 2.59593C1.59335 3.5984 1.01595 4.94877 0.983738 6.36612C0.95153 7.78347 1.46699 9.15867 2.4229 10.2057C3.3788 11.2526 4.70155 11.8908 6.11597 11.9873C7.53039 12.0839 8.92759 11.6314 10.0169 10.7241L13.793 14.5001L14.5 13.7931ZM2.00001 6.50012C2.00001 5.6101 2.26393 4.74007 2.7584 4.00005C3.25286 3.26003 3.95567 2.68325 4.77794 2.34266C5.6002 2.00207 6.505 1.91295 7.37792 2.08658C8.25083 2.26022 9.05266 2.6888 9.68199 3.31814C10.3113 3.94747 10.7399 4.7493 10.9135 5.62221C11.0872 6.49513 10.9981 7.39993 10.6575 8.22219C10.3169 9.04446 9.7401 9.74726 9.00008 10.2417C8.26006 10.7362 7.39003 11.0001 6.50001 11.0001C5.30694 10.9988 4.16312 10.5243 3.31949 9.68064C2.47587 8.83701 2.00133 7.69319 2.00001 6.50012Z"></path></svg><span>Loading...</span></div></div></div><div class="sc-gpABuY dGxToZ"><ul data-component-name="Menu/Menu" class="sc-llaQDn gIDdEs"><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="true" class="sc-iMaYoB kYPxgQ"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="WeKan REST API" class="sc-cKRyZE edpvXG">WeKan REST API</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-default" role="listitem"><a class="sc-bcyEQV eSomNa" href="/section/production-security-concerns" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB dpiTia"><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Production Security Concerns" class="sc-cKRyZE cXpWdQ">Production Security Concerns</span></span></div></li></a></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/login" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="Login" class="sc-cKRyZE cXpWdQ">Login</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/attachmentstoragesettings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-default" data-component-name="icons/ChevronRightIcon/ChevronRightIcon" class="sc-hiunUN kPiUFd"><path d="M11 8L6.00002 13L5.30002 12.3L9.60002 8L5.30002 3.7L6.00002 3L11 8Z"></path></svg></div><div class="sc-bmzNle dAAsRD"><span class="sc-amuuf fiYZDR"><span data-text="AttachmentStorageSettings" class="sc-cKRyZE cXpWdQ">AttachmentStorageSettings</span></span></div></li></a><div style="display:none;height:0px;overflow:hidden" class="sc-boLXHU DecdG"></div></div><div data-component-name="Menu/MenuItem" class="sc-epufQc jNyRbY menu-item-type-group" role="listitem"><a class="sc-bcyEQV eSomNa" href="/settings" data-discover="true"><li role="none" data-testid="menu-item-label" data-active="false" class="sc-iMaYoB buxibf"><div class="sc-hgJgCR fyVeNP"><svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" color="--tree-content-color-Line truncated
|
||||
<script type="module">
|
||||
import { hydrate } from "https://cdn.redocly.com/redoc/v3.2.0/bundles/redoc.standalone.js";
|
||||
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.44","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_definition = {"openapi":"3.2.0","info":{"title":"WeKan REST API","version":"v13.45","description":"The REST API allows you to control and extend WeKan with ease.\n\nIf you are an end-user and not a dev or a tester, [create an issue](https://github.com/wekan/wekan/issues/new) to request new APIs.\n\n> All API calls in the documentation are made using `curl`. However, you are free to use Java / Python / PHP / Golang / Ruby / Swift / Objective-C / Rust / Scala / C# or any other programming languages.\n\n# Production Security Concerns\nWhen calling a production WeKan server, ensure it is running via HTTPS and has a valid SSL Certificate. The login method requires you to post your username and password in plaintext, which is why we highly suggest only calling the REST login api over HTTPS. Also, few things to note:\n\n* Only call via HTTPS\n* Implement a timed authorization token expiration strategy\n* Ensure the calling user only has permissions for what they are calling and no more\n"},"paths":{"/users/login":{"post":{"operationId":"login","summary":"Login with REST API","tags":["Login"],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}},"application/x-www-form-urlencoded":{"schema":{"type":"object","required":["username","password"],"properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"}}}}},"description":"Login credentials","required":true},"responses":{"200":{"description":"Successful authentication","content":{"*/*":{"schema":{"type":"object","required":["id","token","tokenExpires"],"properties":{"id":{"type":"string","description":"User ID"},"token":{"type":"string","description":"Authentication token\n"},"tokenExpires":{"type":"string","format":"date-time","description":"Token expiration date\n"}}}}}},"400":{"description":"Error in authentication\n","content":{"*/*":{"schema":{"type":"object","properties":{"error":{"type":"string"},"reason":{"type":"string"}}}}}},"default":{"description":"Error in authentication\n"}}}},"/users/register":{"post":{"operationId":"register","summary":"Register with REST API","description":"Notes:\n - You will need to provide the token for any of the authenticated methods.\n","tags":["Login"],"requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"type":"object","properties":{"username":{"description":"Your username\n","type":"string"},"password":{"description":"Your password\n","type":"string","format":"password"},"email":{"description":"Your email\n","type":"string"}},"required":["username","password","email"]}}},"required":true},"responses":{"200":{"description":"Successful registration","content":{"*/*":{"schema":{"items":{"properties":{"id":{"type":"string"},"token":{"type":"string"},"tokenExpires":{"type":"string"}}}}}}},"400":{"description":"Error in registration\n","content":{"*/*":{"schema":{"items":{"properties":{"error":{"type":"number"},"reason":{"type":"string"}}}}}}},"default":{"description":"Error in registration\n"}}}},"/api/admin/attachment-settings":{"get":{"operationId":"get_attachment_settings","summary":"Get the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. Returns the Admin Panel >\n Attachments settings document, including `limitSettings.attachmentsUploadBlocked`\n and `limitSettings.avatarsUploadBlocked` plus the size limits. Cloud-storage\n secret keys (S3 secretAccessKey, Azure accountKey/connectionString, GCS\n credentials) are masked and never returned; a boolean `\u003cfield>Set` marker\n shows whether a value exists.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}},"put":{"operationId":"update_attachment_settings","summary":"Update the attachment storage / upload-block settings (GlobalAdmin)","description":"Only the global admin can call this. The request body is a\n partial settings object (for example\n `{\"limitSettings\": {\"avatarsUploadBlocked\": true}}`). It is applied through\n the same update path as the `updateAttachmentStorageSettings` Meteor method,\n so validation and `$set` semantics are identical: cloud-storage secrets left\n blank are preserved. The masked, updated settings document is returned.\n","tags":["AttachmentStorageSettings","Settings"],"security":[{"UserSecurity":[]}],"responses":{"200":{"description":"200 response","content":{"application/json":{"schema":{"type":"Object"}}}}}}},"/api/admin/domains":{"get":{"operationId":"get_admin_domains","summary":"List email domains with their user counts (GlobalAdmin)","description":"Only the global admin can call this. CountsLine truncated
|
||||
const __redoc_options = {"skipBundle":true,"disableTelemetry":false};
|
||||
|
||||
hydrate(__redoc_definition, __redoc_options, document.getElementById('redoc'));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: WeKan REST API
|
||||
version: v13.44
|
||||
version: v13.45
|
||||
description: |
|
||||
The REST API allows you to control and extend WeKan with ease.
|
||||
|
||||
|
||||
@@ -22,10 +22,10 @@ const pkgdef :Spk.PackageDefinition = (
|
||||
appTitle = (defaultText = "Wekan"),
|
||||
# The name of the app as it is displayed to the user.
|
||||
|
||||
appVersion = 1344,
|
||||
appVersion = 1345,
|
||||
# Increment this for every release.
|
||||
|
||||
appMarketingVersion = (defaultText = "13.44~2026-12-04"),
|
||||
appMarketingVersion = (defaultText = "13.45~2026-12-05"),
|
||||
# Human-readable presentation of the app version.
|
||||
|
||||
minUpgradableAppVersion = 0,
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { legacyOfficeThumbnailRows } from './legacyOfficeThumbnail.js';
|
||||
import { dxfThumbnailPaths } from './dxfThumbnail.js';
|
||||
import fs from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
import { inflateRawSync } from 'node:zlib';
|
||||
@@ -75,8 +77,10 @@ export async function renderDocumentThumbnail(kind, data, workerSource) {
|
||||
if (!Buffer.isBuffer(data) || data.length === 0 || data.length > DOCUMENT_MAX_BYTES) {
|
||||
throw new Error('Document exceeds the thumbnail conversion limit');
|
||||
}
|
||||
const parameters = ['odt', 'ods', 'odp'].includes(kind)
|
||||
? await odfInput(kind, data) : { kind, input: data };
|
||||
let parameters = { kind, input: data };
|
||||
if (['odt', 'ods', 'odp'].includes(kind)) parameters = await odfInput(kind, data);
|
||||
if (['doc', 'xls', 'ppt'].includes(kind)) parameters = { kind, rows: await legacyOfficeThumbnailRows(kind, data) };
|
||||
if (kind === 'dxf') parameters.input = dxfThumbnailPaths(data);
|
||||
return new Promise((resolve, reject) => {
|
||||
const worker = new Worker(workerSource, {
|
||||
eval: true,
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
const MAX_BYTES = 2 * 1024 * 1024;
|
||||
const MAX_POINTS = 50_000;
|
||||
const TURN = 2 * Math.PI;
|
||||
|
||||
export function dxfThumbnailPaths(input) {
|
||||
if (input.length > MAX_BYTES || input.includes(0)) throw new Error('Unsupported DXF');
|
||||
const lines = input.toString('utf8').replace(/^\uFEFF/, '').trimEnd().split(/\r?\n/);
|
||||
if (lines.length % 2 !== 0) throw new Error('Incomplete DXF group');
|
||||
const paths = [];
|
||||
let points = 0;
|
||||
let section = false;
|
||||
let polyline;
|
||||
let ended = false;
|
||||
|
||||
function add(path) {
|
||||
if (path.length < 2) return;
|
||||
points += path.length;
|
||||
if (points > MAX_POINTS || path.some(([x, y]) =>
|
||||
!Number.isFinite(x) || !Number.isFinite(y) || Math.abs(x) > 1e15 || Math.abs(y) > 1e15)) {
|
||||
throw new Error('DXF geometry exceeds thumbnail limits');
|
||||
}
|
||||
paths.push(path);
|
||||
}
|
||||
|
||||
function arc(x, y, ux, uy, vx, vy, start, sweep) {
|
||||
const steps = Math.max(2, Math.ceil(Math.abs(sweep) * 64 / TURN));
|
||||
return Array.from({ length: steps + 1 }, (_, index) => {
|
||||
const t = start + sweep * index / steps;
|
||||
return [x + ux * Math.cos(t) + vx * Math.sin(t), y + uy * Math.cos(t) + vy * Math.sin(t)];
|
||||
});
|
||||
}
|
||||
|
||||
function drawPolyline(vertices, closed) {
|
||||
if (vertices.length < 2) return;
|
||||
const count = closed ? vertices.length : vertices.length - 1;
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const [x, y, bulge] = vertices[i];
|
||||
const [nx, ny] = vertices[(i + 1) % vertices.length];
|
||||
if (!Number.isFinite(bulge)) throw new Error('Invalid DXF bulge');
|
||||
if (Math.abs(bulge) < 1e-8 || (nx === x && ny === y)) {
|
||||
add([[x, y], [nx, ny]]);
|
||||
continue;
|
||||
}
|
||||
const offset = (1 / bulge - bulge) / 4;
|
||||
const cx = (x + nx) / 2 - (ny - y) * offset;
|
||||
const cy = (y + ny) / 2 + (nx - x) * offset;
|
||||
add(arc(cx, cy, x - cx, y - cy, cy - y, x - cx, 0, 4 * Math.atan(bulge)));
|
||||
}
|
||||
}
|
||||
|
||||
for (let i = 0; i < lines.length;) {
|
||||
if (lines[i].trim() === '999') {
|
||||
i += 2;
|
||||
continue;
|
||||
}
|
||||
if (lines[i].trim() !== '0') throw new Error('Invalid DXF record');
|
||||
const entity = lines[i + 1].trim();
|
||||
i += 2;
|
||||
const groups = new Map();
|
||||
const vertices = [];
|
||||
let vertex;
|
||||
const fits = [];
|
||||
let fit;
|
||||
while (i < lines.length && lines[i].trim() !== '0') {
|
||||
const code = lines[i].trim();
|
||||
const value = lines[i + 1].trim();
|
||||
if (!/^\d+$/.test(code)) throw new Error('Invalid DXF group code');
|
||||
if (!groups.has(code)) groups.set(code, value);
|
||||
if (section && (entity === 'SPLINE' || entity === 'LWPOLYLINE')) {
|
||||
if (code === '10') vertices.push(vertex = [Number(value), NaN, 0]);
|
||||
if (code === '20' && vertex) vertex[1] = Number(value);
|
||||
if (code === '42' && vertex) vertex[2] = Number(value);
|
||||
if (entity === 'SPLINE' && code === '11') fits.push(fit = [Number(value), NaN]);
|
||||
if (entity === 'SPLINE' && code === '21' && fit) fit[1] = Number(value);
|
||||
}
|
||||
i += 2;
|
||||
}
|
||||
|
||||
if (entity === 'SECTION') section = groups.get('2') === 'ENTITIES';
|
||||
if (entity === 'EOF') { ended = true; break; }
|
||||
if (!section) continue;
|
||||
const n = (code, fallback = NaN) => groups.has(code) ? Number(groups.get(code)) : fallback;
|
||||
const flags = n('70', 0);
|
||||
if (entity === 'ENDSEC') section = false;
|
||||
if (entity === 'POLYLINE') polyline = { vertices: [], flags, paper: n('67', 0) };
|
||||
if (entity === 'VERTEX' && polyline) polyline.vertices.push([n('10'), n('20'), n('42', 0)]);
|
||||
if (entity === 'SEQEND' && polyline) {
|
||||
if (!polyline.paper && !(polyline.flags & 120)) drawPolyline(polyline.vertices, polyline.flags & 1);
|
||||
polyline = undefined;
|
||||
}
|
||||
if (n('67', 0) || (groups.has('410') && groups.get('410').toUpperCase() !== 'MODEL')) continue;
|
||||
const x = n('10');
|
||||
const y = n('20');
|
||||
if (entity === 'LINE') add([[x, y], [n('11'), n('21')]]);
|
||||
if (entity === 'LWPOLYLINE') drawPolyline(vertices, flags & 1);
|
||||
if (entity === 'SPLINE') add(fits.length >= 2 ? fits : vertices.map(([vx, vy]) => [vx, vy]));
|
||||
if (entity === 'CIRCLE' || entity === 'ARC' || entity === 'ELLIPSE') {
|
||||
const ellipse = entity === 'ELLIPSE';
|
||||
const ux = ellipse ? n('11') : n('40');
|
||||
const uy = ellipse ? n('21') : 0;
|
||||
const ratio = ellipse ? n('40') : 1;
|
||||
const units = ellipse ? 1 : Math.PI / 180;
|
||||
const start = entity === 'CIRCLE' ? 0 : (ellipse ? n('41', 0) : n('50')) * units;
|
||||
const end = entity === 'CIRCLE' ? TURN : (ellipse ? n('42', TURN) : n('51')) * units;
|
||||
const delta = end - start;
|
||||
const sweep = ((delta % TURN) + TURN) % TURN || TURN;
|
||||
if (!Number.isFinite(delta) || ratio <= 0 || (!ellipse && ux <= 0)) throw new Error('Invalid DXF curve');
|
||||
add(arc(x, y, ux, uy, -uy * ratio, ux * ratio, start, sweep));
|
||||
}
|
||||
}
|
||||
if (!ended || section || !paths.length) throw new Error('DXF has no readable model geometry');
|
||||
return paths;
|
||||
}
|
||||
@@ -0,0 +1,302 @@
|
||||
import { openCompoundFile } from '../../models/lib/outlookMsgFormat.js';
|
||||
|
||||
const STREAM_LIMIT = 16 * 1024 * 1024;
|
||||
const TEXT_LIMIT = 2400;
|
||||
const ROW_LIMIT = 13;
|
||||
const COL_LIMIT = 6;
|
||||
const RECORD_LIMIT = 250_000;
|
||||
const ansi = new TextDecoder('windows-1252');
|
||||
|
||||
function requireValid(condition) {
|
||||
if (!condition) throw new Error('Unsupported or damaged legacy Office document');
|
||||
}
|
||||
|
||||
function textRows(text) {
|
||||
return text.replace(/\x13[^\x14\x15]*(?:\x14|\x15)/g, '')
|
||||
.split(/[\r\n\v\f]+/)
|
||||
.map(line => line.replace(/[\x00-\x08\x0e-\x1f]/g, '').trim())
|
||||
.filter(Boolean).slice(0, 20).map(line => [line.slice(0, 100)]);
|
||||
}
|
||||
|
||||
async function wordRows(read) {
|
||||
const word = await read('WordDocument');
|
||||
requireValid(word.readUInt16LE(0) === 0xa5ec && word.readUInt16LE(2) >= 0x00c1);
|
||||
const flags = word.readUInt16LE(10);
|
||||
requireValid(!(flags & 0x8100));
|
||||
const table = await read(flags & 0x0200 ? '1Table' : '0Table');
|
||||
|
||||
// MS-DOC: the CLX maps main-story character positions to stream offsets.
|
||||
const longs = 34 + word.readUInt16LE(32) * 2;
|
||||
const pairs = longs + 2 + word.readUInt16LE(longs) * 4;
|
||||
const limit = Math.min(TEXT_LIMIT, word.readUInt32LE(longs + 14));
|
||||
const clxStart = word.readUInt32LE(pairs + 2 + 33 * 8);
|
||||
const clxEnd = clxStart + word.readUInt32LE(pairs + 6 + 33 * 8);
|
||||
requireValid(clxEnd <= table.length);
|
||||
let pos = clxStart;
|
||||
while (pos < clxEnd && table[pos] === 1) pos += 3 + table.readUInt16LE(pos + 1);
|
||||
requireValid(table[pos] === 2 && pos + 5 <= clxEnd);
|
||||
const length = table.readUInt32LE(pos + 1);
|
||||
pos += 5;
|
||||
const count = (length - 4) / 12;
|
||||
requireValid(Number.isInteger(count) && count > 0 && pos + length <= clxEnd);
|
||||
let text = '';
|
||||
for (let i = 0; i < count; i += 1) {
|
||||
const start = table.readUInt32LE(pos + i * 4);
|
||||
if (start >= limit) break;
|
||||
const end = Math.min(limit, table.readUInt32LE(pos + (i + 1) * 4));
|
||||
requireValid(end > start);
|
||||
const fc = table.readUInt32LE(pos + (count + 1) * 4 + i * 8 + 2);
|
||||
const compressed = Boolean(fc & 0x40000000);
|
||||
const offset = (fc & 0x3fffffff) / (compressed ? 2 : 1);
|
||||
const last = offset + (end - start) * (compressed ? 1 : 2);
|
||||
requireValid(Number.isInteger(offset) && last <= word.length);
|
||||
const chars = word.subarray(offset, last);
|
||||
text += compressed ? ansi.decode(chars) : chars.toString('utf16le');
|
||||
}
|
||||
return textRows(text);
|
||||
}
|
||||
|
||||
function* biffRecords(data, start = 0) {
|
||||
let records = 0;
|
||||
for (let pos = start; pos + 4 <= data.length;) {
|
||||
requireValid(++records <= RECORD_LIMIT);
|
||||
const type = data.readUInt16LE(pos);
|
||||
const length = data.readUInt16LE(pos + 2);
|
||||
pos += 4;
|
||||
requireValid(pos + length <= data.length);
|
||||
yield { type, body: data.subarray(pos, pos + length) };
|
||||
if (type === 0x000a) return;
|
||||
pos += length;
|
||||
}
|
||||
throw new Error('Incomplete BIFF stream');
|
||||
}
|
||||
|
||||
// MS-XLS: only a continuation inside character data starts with an encoding byte.
|
||||
function sharedStrings(chunks, wanted) {
|
||||
if (!wanted.size) return new Map();
|
||||
requireValid(chunks[0]?.length >= 8);
|
||||
const count = chunks[0].readUInt32LE(4);
|
||||
const last = Math.max(...wanted);
|
||||
requireValid(last < count && last < 100_000);
|
||||
let chunk = 0;
|
||||
let pos = 8;
|
||||
function advance() {
|
||||
pos = 0;
|
||||
requireValid(++chunk < chunks.length && chunks[chunk].length > 0);
|
||||
}
|
||||
function byte() {
|
||||
if (pos === chunks[chunk].length) advance();
|
||||
return chunks[chunk][pos++];
|
||||
}
|
||||
function uint(size) {
|
||||
let n = 0;
|
||||
for (let i = 0; i < size; i += 1) n += byte() * 256 ** i;
|
||||
return n;
|
||||
}
|
||||
function skip(length) {
|
||||
while (length > 0) {
|
||||
if (pos === chunks[chunk].length) advance();
|
||||
const step = Math.min(length, chunks[chunk].length - pos);
|
||||
pos += step;
|
||||
length -= step;
|
||||
}
|
||||
}
|
||||
const found = new Map();
|
||||
for (let index = 0; index <= last; index += 1) {
|
||||
let remaining = uint(2);
|
||||
const flags = byte();
|
||||
let width = flags & 1 ? 2 : 1;
|
||||
const runs = flags & 8 ? uint(2) : 0;
|
||||
const phoneticBytes = flags & 4 ? uint(4) : 0;
|
||||
let text = '';
|
||||
while (remaining > 0) {
|
||||
if (pos === chunks[chunk].length) {
|
||||
advance();
|
||||
width = byte() & 1 ? 2 : 1;
|
||||
}
|
||||
const chars = Math.min(remaining, Math.floor((chunks[chunk].length - pos) / width));
|
||||
requireValid(chars > 0);
|
||||
if (wanted.has(index) && text.length < 100) {
|
||||
const sample = chunks[chunk].subarray(pos, pos + Math.min(chars, 100 - text.length) * width);
|
||||
text += sample.toString(width === 2 ? 'utf16le' : 'latin1');
|
||||
}
|
||||
pos += chars * width;
|
||||
remaining -= chars;
|
||||
}
|
||||
skip(runs * 4 + phoneticBytes);
|
||||
if (wanted.has(index)) found.set(index, text);
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
function rkValue(bits) {
|
||||
let number;
|
||||
if (bits & 2) number = bits >> 2;
|
||||
else {
|
||||
const bytes = Buffer.alloc(8);
|
||||
bytes.writeInt32LE(bits & ~3, 4);
|
||||
number = bytes.readDoubleLE();
|
||||
}
|
||||
return bits & 1 ? number / 100 : number;
|
||||
}
|
||||
|
||||
async function excelRows(read) {
|
||||
const workbook = await read('Workbook', 'Book');
|
||||
let firstSheet;
|
||||
const sst = [];
|
||||
let inSst = false;
|
||||
for (const { type, body } of biffRecords(workbook)) {
|
||||
if (type === 0x0809) requireValid(body.readUInt16LE() === 0x0600);
|
||||
if (type === 0x002f) throw new Error('Encrypted BIFF workbook');
|
||||
if (type === 0x0085 && body[5] === 0 && firstSheet === undefined) firstSheet = body.readUInt32LE();
|
||||
inSst = type === 0x00fc || (inSst && type === 0x003c);
|
||||
if (inSst) sst.push(body);
|
||||
}
|
||||
requireValid(workbook.readUInt16LE(0) === 0x0809 && workbook.readUInt16LE(6) === 0x0005 && firstSheet > 0 && workbook.readUInt16LE(firstSheet) === 0x0809
|
||||
&& workbook.readUInt16LE(firstSheet + 6) === 0x0010);
|
||||
const grid = [];
|
||||
const wanted = new Set();
|
||||
function cell(row, column, value) {
|
||||
if (row >= ROW_LIMIT || column >= COL_LIMIT) return;
|
||||
(grid[row] ??= Array(COL_LIMIT).fill(''))[column] = value;
|
||||
}
|
||||
for (const { type, body } of biffRecords(workbook, firstSheet)) {
|
||||
if (![0x00fd, 0x0203, 0x027e, 0x00bd, 0x0205, 0x0006, 0x0204].includes(type)) continue;
|
||||
const row = body.readUInt16LE(0);
|
||||
const col = body.readUInt16LE(2);
|
||||
if (row >= ROW_LIMIT || col >= COL_LIMIT) continue;
|
||||
if (type === 0x00fd) {
|
||||
const index = body.readUInt32LE(6);
|
||||
wanted.add(index);
|
||||
cell(row, col, { index });
|
||||
} else if (type === 0x0203 || (type === 0x0006 && body.readUInt16LE(12) !== 0xffff)) {
|
||||
cell(row, col, body.readDoubleLE(6));
|
||||
} else if (type === 0x027e) {
|
||||
cell(row, col, rkValue(body.readInt32LE(6)));
|
||||
} else if (type === 0x00bd) {
|
||||
requireValid(body.length >= 12 && (body.length - 6) % 6 === 0);
|
||||
for (let offset = 4, column = col; offset < body.length - 2 && column < COL_LIMIT; offset += 6, column += 1) {
|
||||
cell(row, column, rkValue(body.readInt32LE(offset + 2)));
|
||||
}
|
||||
} else if (type === 0x0205 && body.length >= 8 && body[7] === 0) {
|
||||
cell(row, col, body[6] ? 'TRUE' : 'FALSE');
|
||||
} else if (type === 0x0204) {
|
||||
const width = body[8] & 1 ? 2 : 1;
|
||||
const end = 9 + body.readUInt16LE(6) * width;
|
||||
requireValid(end <= body.length);
|
||||
cell(row, col, body.toString(width === 2 ? 'utf16le' : 'latin1', 9, Math.min(end, 9 + width * 100)));
|
||||
}
|
||||
}
|
||||
const strings = sharedStrings(sst, wanted);
|
||||
return Array.from(grid, row => row?.map(value => value?.index === undefined ? value : strings.get(value.index)) ?? []);
|
||||
}
|
||||
|
||||
function pptRecord(data, offset) {
|
||||
const header = data.readUInt16LE(offset);
|
||||
const type = data.readUInt16LE(offset + 2);
|
||||
const start = offset + 8;
|
||||
const end = start + data.readUInt32LE(offset + 4);
|
||||
requireValid(end <= data.length);
|
||||
return { type, instance: header >>> 4, container: (header & 15) === 15, start, end };
|
||||
}
|
||||
|
||||
function* pptChildren(data, parent) {
|
||||
for (let pos = parent.start; pos < parent.end;) {
|
||||
const child = pptRecord(data, pos);
|
||||
requireValid(child.end <= parent.end);
|
||||
yield child;
|
||||
pos = child.end;
|
||||
}
|
||||
}
|
||||
|
||||
async function powerpointRows(read) {
|
||||
const current = await read('Current User');
|
||||
const data = await read('PowerPoint Document');
|
||||
requireValid(pptRecord(current, 0).type === 4086 && current.readUInt32LE(12) === 0xe391c05f);
|
||||
|
||||
// MS-PPT: later edits override earlier persist-directory entries.
|
||||
const offsets = new Map();
|
||||
let editOffset = current.readUInt32LE(16);
|
||||
let documentId;
|
||||
for (let edits = 0; editOffset; edits += 1) {
|
||||
const edit = pptRecord(data, editOffset);
|
||||
requireValid(edits < 256 && edit.type === 4085 && edit.end - edit.start >= 28);
|
||||
documentId ??= data.readUInt32LE(edit.start + 16);
|
||||
const directory = pptRecord(data, data.readUInt32LE(edit.start + 12));
|
||||
requireValid(directory.type === 6002);
|
||||
for (let pos = directory.start; pos < directory.end;) {
|
||||
const header = data.readUInt32LE(pos);
|
||||
const count = header >>> 20;
|
||||
const firstId = header & 0xfffff;
|
||||
pos += 4;
|
||||
requireValid(count > 0 && pos + count * 4 <= directory.end && offsets.size + count <= 100_000);
|
||||
for (let i = 0; i < count; i += 1, pos += 4) {
|
||||
if (!offsets.has(firstId + i)) offsets.set(firstId + i, data.readUInt32LE(pos));
|
||||
}
|
||||
}
|
||||
const previous = data.readUInt32LE(edit.start + 8);
|
||||
requireValid(previous < editOffset);
|
||||
editOffset = previous;
|
||||
}
|
||||
requireValid(offsets.has(documentId));
|
||||
const document = pptRecord(data, offsets.get(documentId));
|
||||
requireValid(document.type === 1000 && document.container);
|
||||
let slideId;
|
||||
const snippets = [];
|
||||
let remaining = TEXT_LIMIT;
|
||||
let records = 0;
|
||||
function collect(record) {
|
||||
if (record.type === 4000 || record.type === 4008) {
|
||||
const wide = record.type === 4000;
|
||||
const sample = data.subarray(record.start, Math.min(record.end, record.start + remaining * (wide ? 2 : 1)));
|
||||
const text = sample.toString(wide ? 'utf16le' : 'latin1');
|
||||
snippets.push(text);
|
||||
remaining -= Math.max(1, text.length);
|
||||
}
|
||||
}
|
||||
for (const list of pptChildren(data, document)) {
|
||||
if (list.type !== 4080 || list.instance !== 0) continue;
|
||||
for (const record of pptChildren(data, list)) {
|
||||
if (record.type === 1011) {
|
||||
if (slideId !== undefined) break;
|
||||
slideId = data.readUInt32LE(record.start);
|
||||
} else if (slideId !== undefined && remaining > 0) collect(record);
|
||||
}
|
||||
break;
|
||||
}
|
||||
requireValid(offsets.has(slideId));
|
||||
const slide = pptRecord(data, offsets.get(slideId));
|
||||
requireValid(slide.type === 1006 && slide.container);
|
||||
function collectFromShapes(parent, depth) {
|
||||
requireValid(depth < 32);
|
||||
for (const record of pptChildren(data, parent)) {
|
||||
requireValid(++records <= RECORD_LIMIT);
|
||||
if (remaining <= 0) return;
|
||||
if (record.container || record.type === 0xf00d) collectFromShapes(record, depth + 1);
|
||||
else collect(record);
|
||||
}
|
||||
}
|
||||
if (remaining > 0) collectFromShapes(slide, 0);
|
||||
return textRows(snippets.join('\r'));
|
||||
}
|
||||
|
||||
export async function legacyOfficeThumbnailRows(kind, data) {
|
||||
// Bound the bytes visited even if damaged allocation tables refer to the same sector repeatedly.
|
||||
let bytesLeft = STREAM_LIMIT * 3;
|
||||
const compound = await openCompoundFile((offset, length) => {
|
||||
bytesLeft -= length;
|
||||
requireValid(bytesLeft >= 0);
|
||||
return data.subarray(offset, offset + length);
|
||||
}, data.length);
|
||||
const read = async (...names) => {
|
||||
const name = names.find(candidate => compound.streams.has(candidate));
|
||||
requireValid(name !== undefined);
|
||||
const bytes = await compound.read(name, STREAM_LIMIT);
|
||||
requireValid(bytes?.length === compound.streams.get(name).size && bytes.length > 0);
|
||||
return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
||||
};
|
||||
const render = { doc: wordRows, xls: excelRows, ppt: powerpointRows }[kind];
|
||||
const rows = await render(read);
|
||||
requireValid(rows.some(row => row.some(value => value !== '' && value !== undefined)));
|
||||
return rows;
|
||||
}
|
||||
@@ -1,11 +1,12 @@
|
||||
'use strict';
|
||||
|
||||
const { createHash } = require('node:crypto');
|
||||
const { isIP } = require('node:net');
|
||||
const { locationFromHeaders, hasCoordinates } = require('../../models/lib/geoHeaders');
|
||||
const { normaliseAddress } = require('../../models/lib/ipAddress');
|
||||
const { resolveClientKey } = require('./loginAttemptThrottle');
|
||||
|
||||
function personalApiTokenSource(req, forwardedCount) {
|
||||
function resolveAuditOrigin(req, forwardedCount) {
|
||||
const raw = resolveClientKey({ headers: req.headers, socketAddress: req.socket?.remoteAddress, forwardedCount });
|
||||
const ip = isIP(raw) ? normaliseAddress(raw) : '';
|
||||
const incoming = forwardedCount > 0 ? locationFromHeaders(req.headers) : null;
|
||||
@@ -18,4 +19,10 @@ function personalApiTokenSource(req, forwardedCount) {
|
||||
return { ip, location };
|
||||
}
|
||||
|
||||
module.exports = { personalApiTokenSource };
|
||||
function auditUsageId(tokenId, ip, country, boardId, action, status) {
|
||||
// Preserve the grouping key for records already in the usage collection.
|
||||
const fields = JSON.stringify([tokenId, ip, country || '', boardId, action, status]);
|
||||
return createHash('sha256').update(fields).digest('hex');
|
||||
}
|
||||
|
||||
module.exports = { resolveAuditOrigin, auditUsageId };
|
||||
@@ -8,7 +8,7 @@ import { ReactiveCache } from '/imports/reactiveCache';
|
||||
|
||||
const { personalApiRequest } = require('/models/lib/personalApiTokenScope');
|
||||
const { memberReadsWholeBoard } = require('/models/lib/boardReadAccess');
|
||||
const { personalApiTokenSource } = require('/server/lib/personalApiTokenSource');
|
||||
const { resolveAuditOrigin, auditUsageId } = require('/server/lib/personalApiAudit');
|
||||
const { csvLine } = require('/models/lib/adminCsvExport');
|
||||
const { classifyAddress } = require('/models/lib/ipAddress');
|
||||
|
||||
@@ -17,13 +17,9 @@ const Tokens = new Mongo.Collection('personalApiTokens', { defineMutationMethods
|
||||
const Usage = new Mongo.Collection('personalApiTokenUsage', { defineMutationMethods: false });
|
||||
const DAY = 86400000;
|
||||
const DEFAULT_DAYS = 90;
|
||||
// CodeQL alert #621. WeKan issues each bearer token from 32 bytes of
|
||||
// cryptographic randomness. SHA-256 supplies an indexed lookup key without
|
||||
// storing the bearer secret. Recovering a token from its digest requires
|
||||
// guessing a 256-bit random value, so a password work factor is unnecessary.
|
||||
// This helper also hashes audit fields to make a stable grouping key.
|
||||
// codeql[js/insufficient-password-hash]
|
||||
const hash = value => createHash('sha256').update(value).digest('hex');
|
||||
// Generated bearer tokens contain 256 random bits. The digest is the
|
||||
// indexed lookup key and must stay compatible with already issued tokens.
|
||||
const tokenDigest = secret => createHash('sha256').update(secret).digest('hex');
|
||||
const publicFields = {
|
||||
_id: 0, publicId: 1, userId: 1, name: 1, scope: 1, boards: 1, createdAt: 1, expiresAt: 1, lastUsed: 1, revokedAt: 1,
|
||||
};
|
||||
@@ -50,8 +46,8 @@ function activeToken(token, config, at) {
|
||||
|
||||
async function recordUsage(token, { action, boardId }, req, status, startedAt) {
|
||||
const endedAt = new Date();
|
||||
const { ip, location } = personalApiTokenSource(req, Number(process.env.HTTP_FORWARDED_COUNT || 0));
|
||||
const id = hash(JSON.stringify([token._id, ip, location.country || '', boardId, action, status]));
|
||||
const { ip, location } = resolveAuditOrigin(req, Number(process.env.HTTP_FORWARDED_COUNT || 0));
|
||||
const id = auditUsageId(token._id, ip, location.country, boardId, action, status);
|
||||
await Usage.rawCollection().updateOne({ _id: id }, {
|
||||
$setOnInsert: { tokenId: token.publicId, userId: token.userId, tokenName: token.name, ip, boardId, action, status },
|
||||
$set: { location },
|
||||
@@ -68,7 +64,7 @@ export async function authenticatePersonalApiToken(req, res, next) {
|
||||
const config = await policy();
|
||||
if (config.enabled && /^wkp_[a-f0-9]{64}$/.test(req.authToken) &&
|
||||
/^Bearer\s+wkp_[a-f0-9]{64}$/i.test(req.headers.authorization || '')) {
|
||||
const token = await Tokens.findOneAsync(hash(req.authToken));
|
||||
const token = await Tokens.findOneAsync(tokenDigest(req.authToken));
|
||||
if (token && activeToken(token, config, startedAt)) {
|
||||
const user = await activeUserById(token.userId, 'personal-api-token', req);
|
||||
const permitted = personalApiRequest(token, req.method, req.url, req.body);
|
||||
@@ -129,7 +125,7 @@ Meteor.methods({
|
||||
}
|
||||
const secret = 'wkp_' + randomBytes(32).toString('hex');
|
||||
await Tokens.insertAsync({
|
||||
_id: hash(secret), userId: this.userId, name, createdAt,
|
||||
_id: tokenDigest(secret), userId: this.userId, name, createdAt,
|
||||
expiresAt: input.expiresAt, scope: input.scope, boards,
|
||||
publicId: randomBytes(16).toString('hex'),
|
||||
});
|
||||
|
||||
+4
-4
@@ -19,7 +19,7 @@
|
||||
# base: core24 (not core26) · no build-base: devel · grade: stable
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
name: wekan
|
||||
version: '13.44'
|
||||
version: '13.45'
|
||||
base: core24
|
||||
confinement: strict
|
||||
grade: stable
|
||||
@@ -703,18 +703,18 @@ parts:
|
||||
armhf) WEKAN_ARCH="armhf" ;;
|
||||
*) echo "Unsupported architecture: ${CRAFT_ARCH_BUILD_FOR}"; exit 1 ;;
|
||||
esac
|
||||
WEKAN_ZIP="wekan-13.44-${WEKAN_ARCH}.zip"
|
||||
WEKAN_ZIP="wekan-13.45-${WEKAN_ARCH}.zip"
|
||||
echo "Cleaning environment first"
|
||||
rm -rf .build
|
||||
mkdir .build
|
||||
cd .build
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.44/wekan-13.44-amd64.zip
|
||||
#wget https://github.com/wekan/wekan/releases/download/v13.45/wekan-13.45-amd64.zip
|
||||
# Retry: a release asset can 404 for a short while right after it is
|
||||
# uploaded (CDN/propagation lag), and a plain wget treated that as
|
||||
# fatal. --retry-on-http-error covers the 404/5xx window; a genuinely
|
||||
# missing bundle still fails after the tries are spent.
|
||||
wget --tries=20 --waitretry=20 --retry-on-http-error=404,403,500,502,503 \
|
||||
"https://github.com/wekan/wekan/releases/download/v13.44/${WEKAN_ZIP}"
|
||||
"https://github.com/wekan/wekan/releases/download/v13.45/${WEKAN_ZIP}"
|
||||
unzip "${WEKAN_ZIP}"
|
||||
python3 ../releases/check-telemetry.py --bundle bundle
|
||||
rm "${WEKAN_ZIP}"
|
||||
|
||||
@@ -7,6 +7,7 @@ const assert = require('node:assert/strict');
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const sharp = require('sharp');
|
||||
const { drawing, sampleDxf, sampleDoc, sampleXls, samplePpt } = require('./lib/documentThumbnailFixtures.cjs');
|
||||
const { isThumbnailPath, canThumbnail, documentThumbnailKind, thumbnailUrl, THUMBNAIL_EDGE } = require('../models/lib/attachmentThumbnail.js');
|
||||
|
||||
const ROOT = path.join(__dirname, '..');
|
||||
@@ -41,7 +42,14 @@ async function main() {
|
||||
assert.equal(documentThumbnailKind({ type: 'application/pdf' }), 'pdf');
|
||||
assert.equal(documentThumbnailKind({ name: 'Report.DOCX', type: 'application/zip' }), 'docx');
|
||||
assert.equal(documentThumbnailKind({ name: 'report.pdf', type: 'text/html' }), null);
|
||||
assert.equal(documentThumbnailKind({ name: 'report.doc' }), null);
|
||||
assert.equal(documentThumbnailKind({ name: 'report.doc' }), 'doc');
|
||||
assert.equal(documentThumbnailKind({ type: 'application/vnd.ms-powerpoint' }), 'ppt');
|
||||
assert.equal(documentThumbnailKind({ name: 'order.XLS', type: 'application/x-ole-storage' }), 'xls');
|
||||
assert.equal(documentThumbnailKind({ type: 'application/dxf' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ type: 'image/vnd.dxf', isImage: true }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.dxf', type: 'text/plain' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.DXF', type: 'application/octet-stream' }), 'dxf');
|
||||
assert.equal(documentThumbnailKind({ name: 'cut.dwg', type: 'application/octet-stream' }), null);
|
||||
|
||||
// Conversion: a WebP no larger than THUMBNAIL_EDGE, never enlarged.
|
||||
const lib = await loadImageLib();
|
||||
@@ -93,6 +101,54 @@ async function main() {
|
||||
const stats = await sharp(image).stats();
|
||||
assert.ok(stats.channels.some(c => c.min < 128), `${kind} thumbnail contains document content`);
|
||||
}
|
||||
const { legacyOfficeThumbnailRows } = await import('../server/lib/legacyOfficeThumbnail.js');
|
||||
const { dxfThumbnailPaths } = await import('../server/lib/dxfThumbnail.js');
|
||||
const [, , , closingEdge, firstHole, secondHole] = dxfThumbnailPaths(sampleDxf());
|
||||
assert.deepEqual(closingEdge, [[0, 50], [0, 0]]);
|
||||
assert.deepEqual(firstHole[0], [33, 25]);
|
||||
assert.deepEqual(secondHole[0], [83, 25]);
|
||||
const curves = dxfThumbnailPaths(drawing(
|
||||
[0, 'LWPOLYLINE', 10, 0, 20, 0, 42, 1, 10, 10, 20, 0],
|
||||
[0, 'ARC', 10, 0, 20, 0, 40, 10, 50, 350, 51, 10],
|
||||
[0, 'ELLIPSE', 10, 0, 20, 0, 11, 10, 21, 0, 40, 0.5],
|
||||
[0, 'SPLINE', 10, 0, 20, 0, 10, 1, 20, 2, 10, 3, 20, 4],
|
||||
[0, 'POLYLINE', 70, 1], [0, 'VERTEX', 10, 0, 20, 0],
|
||||
[0, 'VERTEX', 10, 1, 20, 0], [0, 'SEQEND'],
|
||||
[0, 'LINE', 67, 1, 10, 0, 20, 0, 11, 1000, 21, 1000],
|
||||
));
|
||||
assert.equal(curves.length, 6);
|
||||
assert.ok(Math.abs(curves[0][16][1] + 5) < 1e-8, 'a bulge produces a semicircle');
|
||||
assert.deepEqual(curves[3], [[0, 0], [1, 2], [3, 4]]);
|
||||
const examples = [
|
||||
['doc', sampleDoc(), [['Workshop order'], ['Part 100']]],
|
||||
['xls', sampleXls(), [['Part Å-100', 42, '', '', '', '']]],
|
||||
['ppt', samplePpt(), [['First slide'], ['Workshop']]],
|
||||
];
|
||||
for (const [kind, input, rows] of examples) {
|
||||
assert.deepEqual(await legacyOfficeThumbnailRows(kind, input), rows);
|
||||
await assert.rejects(() => renderDocumentThumbnail(kind, Buffer.from('not an Office file'), source));
|
||||
}
|
||||
for (const [kind, input] of [...examples, ['dxf', sampleDxf()]]) {
|
||||
const image = await renderDocumentThumbnail(kind, input, source);
|
||||
const info = await sharp(image).metadata();
|
||||
assert.equal(info.format, 'webp', kind);
|
||||
assert.deepEqual([info.width, info.height], [512, kind === 'xls' ? 320 : 512]);
|
||||
assert.ok((await sharp(image).stats()).channels[0].min < 100, kind);
|
||||
if (kind === 'dxf') {
|
||||
const { data: pixels, info: { channels, width } } = await sharp(image).raw().toBuffer({ resolveWithObject: true });
|
||||
const red = (x, y) => pixels[(y * width + x) * channels];
|
||||
assert.ok(red(16, 256) < 128, 'the rectangle outline is visible');
|
||||
assert.ok(red(174, 256) < 128 && red(414, 256) < 128, 'both hole outlines are visible');
|
||||
assert.ok(red(136, 256) > 240 && red(376, 256) > 240, 'the holes are white inside');
|
||||
}
|
||||
}
|
||||
await assert.rejects(() => renderDocumentThumbnail('doc', sampleDoc({ encrypted: true }), source));
|
||||
await assert.rejects(() => renderDocumentThumbnail('xls', sampleXls({ encrypted: true }), source));
|
||||
for (const bad of [Buffer.from('AutoCAD Binary DXF\r\n\0'), drawing([0, 'TEXT', 1, 'nothing']),
|
||||
drawing([0, 'LINE', 10, 'NaN', 20, 0, 11, 2, 21, 3]), Buffer.alloc(2 * 1024 * 1024 + 1, 32)]) {
|
||||
await assert.rejects(() => renderDocumentThumbnail('dxf', bad, source));
|
||||
}
|
||||
|
||||
await assert.rejects(() => renderDocumentThumbnail('pdf', Buffer.from('not a PDF'), source));
|
||||
await assert.rejects(() => renderDocumentThumbnail('pdf', Buffer.alloc(DOCUMENT_MAX_BYTES + 1), source),
|
||||
/thumbnail conversion limit/);
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
'use strict';
|
||||
|
||||
const { writeCompoundFile } = require('./outlookMsgFixture.cjs');
|
||||
|
||||
const drawing = (...entities) => Buffer.from(['0', 'SECTION', '2', 'ENTITIES',
|
||||
...entities.flat(), '0', 'ENDSEC', '0', 'EOF', ''].join('\r\n'));
|
||||
|
||||
function sampleDxf() {
|
||||
const rectangle = [0, 'LWPOLYLINE', 90, 4, 70, 1, 10, 0, 20, 0,
|
||||
10, 100, 20, 0, 10, 100, 20, 50, 10, 0, 20, 50];
|
||||
const hole = x => [0, 'CIRCLE', 10, x, 20, 25, 40, 8];
|
||||
return drawing(rectangle, hole(25), hole(75));
|
||||
}
|
||||
|
||||
function sampleDoc({ encrypted = false } = {}) {
|
||||
const word = Buffer.alloc(8192);
|
||||
const text = Buffer.from('Workshop order\rPart 100', 'utf16le');
|
||||
word.writeUInt16LE(0xa5ec, 0);
|
||||
word.writeUInt16LE(0x00c1, 2);
|
||||
word.writeUInt16LE(0x0200 | (encrypted ? 0x0100 : 0), 10);
|
||||
word.writeUInt16LE(14, 32);
|
||||
word.writeUInt16LE(22, 62);
|
||||
word.writeUInt32LE(text.length / 2, 76);
|
||||
word.writeUInt16LE(93, 152);
|
||||
word.writeUInt32LE(21, 0x1a6);
|
||||
text.copy(word, 4096);
|
||||
const table = Buffer.alloc(21);
|
||||
table[0] = 2;
|
||||
table.writeUInt32LE(16, 1);
|
||||
table.writeUInt32LE(text.length / 2, 9);
|
||||
table.writeUInt32LE(4096, 15);
|
||||
return Buffer.from(writeCompoundFile({ WordDocument: word, '1Table': table }));
|
||||
}
|
||||
|
||||
function biffRecord(type, body = Buffer.alloc(0)) {
|
||||
const header = Buffer.alloc(4);
|
||||
header.writeUInt16LE(type);
|
||||
header.writeUInt16LE(body.length, 2);
|
||||
return Buffer.concat([header, body]);
|
||||
}
|
||||
|
||||
function biffBof(type) {
|
||||
const body = Buffer.alloc(16);
|
||||
body.writeUInt16LE(0x0600);
|
||||
body.writeUInt16LE(type, 2);
|
||||
return biffRecord(0x0809, body);
|
||||
}
|
||||
|
||||
function sampleXls({ encrypted = false } = {}) {
|
||||
const descriptor = Buffer.alloc(13);
|
||||
descriptor[6] = 5;
|
||||
descriptor.write('Order', 8);
|
||||
const header = Buffer.alloc(11);
|
||||
header.writeUInt32LE(1, 0);
|
||||
header.writeUInt32LE(1, 4);
|
||||
header.writeUInt16LE(10, 8);
|
||||
const globals = () => [
|
||||
biffBof(5), ...(encrypted ? [biffRecord(0x002f, Buffer.alloc(4))] : []),
|
||||
biffRecord(0x0085, descriptor), biffRecord(0x00fc, Buffer.concat([header, Buffer.from('Part ')])),
|
||||
biffRecord(0x003c, Buffer.concat([Buffer.from([1]), Buffer.from('Å-100', 'utf16le')])),
|
||||
biffRecord(0x000a),
|
||||
];
|
||||
descriptor.writeUInt32LE(globals().reduce((length, record) => length + record.length, 0));
|
||||
const quantity = Buffer.alloc(10);
|
||||
quantity.writeUInt16LE(1, 2);
|
||||
quantity.writeInt32LE((42 << 2) | 2, 6);
|
||||
const workbook = Buffer.concat([
|
||||
...globals(), biffBof(0x10), biffRecord(0x00fd, Buffer.alloc(10)),
|
||||
biffRecord(0x027e, quantity), biffRecord(0x000a),
|
||||
]);
|
||||
return Buffer.from(writeCompoundFile({ Workbook: workbook }));
|
||||
}
|
||||
|
||||
function pptRecord(type, body, version = 0, instance = 0) {
|
||||
const header = Buffer.alloc(8);
|
||||
header.writeUInt16LE((instance << 4) | version);
|
||||
header.writeUInt16LE(type, 2);
|
||||
header.writeUInt32LE(body.length, 4);
|
||||
return Buffer.concat([header, body]);
|
||||
}
|
||||
|
||||
function samplePpt() {
|
||||
const persist = id => {
|
||||
const body = Buffer.alloc(20);
|
||||
body.writeUInt32LE(id);
|
||||
return pptRecord(1011, body);
|
||||
};
|
||||
const text = value => pptRecord(4000, Buffer.from(value, 'utf16le'));
|
||||
const list = pptRecord(4080, Buffer.concat([
|
||||
persist(2), text('First slide'), persist(3), text('Second slide'),
|
||||
]), 15);
|
||||
const document = pptRecord(1000, list, 15);
|
||||
const shapeText = pptRecord(0xf00d, text('Workshop'), 0);
|
||||
const slide = pptRecord(1006, shapeText, 15);
|
||||
const directory = Buffer.alloc(12);
|
||||
directory.writeUInt32LE((2 << 20) | 1);
|
||||
directory.writeUInt32LE(document.length, 8);
|
||||
const persistDirectory = pptRecord(6002, directory);
|
||||
const edit = Buffer.alloc(28);
|
||||
edit.writeUInt32LE(document.length + slide.length, 12);
|
||||
edit.writeUInt32LE(1, 16);
|
||||
const currentUser = Buffer.alloc(24);
|
||||
currentUser.writeUInt32LE(0xe391c05f, 4);
|
||||
currentUser.writeUInt32LE(document.length + slide.length + persistDirectory.length, 8);
|
||||
return Buffer.from(writeCompoundFile({
|
||||
'Current User': pptRecord(4086, currentUser),
|
||||
'PowerPoint Document': Buffer.concat([document, slide, persistDirectory, pptRecord(4085, edit)]),
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = { drawing, sampleDxf, sampleDoc, sampleXls, samplePpt };
|
||||
@@ -74,6 +74,19 @@ function checkHighlightRules(clean, label) {
|
||||
}
|
||||
|
||||
async function main() {
|
||||
// GHSA-hrxw-jjj6-2g2j: every locked copy must include the template sanitizer fix.
|
||||
const { packages } = JSON.parse(read('package-lock.json'));
|
||||
const isPatched = version => {
|
||||
if (!/^\d+\.\d+\.\d+$/.test(version)) return false;
|
||||
const [major, minor] = version.split('.').map(Number);
|
||||
return major > 3 || (major === 3 && minor >= 5);
|
||||
};
|
||||
assert.ok(isPatched(packages['node_modules/dompurify'].version));
|
||||
for (const [location, { version }] of Object.entries(packages)) {
|
||||
if (location.endsWith('/node_modules/dompurify')) assert.ok(isPatched(version), location);
|
||||
}
|
||||
assert.ok(isPatched(createDOMPurify.version), 'installed DOMPurify is patched');
|
||||
|
||||
const window = new JSDOM('').window;
|
||||
|
||||
const { secureSanitize, getSecureDOMPurifyConfig } = await import('../packages/markdown/src/secureDOMPurify.js');
|
||||
|
||||
@@ -20,7 +20,7 @@ test('personal API tokens constrain methods, board IDs and fields independently'
|
||||
});
|
||||
|
||||
test('personal API audit records IPv4 and IPv6 and accepts geo data only behind the proxy', () => {
|
||||
const { personalApiTokenSource } = require('../server/lib/personalApiTokenSource');
|
||||
const { resolveAuditOrigin } = require('../server/lib/personalApiAudit');
|
||||
const req = {
|
||||
socket: { remoteAddress: '::ffff:192.0.2.9' },
|
||||
headers: {
|
||||
@@ -30,7 +30,15 @@ test('personal API audit records IPv4 and IPv6 and accepts geo data only behind
|
||||
'x-geoip-longitude': '24.94',
|
||||
},
|
||||
};
|
||||
assert.deepEqual(personalApiTokenSource(req, 0), { ip: '192.0.2.9', location: {} });
|
||||
assert.deepEqual(personalApiTokenSource(req, 1),
|
||||
assert.deepEqual(resolveAuditOrigin(req, 0), { ip: '192.0.2.9', location: {} });
|
||||
assert.deepEqual(resolveAuditOrigin(req, 1),
|
||||
{ ip: '2001:db8::1', location: { country: 'FI', latitude: 60.17, longitude: 24.94 } });
|
||||
});
|
||||
|
||||
test('audit grouping preserves stored usage keys and distinguishes requests', () => {
|
||||
const { auditUsageId } = require('../server/lib/personalApiAudit');
|
||||
const previous = require('node:crypto').createHash('sha256')
|
||||
.update(JSON.stringify(['digest', '192.0.2.9', '', 'board', 'Card', 200])).digest('hex');
|
||||
assert.equal(auditUsageId('digest', '192.0.2.9', undefined, 'board', 'Card', 200), previous);
|
||||
assert.notEqual(auditUsageId('digest', '192.0.2.9', undefined, 'board', 'Card', 403), previous);
|
||||
});
|
||||
@@ -187,3 +187,46 @@ test('the card displays a private PDF thumbnail and falls back for a damaged doc
|
||||
await expect(page.locator('img.attachment-document-thumbnail')).toHaveCount(0);
|
||||
} finally { cleanups.forEach(cleanup => cleanup()); }
|
||||
});
|
||||
|
||||
test('the card displays DXF and legacy Office thumbnails and keeps extension fallbacks', async ({
|
||||
boardPage: page, board, baseURL,
|
||||
}) => {
|
||||
const { sampleDxf, sampleDoc, sampleXls, samplePpt } = require('../../lib/documentThumbnailFixtures.cjs');
|
||||
const id = `thumbcadlegacy${Date.now()}`;
|
||||
const files = [
|
||||
['part.dxf', 'image/vnd.dxf', sampleDxf(), [512, 512]],
|
||||
['order.doc', 'application/msword', sampleDoc(), [512, 512]],
|
||||
['order.xls', 'application/vnd.ms-excel', sampleXls(), [512, 320]],
|
||||
['brief.ppt', 'application/vnd.ms-powerpoint', samplePpt(), [512, 512]],
|
||||
['binary.dxf', 'application/dxf', Buffer.from('AutoCAD Binary DXF\r\n\0')],
|
||||
['broken.xls', 'application/vnd.ms-excel', Buffer.from('broken')],
|
||||
];
|
||||
const cleanups = files.map(([name, type, data], index) => seed(board, id + index, name, type, data));
|
||||
try {
|
||||
await openBoard(page, board.boardId, board.slug);
|
||||
await page.locator('.minicard', { hasText: 'Alpha Card' }).first().locator('.minicard-title').click();
|
||||
for (const [name, , , dimensions] of files) {
|
||||
if (dimensions) {
|
||||
const image = page.locator(`img.attachment-document-thumbnail[title="${name}"]`);
|
||||
await expect(image).toBeVisible();
|
||||
await expect.poll(() => image.evaluate(img => [img.naturalWidth, img.naturalHeight])).toEqual(dimensions);
|
||||
} else {
|
||||
const tile = page.locator('.attachment-item', { hasText: name }).locator('.attachment-document-fallback');
|
||||
await expect(tile).toBeVisible();
|
||||
await expect(tile).toHaveText(name.split('.').pop());
|
||||
}
|
||||
}
|
||||
const anonymous = await playwrightRequest.newContext({ baseURL });
|
||||
try {
|
||||
for (const index of [0, 2]) {
|
||||
const response = await anonymous.get(`/cdn/storage/attachments/${id}${index}/thumbnail`);
|
||||
expect(response.status()).toBe(403);
|
||||
}
|
||||
} finally { await anonymous.dispose(); }
|
||||
|
||||
db.updateOne('boards', { _id: board.boardId }, { $set: { allowsAttachmentPreviewsOnCard: false } });
|
||||
await openBoard(page, board.boardId, board.slug);
|
||||
await page.locator('.minicard', { hasText: 'Alpha Card' }).first().locator('.minicard-title').click();
|
||||
await expect(page.locator('img.attachment-document-thumbnail')).toHaveCount(0);
|
||||
} finally { cleanups.forEach(cleanup => cleanup()); }
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
'use strict';
|
||||
|
||||
const { createHash } = require('node:crypto');
|
||||
const { putWithRevision } = require('../helpers/restRevision');
|
||||
|
||||
const { test, expect } = require('../fixtures');
|
||||
@@ -54,9 +55,14 @@ test('#6976: personal API tokens are opt-in, scoped, private and auditable', asy
|
||||
expect((await putWithRevision(request, cardUrl, { ...auth(writeToken), data: { title: 'Token edit' } })).status()).toBe(200);
|
||||
expect(db.findOne('cards', { _id: card._id }).title).toBe('Token edit');
|
||||
|
||||
await expect.poll(() => db.find('personalApiTokenUsage', { userId: user.id }).length).toBe(2);
|
||||
// The revision-aware edit reads the card before writing it.
|
||||
await expect.poll(() => db.find('personalApiTokenUsage', { userId: user.id })
|
||||
.map(row => row.action).sort()).toEqual(['Board', 'Card', 'Edit card']);
|
||||
const stored = db.find('personalApiTokens', { userId: user.id });
|
||||
expect(stored).toHaveLength(2);
|
||||
// Keep the lookup ID compatible with tokens already issued before this change.
|
||||
const expectedId = createHash('sha256').update(readToken).digest('hex');
|
||||
expect(stored.find(token => token.scope === 'read')._id).toBe(expectedId);
|
||||
expect(JSON.stringify(stored)).not.toContain(readToken);
|
||||
expect(JSON.stringify(stored)).not.toContain(writeToken);
|
||||
const data = await page.evaluate(() => Meteor.callAsync('personalApiTokens.list'));
|
||||
|
||||
Reference in new issue
Block a user