Skip to content

Commit 3b7528a

Browse files
bewestsulkaharo
andauthored
minimum attempt to protect /api/v2/ endpoints (nightscout#7554)
* minimum attempt to protect /api/v2/ endpoints These endpoints should be protected as reported in nightscout#7546. * remove spurious line Co-authored-by: Sulka Haro <[email protected]>
1 parent d185cf6 commit 3b7528a

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/api/properties.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ function create (env, ctx) {
1818
*
1919
* Expecting to define extended syntax and support for several query params
2020
*/
21+
properties.use(ctx.authorization.isPermitted('api:entries:read'),
22+
ctx.authorization.isPermitted('api:treatments:read'));
2123
properties.get(['/', '/*'], function getProperties (req, res) {
2224

2325
var sbx = sandbox.serverInit(env, ctx);
@@ -57,4 +59,4 @@ function create (env, ctx) {
5759
return properties;
5860
}
5961

60-
module.exports = create;
62+
module.exports = create;

lib/data/endpoints.js

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ function configure (app, ctx) {
6464
next( );
6565
});
6666

67+
api.use(ctx.authorization.isPermitted('api:entries:read'),
68+
ctx.authorization.isPermitted('api:treatments:read'));
6769
api.get('/at/:at?', ensure_at, get_ddata, format_result);
6870

6971
return api;

0 commit comments

Comments
 (0)