Compare commits

...

7 commits

Author SHA1 Message Date
Malachi Soord
3d21b3e567
Merge cfc69e69e8 into 6899603eb7 2024-11-09 15:30:20 +00:00
Abhigyan Mohanta
6899603eb7
fix #5314 Email Address Friendly Name Error (#5318)
Some checks failed
CodeQL / Analyze (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (18, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
Auto Test / auto-test (18, ARM64) (push) Has been cancelled
Auto Test / auto-test (18, macos-latest) (push) Has been cancelled
Auto Test / auto-test (18, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (18, windows-latest) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-latest) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
2024-11-09 23:30:08 +08:00
Malachi Soord
cfc69e69e8
Remove duplication 2023-11-11 11:35:14 +01:00
Malachi Soord
ad71fc9481
Add IP validation 2023-11-11 11:32:41 +01:00
Malachi Soord
8160930470
remove nvmrc + validate input 2023-11-05 13:50:25 +01:00
Malachi Soord
727651b4ae
Fix lint 2023-11-05 12:17:22 +01:00
Malachi Soord
f1430ec6af
Add way to filter IP addresses to be allowed to access 2023-11-05 12:11:59 +01:00
4 changed files with 66 additions and 4 deletions

40
package-lock.json generated
View file

@ -30,6 +30,7 @@
"dotenv": "~16.0.3", "dotenv": "~16.0.3",
"express": "~4.21.0", "express": "~4.21.0",
"express-basic-auth": "~1.2.1", "express-basic-auth": "~1.2.1",
"express-ipfilter": "^1.3.1",
"express-static-gzip": "~2.1.7", "express-static-gzip": "~2.1.7",
"feed": "^4.2.2", "feed": "^4.2.2",
"form-data": "~4.0.0", "form-data": "~4.0.0",
@ -8605,6 +8606,25 @@
"basic-auth": "^2.0.1" "basic-auth": "^2.0.1"
} }
}, },
"node_modules/express-ipfilter": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/express-ipfilter/-/express-ipfilter-1.3.1.tgz",
"integrity": "sha512-9WZC8wGkI6I6ygZNzuZ2MbFJiGoDXs1dM+E8LKtSP13pdgqrnkonWlgvvbxG3YZpa7Haz7Ndum9/J6qkj52OqA==",
"dependencies": {
"ip": "^1.1.8",
"lodash": "^4.17.11",
"proxy-addr": "^2.0.7",
"range_check": "^2.0.4"
},
"engines": {
"node": ">=8.9.0"
}
},
"node_modules/express-ipfilter/node_modules/ip": {
"version": "1.1.8",
"resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz",
"integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg=="
},
"node_modules/express-static-gzip": { "node_modules/express-static-gzip": {
"version": "2.1.8", "version": "2.1.8",
"resolved": "https://registry.npmjs.org/express-static-gzip/-/express-static-gzip-2.1.8.tgz", "resolved": "https://registry.npmjs.org/express-static-gzip/-/express-static-gzip-2.1.8.tgz",
@ -10196,6 +10216,14 @@
"node": ">= 12" "node": ">= 12"
} }
}, },
"node_modules/ip6": {
"version": "0.2.10",
"resolved": "https://registry.npmjs.org/ip6/-/ip6-0.2.10.tgz",
"integrity": "sha512-1LdpyKjhvepd6EbAU6rW4g14vuYtx5TnJX9TfZZBhsM6DsyPQLNzW12rtbUqXBMwqFrLVV/Gcxv0GNFvJp2cYA==",
"bin": {
"ip6": "ip6-cli.js"
}
},
"node_modules/ipaddr.js": { "node_modules/ipaddr.js": {
"version": "1.9.1", "version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
@ -13609,6 +13637,18 @@
"node": ">=0.8.0" "node": ">=0.8.0"
} }
}, },
"node_modules/range_check": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/range_check/-/range_check-2.0.4.tgz",
"integrity": "sha512-aed0ocXXj+SIiNNN9b+mZWA3Ow2GXHtftOGk2xQwshK5GbEZAvUcPWNQBLTx/lPcdFRIUFlFCRtHTQNIFMqynQ==",
"dependencies": {
"ip6": "^0.2.0",
"ipaddr.js": "^1.9.1"
},
"engines": {
"node": ">=10.0.0"
}
},
"node_modules/range-parser": { "node_modules/range-parser": {
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",

View file

@ -88,6 +88,7 @@
"dotenv": "~16.0.3", "dotenv": "~16.0.3",
"express": "~4.21.0", "express": "~4.21.0",
"express-basic-auth": "~1.2.1", "express-basic-auth": "~1.2.1",
"express-ipfilter": "^1.3.1",
"express-static-gzip": "~2.1.7", "express-static-gzip": "~2.1.7",
"feed": "^4.2.2", "feed": "^4.2.2",
"form-data": "~4.0.0", "form-data": "~4.0.0",

View file

@ -119,6 +119,27 @@ const port = config.port;
const disableFrameSameOrigin = !!process.env.UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN || args["disable-frame-sameorigin"] || false; const disableFrameSameOrigin = !!process.env.UPTIME_KUMA_DISABLE_FRAME_SAMEORIGIN || args["disable-frame-sameorigin"] || false;
const cloudflaredToken = args["cloudflared-token"] || process.env.UPTIME_KUMA_CLOUDFLARED_TOKEN || undefined; const cloudflaredToken = args["cloudflared-token"] || process.env.UPTIME_KUMA_CLOUDFLARED_TOKEN || undefined;
const ipsToAllow = process.env.UPTIME_KUMA_IPS_TO_ALLOW || args["ips-to-allow"] || undefined;
if (ipsToAllow !== undefined) {
if (typeof ipsToAllow !== "string") {
log.error("server", "IPs to allow must be a string, " + typeof ipsToAllow + " provided");
process.exit(1);
}
const splitIps = ipsToAllow.split(",");
const net = require("net");
for (const ip of splitIps) {
if (net.isIP(ip) === 0) {
log.error("server", "Provided IPs to allow must be valid IP addresses, " + ip + " provided");
process.exit(1);
}
}
log.info("server", "IPs to allow: " + splitIps);
const ipfilter = require("express-ipfilter").IpFilter;
app.use(ipfilter(splitIps, { mode: "allow" }));
}
// 2FA / notp verification defaults // 2FA / notp verification defaults
const twoFAVerifyOptions = { const twoFAVerifyOptions = {
"window": 1, "window": 1,

View file

@ -5,20 +5,20 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label> <label for="sendgrid-from-email" class="form-label">{{ $t("From Email") }}</label>
<input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="email" class="form-control" required> <input id="sendgrid-from-email" v-model="$parent.notification.sendgridFromEmail" type="text" class="form-control" required>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label> <label for="sendgrid-to-email" class="form-label">{{ $t("To Email") }}</label>
<input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="email" class="form-control" required> <input id="sendgrid-to-email" v-model="$parent.notification.sendgridToEmail" type="text" class="form-control" required>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label> <label for="sendgrid-cc-email" class="form-label">{{ $t("smtpCC") }}</label>
<input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="email" class="form-control"> <input id="sendgrid-cc-email" v-model="$parent.notification.sendgridCcEmail" type="text" class="form-control">
<div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div> <div class="form-text">{{ $t("Separate multiple email addresses with commas") }}</div>
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label> <label for="sendgrid-bcc-email" class="form-label">{{ $t("smtpBCC") }}</label>
<input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="email" class="form-control"> <input id="sendgrid-bcc-email" v-model="$parent.notification.sendgridBccEmail" type="text" class="form-control">
<small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small> <small class="form-text text-muted">{{ $t("Separate multiple email addresses with commas") }}</small>
</div> </div>
<div class="mb-3"> <div class="mb-3">