Commit Graph

6564 Commits

Author SHA1 Message Date
Robin Appelman 1f96118ef9 test: cleanup users before userbackend test
Signed-off-by: Robin Appelman <robin@icewind.nl>
2026-06-08 15:40:03 +02:00
Robin Appelman 6100590516 fix: remove trait property conflict
Signed-off-by: Robin Appelman <robin@icewind.nl>
2026-06-08 15:35:08 +02:00
Robin Appelman 9651860720 test: add test trait for creating temporary groups
Signed-off-by: Robin Appelman <robin@icewind.nl>
2026-06-08 15:35:08 +02:00
Carl Schwan fc4938c3ed fix(preview): Better handle errors while migrating previews
Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-06-08 14:44:01 +02:00
Tobias Kaminsky 3279c40632 Merge pull request #60953 from nextcloud/carl/IInstanceFactory
chore: Remove unused and long deprecated Remote components
2026-06-03 14:50:19 +02:00
Carl Schwan 8b56c4c93d chore: Remove unused and long deprecated Remote components
Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-06-03 10:36:41 +02:00
Ferdinand Thiessen b27e4956d1 refactor(NavigationManager): move navigation definitions into apps
The manager itself does not need to know what hardcoded-things an app provides,
instead the apps itself should handle this.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-06-02 22:51:05 +02:00
Carl Schwan bbbdf47f36 Merge pull request #60881 from nextcloud/jtr/test-fix-cache-ordering-assumption
test(cache): avoid ordering assumptions in testExtended
2026-06-02 13:56:23 +02:00
Benjamin Gaussorgues a8428f883d Merge pull request #59002 from nextcloud/fix/remove-static-vars
Remove usage of static vars or properties
2026-06-02 11:28:20 +02:00
Carl Schwan b7ee8e7545 Merge pull request #59813 from nextcloud/fix/noid/fix-owncloud-group-share-rename
fix(sharing): set STATUS_ACCEPTED when creating USERGROUP subshare on…
2026-06-02 11:14:13 +02:00
Côme Chilliet a62bff17f2 fix: Fix suppressing ImpureStaticProperty and suppress it in a few places
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-02 09:46:18 +02:00
Côme Chilliet 2ef982d402 fix: Fix TemplateLayout tests
The behaviour of getAppNameFromPath is really different from what was
 mocked, so I’m not sure whether the class behaves as initially
 intended. I adapted the test to match the class behavior for now.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-02 09:46:17 +02:00
provokateurin 80ec3b1b0a fix(MailPlugin): Stop applying the offset twice and the limit per wide/exact
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-06-01 14:24:01 +02:00
provokateurin 5c21fb5062 perf(MailPlugin): Optimize checking group memberships
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-06-01 14:22:45 +02:00
provokateurin d92aac8f7d fix(MailPlugin): Use correct type for exact id match
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-06-01 14:22:45 +02:00
Josh c7fabc4654 test(cache): avoid ordering assumptions in testExtended
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-06-01 14:22:30 +02:00
Côme Chilliet 1ab09ec753 chore: Apply new coding standard to all files
The diff can be checked using: git diff --ignore-all-space --ignore-blank-lines
To see only the changes not related to blank lines.

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2026-06-01 13:46:39 +02:00
Benjamin Gaussorgues d67eae3501 feat(jobs): add command to list executed background jobs
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2026-05-29 14:09:06 +02:00
Benjamin Gaussorgues 4ee75168d5 feat(jobs): allow to keep track of job executions
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2026-05-29 09:14:49 +02:00
Benjamin Gaussorgues 8db8776f2d feat(jobs): introduce background job classes registry
Signed-off-by: Benjamin Gaussorgues <benjamin.gaussorgues@nextcloud.com>
2026-05-29 09:14:48 +02:00
Anna e29038414d Merge pull request #59677 from nextcloud/fix/57340/owncloud-migration-appconfig-userconfig
fix(appconfig,userconfig): restore pre-migration fallback for ownCloud migration
2026-05-28 20:42:29 +02:00
Anna 781eb630c4 Merge pull request #60751 from nextcloud/fix/noid/checkbox-tests-share20
test(share20): replace addToAssertionCount checkbox tests in Share20 ManagerTest
2026-05-28 15:59:35 +02:00
Stephan Orbaugh 72f5eea531 Merge pull request #60734 from nextcloud/feat/user/avatar-url-getters
feat(UserManager): Add getters for avatar URLs
2026-05-28 15:51:42 +02:00
Stephan Orbaugh 4cad192bcd Merge pull request #60102 from nextcloud/automated/noid/rector-changes 2026-05-28 12:31:17 +02:00
Anna Larch b2c9273e5f fix(appconfig,userconfig): restore pre-migration fallback for ownCloud migration
AppConfig and UserConfig unconditionally queried NC-only columns (type,
lazy, flags, indexed) that don't exist in ownCloud's database schema,
breaking ownCloud → Nextcloud upgrades entirely before the schema
migration steps could run.

Restore the fallback pattern in both classes: on first loadConfig() call,
if a DBException with REASON_INVALID_FIELD_NAME is thrown, set
$migrationCompleted = false and retry selecting only the columns present
in ownCloud's schema. INSERT and UPDATE statements also omit NC-only
columns when $migrationCompleted is false.

The catch block also guards against infinite recursion: if $migrationCompleted
is already false when the exception fires, the exception is re-thrown
instead of triggering another recursive call.

Fixes: https://github.com/nextcloud/server/issues/57340

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-28 09:46:49 +02:00
Anna f67b908c42 Merge pull request #60742 from nextcloud/test/noid/remove-checkbox-tests
test: replace checkbox assertions with real assertions or DoesNotPerformAssertions
2026-05-27 19:47:57 +02:00
Micke Nordin 5ffde0370b Merge pull request #60136 from nextcloud/kano-dual-stack-rfc-9421-http-sig
feat(http-sig): Dual stack http-sig
2026-05-27 15:59:52 +02:00
Anna Larch 0bb8081842 test(share20): replace addToAssertionCount checkbox tests in Share20 ManagerTest
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 12:22:02 +02:00
Anna Larch 18c5c0711e test: remove no-op checkbox assertions
Replace assertTrue(true), addToAssertionCount(1) and delete-without-assert
patterns with meaningful assertions or proper test removal.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-27 12:12:44 +02:00
Kate f1915e0dd4 Merge pull request #60744 from nextcloud/test/noid/phpunit-db-test-isolation
test(db): call parent::tearDown() in DB test classes that skipped it
2026-05-27 11:37:51 +02:00
Micke Nordin cc9e0ba582 fix(http-sig): make setSignature public and skip third-party-dependent test
Two CI failures introduced by the test additions in this PR:

1. testEd25519VerifyAcceptedWhenSodiumLoaded calls setSignature() to inject
   an externally-produced Ed25519 signature (since Algorithm::sign() rejects
   Ed25519 by design). setSignature was declared protected, so the test
   couldn't call it from outside the class hierarchy. Make it public —
   SignedRequest lives in the OC\ private namespace, so this widens
   internal-only visibility, not the public API surface.

2. testParseKeyRejectsContradictoryAlg expected firebase/php-jwt's
   JWK::parseKey() to throw on a kty=OKP/crv=Ed25519/alg=ES256 key. The
   current firebase/php-jwt version does not validate that coherence at
   parse time, so the test now fails to see any throwable. The actual
   security check happens at Algorithm::verify() time and is covered by
   testVerifyEd25519KeyAgainstES256Alg right above it. Skip the parse-time
   test with a comment pointing at the verify-time coverage.

Signed-off-by: Micke Nordin <kano@sunet.se>
2026-05-27 11:03:55 +02:00
Micke Nordin 1bad4fe238 fix: Make sodium optional
This commit switches the default signature algorithm to
ecdsa-p256-sha256 instead of Ed25519. This allows us to make sodium
optional again, and we only pull it in to use it for verifying incomming
signatures. If sodium is not installed, we throw on Ed25519 signatures
instead. At least it is easy for most people to make their Nextcloud
install fully RFC compliant by installing sodium.

I also renamed all the Ed25519 function names to be more precis, using
Jwks for the JSON Web Keys, and RFC9421 for the http-signature code,
where it is needed to distinguish from draft-cavage signatures.

Signed-off-by: Micke Nordin <kano@sunet.se>
2026-05-27 11:03:55 +02:00
Micke Nordin 3b5107bc96 feat(http-sig): OCM Ed25519 keys, JWKS endpoint, http-sig capability
OCM dual-stack integration of RFC 9421 alongside the existing cavage
publicKey path:

- OCMSignatoryManager: Ed25519 active/pending/retiring slot rotation
  backed by numbered pool appkeys, getRemoteKey for inbound JWK lookup
  with per-origin cache + cache-miss refetch, and getLocalEd25519Jwks
  for the JWKS endpoint.
- Rfc9421SignatoryManager: per-call wrapper that swaps in the Ed25519
  signatory and toggles `rfc9421.format`.
- OCMJwksHandler: serves /.well-known/jwks.json (RFC 7517) when signing
  is enabled.
- OCMDiscoveryService: advertises `http-sig` in capabilities when
  signing is enabled, and picks the signature scheme on outbound based
  on the remote's advertised capabilities.
- Application.php: register the JWKS well-known handler.

Signed-off-by: Micke Nordin <kano@sunet.se>
2026-05-27 11:03:55 +02:00
Micke Nordin 0eb927e617 feat(http-sig): RFC 9421 protocol primitives
Add the RFC 9421 (HTTP Message Signatures) sign/verify path alongside
the existing draft-cavage implementation:

- Algorithm: sodium for Ed25519, JWT::sign for RSA / ECDSA, ecdsaRawToDer
  for the ECDSA wire format. JWK parsing via JWK::parseKey.
- SignatureBase: RFC 9421 §2.5 base construction for the derived
  components OCM uses plus plain HTTP fields.
- ContentDigest: RFC 9530 helpers used as a covered component.
- Rfc9421IncomingSignedRequest / Rfc9421OutgoingSignedRequest:
  request models. Parsing of Signature-Input / Signature delegates
  to gapple\\StructuredFields\\Parser.
- IJwkResolvingSignatoryManager: capability bit signatory managers
  advertise to participate in RFC 9421 verification.
- OcmProfile: OCM-mandated dictionary label.
- SignatureManager: dispatch to RFC 9421 inbound when Signature-Input
  is present, outbound when rfc9421.format is set.

Plus tests for each primitive and a full round-trip across the model.

Signed-off-by: Micke Nordin <kano@sunet.se>
2026-05-27 11:03:55 +02:00
provokateurin 3ce12c83e1 feat(UserManager): Add getters for avatar URLs
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-05-27 06:44:36 +02:00
provokateurin bf2043ea6d test(UserManager): Create manager in setUp
Signed-off-by: provokateurin <kate@provokateurin.de>
2026-05-27 06:44:02 +02:00
Anna Larch d30f3c491d test: replace checkbox assertions with DoesNotPerformAssertions (middleware)
Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 23:18:55 +02:00
Anna Larch a9f177e743 test(db): call parent::tearDown() in DB test classes that skipped it
Eight test classes overrode tearDown() for custom DB cleanup but never
called parent::tearDown(). TestCase::tearDown() does three things these
tests were silently skipping after every test method:

- ILockingProvider::releaseAll() — unreleased locks bleed into subsequent
  tests and can cause deadlocks or unexpected NotFoundException
- Storage::getGlobalCache()->clearCache() — stale filecache entries from
  share/storage tests cause unrelated ObjectStore tests to receive false
  from fopen() (fseek() then fails with "Argument must be of type resource")
- UserMountCache::flush() — stale mount cache causes share lookups in
  later tests to fail with ShareNotFound

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
2026-05-26 21:20:57 +02:00
Anna Larch 29f43d8e7a fix(security): don't propagate ValueError from Crypto::decrypt() fallback
When decrypting a v3 ciphertext with a mismatched secret, the first
attempt throws an Exception (HMAC mismatch). The fallback then calls
decryptWithoutSecret() with an empty string, which causes hash_hkdf()
to throw a ValueError. Since ValueError extends \Error rather than
\Exception, it bypassed the catch block and propagated as an unhandled
error, crashing the whole request.

Wrap the fallback in its own try/catch(\Throwable) and rethrow the
original Exception so callers get a meaningful HMAC mismatch error.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-26 21:20:41 +02:00
Anna Larch 6220ae9175 fix(sharing): restore STATUS_ACCEPTED for OC-migrated group share subshares
When an ownCloud-migrated group share (which has no per-user USERGROUP
subshare) is renamed for the first time, DefaultShareProvider::move()
inserted a new USERGROUP row without setting `accepted`. The column
defaulted to 0 (STATUS_PENDING), causing MountProvider to skip the
share on the next login — the shared file disappeared for the recipient.

Fix: set accepted = STATUS_ACCEPTED explicitly on the INSERT in
DefaultShareProvider::move() for the TYPE_GROUP branch.

Secondary fix: SharedMount::moveMount() silently returned true when
updateFileTarget() threw (e.g. group no longer exists on an OC-migrated
instance). Set $result = false in the catch block so View::rename()
propagates the failure instead of silently corrupting VFS state.

An opt-in occ command (sharing:fix-owncloud-group-shares) with --dry-run
support is included to repair existing broken instances. It targets only
TYPE_USERGROUP subshares with accepted=STATUS_PENDING and permissions!=0
(shares that were accepted but broken by the missing column default),
leaving explicitly declined shares (permissions=0) untouched.

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
2026-05-26 17:28:39 +02:00
nextcloud-command fd14234a6a refactor: Apply rector changes
Signed-off-by: GitHub <noreply@github.com>
2026-05-24 14:56:18 +00:00
Daniel c0c03fd37f Merge pull request #60546 from nextcloud/local-address-nat64
fix: handle NAT64 addresses in isLocalAddress
2026-05-20 16:10:25 +02:00
Ferdinand Thiessen 7a62c350b1 Merge pull request #53583 from nextcloud/jtr-remove-always-populate-raw-post-data
chore: remove `always_populate_raw_post_data`
2026-05-20 14:01:01 +02:00
Anna afe61fe63d Merge pull request #60286 from nextcloud/fix/noid/appstore-fetcher-generic-file-exception
fix(AppStore/Fetcher): catch GenericFileException when reading cache file in Fetcher
2026-05-20 02:51:28 +02:00
Josh 3ee366eb27 chore: remove always_populate_raw_post_data from htaccessWithValidModifiedContent
Signed-off-by: Josh <josh.t.richards@gmail.com>
2026-05-19 21:39:51 +02:00
Robin Appelman a472a189bb fix: handle NAT64 addresses in isLocalAddress
Signed-off-by: Robin Appelman <robin@icewind.nl>
2026-05-19 17:06:46 +02:00
Anna Larch c4356e1b25 fix(appstore): address review comments on GenericFileException handling
- Attempt delete before logging the warning, so the warning only fires
  when we know recovery will succeed
- Log an error (not silently return) when delete itself fails
- Use catch (\Exception) without variable (PHP 8)
- Replace willReturnArgument(1) with explicit willReturn(true) in test
- Add blank lines between logical blocks in test for readability

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 16:52:52 +02:00
Anna Larch 5113b18739 fix(appstore): catch GenericFileException when reading cache file in Fetcher
When the appstore cache file exists but getContent() throws a
GenericFileException (I/O error or OS-level permission failure), explicitly
delete the file and recreate it before writing fresh data — mirroring the
NotFoundException recovery path. If deletion itself fails, return [] cleanly.

Previously, the unhandled exception caused the entire apps settings page to
crash. The new test covers both the recovery path and deletion failure.

Signed-off-by: Anna Larch <anna@nextcloud.com>
AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-19 16:34:06 +02:00
Benjamin Gaussorgues 91a4172e35 Merge pull request #60225 from nextcloud/remove-cache-order
perf: remove unneeded sort in getFolderContentsById
2026-05-13 16:49:24 +02:00
Carl Schwan fcb956b5ab Merge pull request #59753 from nextcloud/work/carl/remove-orderById
perf(share): Remove useless order by id
2026-05-13 12:21:48 +02:00