Skip to content

#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere

Update SaaS to latest main (#6667)

James Bruntonfb6a118be947
diff --cc app/common/src/test/java/stirling/software/common/model/ApplicationPropertiesLogicTest.java
index 409b244304,ea5f95d77d..98e0e8ca21
--- a/app/common/src/test/java/stirling/software/common/model/ApplicationPropertiesLogicTest.java
+++ b/app/common/src/test/java/stirling/software/common/model/ApplicationPropertiesLogicTest.java
@@@ -31,25 -31,9 +31,25 @@@ class ApplicationPropertiesLogicTest
assertTrue(sys.isAnalyticsEnabled());
}
+ @Test
+ void storageSigning_userListScope_defaultsToOrg_andIsSettable() {
+ // Self-host backward-compat: scope must default to "org" (saas profile pins "team").
+ ApplicationProperties.Storage.Signing signing = new ApplicationProperties.Storage.Signing();
+
+ assertFalse(signing.isEnabled());
+ assertEquals("org", signing.getUserListScope());
+
+ signing.setUserListScope("team");
+ assertEquals("team", signing.getUserListScope());
+
+ // Reachable from the full tree as storage.signing.userListScope.
+ assertEquals(
+ "org", new ApplicationProperties().getStorage().getSigning().getUserListScope());
+ }
+
@Test
void tempFileManagement_defaults_and_overrides() {
- Function<String, String> normalize = s -> Paths.get(s).normalize().toString();
+ Function<String, String> normalize = s -> Path.of(s).normalize().toString();
ApplicationProperties.TempFileManagement tfm =
new ApplicationProperties.TempFileManagement();
diff --cc app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java
index 688277f09c,295e900293..4caf589aeb
--- a/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java
+++ b/app/proprietary/src/main/java/stirling/software/proprietary/security/controller/api/UserController.java
@@@ -986,30 -990,11 +986,30 @@@ public class UserController
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
}
+ // Fail-closed: only literal "org" opens the whole instance; anything else scopes to team.
+ String scope = applicationProperties.getStorage().getSigning().getUserListScope();
+ boolean teamScoped = !"org".equalsIgnoreCase(scope == null ? "" : scope.trim());
+
+ List<User> source;
+ if (teamScoped) {
+ Optional<User> callerOpt = userService.findByUsernameIgnoreCase(principal.getName());
+ if (callerOpt.isEmpty() || callerOpt.get().getTeam() == null) {
+ // No team: return only the caller rather than leak the org.
+ source = callerOpt.map(List::of).orElse(List.of());
+ } else {
+ // KNOWN LIMITATION: scopes the team via the single User.team FK - correct while
+ // acceptInvitation() collapses users to one team; revisit if multi-team enabled.
+ source = userRepository.findAllByTeamId(callerOpt.get().getTeam().getId());
+ }
+ } else {
+ source = userRepository.findAll();
+ }
+
List<UserSummaryDTO> users =
- userRepository.findAll().stream()
+ source.stream()
.filter(User::isEnabled)
.map(this::toUserSummaryDTO)
- .collect(java.util.stream.Collectors.toList());
+ .toList();
return ResponseEntity.ok(users);
}