mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
basic auth etapi should require "etapi" username
This commit is contained in:
parent
5a3c50d9fb
commit
3e07c08043
@ -37,11 +37,15 @@ function parseAuthToken(auth) {
|
|||||||
const basicAuthStr = utils.fromBase64(auth.substring(6)).toString("UTF-8");
|
const basicAuthStr = utils.fromBase64(auth.substring(6)).toString("UTF-8");
|
||||||
const basicAuthChunks = basicAuthStr.split(":");
|
const basicAuthChunks = basicAuthStr.split(":");
|
||||||
|
|
||||||
if (basicAuthChunks.length === 2) {
|
if (basicAuthChunks.length !== 2) {
|
||||||
auth = basicAuthChunks[1];
|
|
||||||
} else {
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (basicAuthChunks[0] !== "etapi") {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
auth = basicAuthChunks[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
const chunks = auth.split("_");
|
const chunks = auth.split("_");
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
GET {{triliumHost}}/etapi/app-info
|
GET {{triliumHost}}/etapi/app-info
|
||||||
Authorization: Basic whatever {{authToken}}
|
Authorization: Basic etapi {{authToken}}
|
||||||
|
|
||||||
> {%
|
> {%
|
||||||
client.assert(response.status === 200);
|
client.assert(response.status === 200);
|
||||||
@ -9,6 +9,13 @@ Authorization: Basic whatever {{authToken}}
|
|||||||
###
|
###
|
||||||
|
|
||||||
GET {{triliumHost}}/etapi/app-info
|
GET {{triliumHost}}/etapi/app-info
|
||||||
Authorization: Basic whatever wrong pass
|
Authorization: Basic etapi wrong
|
||||||
|
|
||||||
|
> {% client.assert(response.status === 401); %}
|
||||||
|
|
||||||
|
###
|
||||||
|
|
||||||
|
GET {{triliumHost}}/etapi/app-info
|
||||||
|
Authorization: Basic wrong {{authToken}}
|
||||||
|
|
||||||
> {% client.assert(response.status === 401); %}
|
> {% client.assert(response.status === 401); %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user