@saasquatch/program-boilerplate 3.7.2-4 → 3.7.3-0

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.
package/dist/index.js CHANGED
@@ -68,13 +68,19 @@ function webtask(program = {}) {
68
68
  app.use(express_1.default.json({ limit: process.env.MAX_PAYLOAD_SIZE || "1mb" }));
69
69
  app.use(compression());
70
70
  app.use(logger_3.httpLogMiddleware(logger));
71
- const healthCheck = (_req, res) => res.status(200).json({ status: "OK" });
72
- app.get("/healthz", healthCheck);
73
- app.get("/livez", healthCheck);
74
- app.get("/readyz", healthCheck);
75
- app.post("/*", (req, res) => {
76
- const { json, code } = trigger_1.triggerProgram(req.body, program);
77
- return res.status(code).json(json);
71
+ // Enforce HTTPS. The server does not redirect http -> https
72
+ // because OWASP advises not to
73
+ app.use((req, res, next) => {
74
+ if (process.env.NODE_ENV === "production" &&
75
+ req.header("X-Forwarded-Proto") !== "https") {
76
+ return res.status(403).send({ message: "SSL required" });
77
+ }
78
+ // allow the request to continue if https is used
79
+ next();
80
+ });
81
+ app.post("/*", (context, res) => {
82
+ const { json, code } = trigger_1.triggerProgram(context.body, program);
83
+ res.status(code).json(json);
78
84
  });
79
85
  return app;
80
86
  }
@@ -176,6 +176,9 @@ class Transaction {
176
176
  accountId: user.accountId,
177
177
  },
178
178
  rewardId,
179
+ // add the referralId only if the rewardIf is undefined
180
+ // this will cause a graph edge between the referral and the email for moderation
181
+ referralId: rewardId ? undefined : referralId,
179
182
  key: emailKey,
180
183
  queryVariables: queryVariables,
181
184
  query: rewardId
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasquatch/program-boilerplate",
3
- "version": "3.7.2-4",
3
+ "version": "3.7.3-0",
4
4
  "description": "Boilerplate for writing programs",
5
5
  "main": "dist/index.js",
6
6
  "files": [
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@saasquatch/jsonata-paths-extractor": "^1.0.1",
36
- "@saasquatch/logger": "^1.1.2-0",
36
+ "@saasquatch/logger": "^1.0.0",
37
37
  "bson-objectid": "^1.3.1",
38
38
  "compression": "^1.7.4",
39
39
  "express": "^4.17.1",