@7365admin1/core 3.52.16-staging.266 → 3.52.16-staging.267

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ ---
2
+ "@7365admin1/core": patch
3
+ ---
4
+
5
+ Narrow the account-by-e-mail lookup to identity only, and scope the two open subscription reads
6
+
7
+ `GET /api/users/email/:email` and its v2 twin `GET /api/users/v2/email/:email`
8
+ stripped the password hash and session id from the reply but answered every
9
+ other stored field, so any signed-in account could read any other account's
10
+ NRIC, contact number, date of birth, gender, default organisation, status and
11
+ profile just by knowing the e-mail address — across every client on the
12
+ platform. Both now answer `{_id, name, email}` and nothing else. An
13
+ organisation gate would have been the wrong fix: this endpoint exists for the
14
+ invite flow, where the person being looked up is deliberately not in the
15
+ caller's organisation yet.
16
+
17
+ `GET /api/subscriptions/org/:id` answered any organisation's billing record —
18
+ plan, seat count, price, currency, renewal date — to any signed-in account, and
19
+ `GET /api/subscriptions/` answered every subscription on the platform in one
20
+ list. They now carry `requireOrgAccess` and `requirePlatformStaff`, the two
21
+ gates already used elsewhere in the same file.
package/dist/index.js CHANGED
@@ -18680,11 +18680,11 @@ async function requireUserFieldWrite(req, userId, field) {
18680
18680
  }
18681
18681
 
18682
18682
  // src/utils/user-response.util.ts
18683
- function withoutCredentials(user) {
18683
+ function publicIdentity(user) {
18684
18684
  if (!user || typeof user !== "object")
18685
18685
  return user;
18686
- const { password, sid, ...rest } = user;
18687
- return rest;
18686
+ const { _id, name, email } = user;
18687
+ return { _id, name, email };
18688
18688
  }
18689
18689
 
18690
18690
  // src/controllers/user.controller.ts
@@ -18776,7 +18776,7 @@ function useUserController() {
18776
18776
  return;
18777
18777
  }
18778
18778
  const user = await _getByEmail(email);
18779
- res.json(withoutCredentials(user));
18779
+ res.json(publicIdentity(user));
18780
18780
  return;
18781
18781
  } catch (error2) {
18782
18782
  import_node_server_utils43.logger.log({ level: "error", message: `${error2.message}` });
@@ -31692,6 +31692,7 @@ function useSubscriptionController() {
31692
31692
  return;
31693
31693
  }
31694
31694
  try {
31695
+ await requireOrgAccess(req, _id);
31695
31696
  const data = await _getByOrgId(_id);
31696
31697
  res.json(data);
31697
31698
  return;
@@ -31718,6 +31719,7 @@ function useSubscriptionController() {
31718
31719
  const page = parseInt(req.query.page ?? "1");
31719
31720
  const status = req.query.status ?? "active";
31720
31721
  try {
31722
+ await requirePlatformStaff(req);
31721
31723
  const data = await _getSubscriptions({ search, page, status });
31722
31724
  res.json(data);
31723
31725
  return;
@@ -86094,7 +86096,7 @@ function useUserControllerV2() {
86094
86096
  return rejectValidation(error, next);
86095
86097
  try {
86096
86098
  const user = await _getUserByEmail(value);
86097
- res.json(withoutCredentials(user));
86099
+ res.json(publicIdentity(user));
86098
86100
  return;
86099
86101
  } catch (err) {
86100
86102
  import_node_server_utils269.logger.log({ level: "error", message: `${err.message}` });