@balena/open-balena-api 31.0.7-build-overall-status-balena-vpn-control-6fb30582bc24aef1794a06bbec6af34479f87f41-2 → 31.0.8-build-improve-service-tagging-dc8693c5bdc747ba335345d4b3a022066e4fa7d8-2
Sign up to get free protection for your applications and to get access to all the features.
@@ -13,11 +13,15 @@ export const skipLogging = (req, _res, next) => {
|
|
13
13
|
// - u/ - user ID; used whenever we can extract a user info about the calls (both for API key and JWT auth);
|
14
14
|
// - s/ - service name; used when an internal balena service is making an API request.
|
15
15
|
const getCallerId = (req) => {
|
16
|
-
if ((req.creds != null && 'service' in req.creds && req.creds.service) ||
|
17
|
-
req.apiKey?.permissions?.includes('service')) {
|
18
|
-
return `s/${getServiceFromRequest(req) ?? 'unknown'}`;
|
19
|
-
}
|
20
16
|
if (req.creds != null) {
|
17
|
+
const service = getServiceFromRequest(req);
|
18
|
+
if (service != null) {
|
19
|
+
return `s/${service}`;
|
20
|
+
}
|
21
|
+
if (('service' in req.creds && req.creds.service) ||
|
22
|
+
req.creds.permissions?.includes('service')) {
|
23
|
+
return `s/unknown`;
|
24
|
+
}
|
21
25
|
if ('actor' in req.creds && req.creds.actor) {
|
22
26
|
return `a/${req.creds.actor}`;
|
23
27
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/features/request-logging/index.ts"],"names":[],"mappings":"AACA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAI3C,MAAM,CAAC,MAAM,WAAW,GAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;IAC9D,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC;IACvB,IAAI,EAAE,CAAC;AACR,CAAC,CAAC;AAEF,2DAA2D;AAC3D,uEAAuE;AACvE,0CAA0C;AAC1C,oBAAoB;AACpB,oGAAoG;AACp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C3D,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC;QAElC,OAAO,GAAG,IAAI,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,QAAQ,IACvC,GAAG,CAAC,MACL,IAAI,GAAG,IAAI,UAAU,IAAI,YAAY,MAAM,YAAY,EAAE,CAAC;IAC3D,CAAC,EACD;QACC,IAAI,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,WAAsB;KACzC,CACD,CACD,CAAC;AACH,CAAC,CAAC"}
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@balena/open-balena-api",
|
3
3
|
"description": "Internet of things, Made Simple",
|
4
|
-
"version": "31.0.
|
4
|
+
"version": "31.0.8-build-improve-service-tagging-dc8693c5bdc747ba335345d4b3a022066e4fa7d8-2",
|
5
5
|
"license": "AGPL-3.0",
|
6
6
|
"repository": {
|
7
7
|
"type": "git",
|
@@ -166,6 +166,6 @@
|
|
166
166
|
"loader": "ts-node/esm/transpile-only"
|
167
167
|
},
|
168
168
|
"versionist": {
|
169
|
-
"publishedAt": "2024-11-
|
169
|
+
"publishedAt": "2024-11-08T12:41:55.959Z"
|
170
170
|
}
|
171
171
|
}
|