mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 10:48:06 -05:00
v11.26
8
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
b5a36bd3af |
Make hostname examples exact in translation coverage
Replace dynamic regular expressions for the Marathi tenant hostname examples with literal containment checks, so dots cannot act as wildcards. Add positive, negative, and repository-wide HostnameBleed coverage for CodeQL alerts #435 and #436, and record why this test-only finding has no runtime Problems event.\n\nThanks to GitHub CodeQL code scanning and xet7 ! |
||
|
|
18bcbdd0d4 |
Bind search pagination sessions to their users
Require both pagination publications to authenticate the subscriber and load only a search session owned by that same user. Record attributable logged-out probes as SessionBleed without letting logging affect the denial. Thanks to crypto-nidh and xet7 ! |
||
|
|
3f69df3170 |
Require authentication before importing boards.
Reject anonymous importBoard and importScoped DDP calls before argument parsing, feature checks, parsers or direct database writers can run. Carry the authenticated method user explicitly into scoped imports and add source-level plus logged-out browser regression coverage for ImportBleed. Thanks to Char0n1507 and xet7 ! |
||
|
|
ed4b8cd648 |
RouteBleed: remove incomplete route-pattern escaping.
CodeQL alert #434 found that boardExportScope escaped only forward slashes before interpolating an export path into a RegExp. Replace the pattern with an exact route-literal inclusion check, so there is nothing to escape and metacharacters cannot change the match. Add positive and negative cases with backslashes and regex metacharacters, reject the reported partial-escape shape across tracked JavaScript, and remove a second partial dynamic pattern from release bundle coverage. This was test-only code with no runtime request path, so there is no attributable attempt for Admin Panel Problems. Thanks to GitHub CodeQL code scanning and xet7 ! |
||
|
|
3d08c65bb2 |
Admin Panel Problems: one summary row per problem, with who tried and how often.
A guard on a path an attacker controls fires as fast as they can send. One
document per event meant the database grew with the attack, the Problems page
became a scroll of near-identical lines, and the one event that mattered was
buried under ten thousand that did not. The admin's question is never "list
every attempt" - it is what is happening, how much, since when, and who.
So each problem is ONE row that accumulates:
count how many times this problem has happened
firstAt … at the window it happened in
actors who, each with their own count:
username1 25, 100.100.100.100 30
username/ip the most recent occurrence
WHAT MAKES TWO EVENTS THE SAME PROBLEM is the whole design. Identity is the KIND
of thing that happened - stream, bleed, category, action, source, severity, CWE,
and the database stream's own type/db/kind. The actor is NOT part of it: a
username or an address in the key gives a row per attacker per attempt, which is
the cost being removed.
A USERNAME AND AN ADDRESS ARE TALLIED SEPARATELY, not as a pair. They answer
different questions - which account, and where from - and an unauthenticated
attempt has an address and no name. Pairing them would split one attacker across
a line per address and answer neither.
THE TALLY IS CAPPED at 50 actors, with the rest counted in actorsOverflow.
Otherwise an attacker rotating addresses grows the row with the attack and
reintroduces the same bug one level down - and "and 9,412 others" is itself the
signal that the source is spread rather than single. The cap needs to know
whether an actor is new to the row, so the row's actor keys are cached per
process: reading it on every attempt would double the database work of the thing
being made cheap, and under attack the same few actors repeat.
All three loggers share the fold (server/lib/eventLogFold.js) - a slow query in
a loop and a test failing on every run repeat just as a guard under attack does.
Still fire-and-forget and still unable to throw into the caller.
EXISTING PER-EVENT ROWS ARE FOLDED IN PLACE at startup, in batches, in JS so it
behaves the same on FerretDB as on MongoDB, and idempotently - a row with firstAt
is already a summary. Nothing is lost that the summary does not carry: counts are
summed, the earliest becomes firstAt, the latest becomes at, and the latest
occurrence's actor and detail are what the row keeps.
AND A COVERAGE CHECK, as asked: tests/hallOfFameProblemsCoverage.test.cjs
requires every hall-of-fame vulnerability to be keyed, deliberate (with the
reason, as HashBleed is), or pending. 30 of 66 are keyed; the other 35 predate
the rule and are listed as pending rather than judged here, because deciding
whether a given fix has anything to detect means reading that fix and claiming
otherwise would be worse than the gap. The pending list may shrink and may never
grow, so a NEW vulnerability without a key fails.
It found one real fault immediately: the catalog said OidcBleed and the site says
OIDCBleed, so attempts were grouping under a name nobody could look up.
Thanks to xet7 !
|
||
|
|
eb47e04657 |
Tests: ask whether a fixed mistake is anywhere ELSE, and close two gaps it found.
Every entry in https://wekan.fi/hall-of-fame/ has a suite pinning the place it was found. None of them could answer the other half of the question: is the same MISTAKE somewhere else - in WeKan, or in the FerretDB fork WeKan ships as its default database? A per-site regression test knows one file, and the next occurrence is written months later by somebody who never read the advisory. tests/fixedVulnerabilityClasses.test.cjs asks it as a CLASS, over the whole tree and over .tools/FerretDB when the clone is there (and saying it skipped those checks when it is not, rather than passing quietly): ZipBleed an archive entry naming its own destination path, without a containment check - and only for real archive readers, since a readdir entry name is one component and can escape nothing WhereBleed a client-supplied selector carrying operators that execute JavaScript TransitBleed rejectUnauthorized: false, NODE_TLS_REJECT_UNAUTHORIZED, and Go's InsecureSkipVerify in the FerretDB fork SourceBleed eval() / new Function() on the server MimeBleed an SVG served inline by a route that neither sanitizes it nor forces a download RandomBleed a secret from Math.random(), and random bytes folded onto an alphabet with a bare % - CWE-1204 modulo bias Comments and string literals are stripped before matching, or the advisory notes explaining a fix would trip the check enforcing it. Allowed occurrences are listed with the reason they are allowed. Each check was confirmed to FAIL on the mistake by writing one into the tree and watching it fire; both probes were removed. It found one straight away. models/lib/mongoSelectorSafety.js rejected `$where` and nothing else - but `$where` stopped being the only way a FIND filter runs JavaScript in MongoDB 4.4, which takes an aggregation expression inside a find filter, and `$expr: { $function: { body, args, lang } }` there runs a JavaScript body through the same client-supplied selector. `$accumulator` is the same again. Both are rejected now, the helper is named for what it tests (hasServerSideJs, with hasWhere as the alias every caller and the advisory use), and a cyclic selector cannot spin it - an infinite recursion inside a security check is a denial of service of its own. tests/mongoSelectorSafety.test.cjs gains those, plus the negatives that keep it usable: a field literally called `function`, and `$expr` doing ordinary comparison, are both fine. randombleed moves from RECORDED to GUARDED in tests/securityRegressionCoverage. test.cjs, and its gap count from 25 to 24: the rejection sampling CWE-1204 was about is now held everywhere rather than in one file. And one release entry had shipped with no test at all - the only one since v10.80 that is not a translation update. tests/databaseProblemsFixes.test.cjs covers it: the default-swimlane self-heal calling the synchronous upsert Meteor 3 removed (and the getter that starts the async one without awaiting it, which must handle its own rejection or a self-heal failure takes the process with it), List.move() inserting a list with no title and getting an error from the error formatter rather than from the validator, and the two classifier rules that stop either reading as "unknown / unclassified" in Admin Panel / Problems - on every database WeKan runs on, and without swallowing an ordinary network error. Coverage checked, not assumed: all 60 published vulnerabilities are named by a suite, and every one of those suites carries negative assertions as well as positive ones. New suites need no registration - build.sh's test run calls tests/run-node-suites.cjs, which DISCOVERS every tests/*.test.cjs - so all three files here are in the "Run WeKan's own tests" options already. Verified by running the new suites and the whole node suite (380 suites, 0 failed). Thanks to xet7 ! |
||
|
|
d577f07700 |
Canary tokens: who tried to override permissions, and from where.
The security event log said what a guard DID - a request blocked, a filename
sanitized - which answers "is WeKan defending itself" and not the question an
admin asks next: who did that, and from where. It also could not tell a browser
that got confused from somebody working through the Hall of Fame one entry at a
time.
A CANARY is a tripwire at a point that only a permission-override attempt
reaches. Ordinary use never gets there - the code path runs when a request asks
for something the rules forbid - so a trip is not noise, and it is worth an
admin's attention with the actor attached. Design:
docs/Security/Remediation/WeKan.md §12.
Three properties, each enforced by a test:
SILENT. Tripping one changes NOTHING the caller can observe. tripCanary()
always returns false and tripCanaryDeny() always returns true, so a call site
reads as the refusal it replaces:
if (forbidden) return false; // before
if (forbidden) return tripCanary('card.vote-field', { userId });
The return value is decided before any reporting is attempted and the reporting
is wrapped, so a canary can never throw into, delay or disturb the request it
watches. The REST handler re-throws the ORIGINAL error object. This is not
politeness: a canary that announces itself is a map of which paths are watched,
and a probe would simply avoid them.
BOUNDED. A canary sits where an attacker can loop, so one row per attempt would
be a denial of service they get for free. models/lib/canaryTokens.js - pure, no
Meteor, no clock of its own - records the first trip of a (canary, actor) pair
at once, COUNTS the rest of the window, flushes one summary carrying the total
when the window closes, and stops writing after 60 summaries for a pair that
never gives up. The tracked-pair map is capped at 5000 and evicts the LEAST
RECENTLY seen, so a long-running attacker is not pushed out by a passing one and
a botnet varying its address cannot grow it. Idle pairs are swept on a timer. A
thousand attempts in a minute cost ONE row, and a suppressed trip costs one map
lookup. The username lookup is cached and capped, and neither it nor the insert
is awaited on the caller's path.
ATTRIBUTED. Every event carries userId, username, ip and count. The username is
denormalised at write time on purpose: it is what the account was CALLED when it
tried, so a rename does not rewrite history and a deletion does not erase it.
The address uses the same spoofing-safe resolver as the login throttle -
X-Forwarded-For only as far as HTTP_FORWARDED_COUNT says to trust it - or an
attacker could write a colleague's address into the security log by sending a
header. `detail` says what was attempted in the words of the feature, never the
payload.
Seventeen canaries are wired at the permission checks that refuse the attempts
behind BoardBleed, ParentBleed, ChecklistBleed, PathBleed and CommentBleed, plus
the direct vote/poker field writes and a stored path that points outside the
storage root. All server-side: no Playwright, no browser, nothing to install.
Admin Panel / Problems / Security gains Username, IP address and Attempts
columns, and both new columns are searchable - the thing an admin does with one
security event is pivot on it.
tests/canaryTokens.test.cjs (25 checks) drives the limiter through bursts, an
endless probe, eviction order and junk input; tests/canaryCoverage.test.cjs (18)
pins every canary to its call site and asserts none of them changes what the
caller gets back.
Thanks to xet7 !
|
||
|
|
a4a9c03b1f |
Security tests: say which vulnerability you guard, and check the list.
"Are the security tests enough to prevent what is in the Hall of Fame" was unanswerable. WeKan publishes 58 named vulnerabilities at https://wekan.fi/hall-of-fame/ ; some suites name the one they belong to, most did not, and the Hall of Fame lives in a different repository that CI never checks out. Answering it meant reading 58 pages against 300 suites by hand, which means it was never answered - and a regression test that quietly stops existing is worth nothing, the failure mode tests/testsAreRegistered.test.cjs already caught once when two *bleed suites drifted out of the mocha index. So the list lives in the repository that has the tests, and tests/securityRegressionCoverage.test.cjs keeps the two in step. Every published vulnerability is either GUARDED - named by a suite that still exists - or RECORDED, a gap with a written reason, which is the CHANGELOG's "TODO Later" pattern applied to tests. The gap count is pinned, so a vulnerability cannot be published with neither a test nor a note; a gap that turns out to be guarded after all fails too, so coverage is never understated; and a file that merely REGISTERS suites is not accepted as coverage, or the guard would pass itself. Getting there meant naming vulnerabilities in the suites that already guarded them, which is most of what this commit is: - tests/securityMeifukun.test.cjs guards eight reports and named one. Its sections are RedirectBleed, SourceBleed, LiveBleed, CasBleed, OidcBleed, MetricsBleed, ImpersonateBleed and InviteBleed - seven vulnerabilities that looked untested and were not. - tests/noIdentityReplacement.test.cjs guards IdentityBleed and PatternBleed, the same CodeQL finding twice. - ExportBleed, CrashBleed, MimeBleed and the four LockoutBleed suites now say so. - tests/crossBoardParentCardLeak.test.cjs also guards BoardBleed's cross-board move deny, and now checks it on Lists and Swimlanes too, not only Cards. The count that comes out of it: 29 of 58 published vulnerabilities have a named regression test, and 29 are recorded gaps - mostly older fixes from before WeKan tested its security fixes at all. They are not known to be unprotected; they are known to be unchecked, which is a different and more honest statement, and each one now says what it would take to close it. Thanks to xet7 ! |