@abtnode/core 1.17.8-beta-20260119-034126-467341b7 → 1.17.8-beta-20260121-102603-f9d0176f
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.
|
@@ -65,7 +65,11 @@ async function getBlockletBlurhash(manager, { did }) {
|
|
|
65
65
|
* @param {Object} context
|
|
66
66
|
* @returns {Promise<Object>}
|
|
67
67
|
*/
|
|
68
|
-
async function updateBlockletSettings(
|
|
68
|
+
async function updateBlockletSettings(
|
|
69
|
+
manager,
|
|
70
|
+
{ did, enableSessionHardening, invite, gateway, aigne, org, subService },
|
|
71
|
+
context
|
|
72
|
+
) {
|
|
69
73
|
const params = {};
|
|
70
74
|
if (!isNil(enableSessionHardening)) {
|
|
71
75
|
params.enableSessionHardening = enableSessionHardening;
|
|
@@ -98,6 +102,37 @@ async function updateBlockletSettings(manager, { did, enableSessionHardening, in
|
|
|
98
102
|
};
|
|
99
103
|
}
|
|
100
104
|
|
|
105
|
+
if (!isNil(subService)) {
|
|
106
|
+
// Security: Validate subService configuration to prevent path traversal
|
|
107
|
+
const SUB_SERVICE_SCHEMA = Joi.object({
|
|
108
|
+
enabled: Joi.boolean().required(),
|
|
109
|
+
domain: Joi.when('enabled', {
|
|
110
|
+
is: true,
|
|
111
|
+
then: Joi.string().required(),
|
|
112
|
+
otherwise: Joi.string().optional().allow(''),
|
|
113
|
+
}),
|
|
114
|
+
staticRoot: Joi.when('enabled', {
|
|
115
|
+
is: true,
|
|
116
|
+
then: Joi.string()
|
|
117
|
+
.required()
|
|
118
|
+
// Reject paths containing ".." or starting with "/"
|
|
119
|
+
.pattern(/^[^/]/, { name: 'no-absolute-path' })
|
|
120
|
+
.pattern(/^(?!.*\.\.).*$/, { name: 'no-parent-reference' })
|
|
121
|
+
.messages({
|
|
122
|
+
'string.pattern.name': 'Invalid path. Path cannot contain ".." or start with "/"',
|
|
123
|
+
}),
|
|
124
|
+
otherwise: Joi.string().optional().allow(''),
|
|
125
|
+
}),
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
const { error } = SUB_SERVICE_SCHEMA.validate(subService);
|
|
129
|
+
if (error) {
|
|
130
|
+
throw new CustomError(400, error.message);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
params.subService = subService;
|
|
134
|
+
}
|
|
135
|
+
|
|
101
136
|
let shouldRotateSession = false;
|
|
102
137
|
if (!isNil(org)) {
|
|
103
138
|
const ORG_SCHEMA = Joi.object({
|
|
@@ -826,10 +826,10 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
826
826
|
return summary;
|
|
827
827
|
}
|
|
828
828
|
|
|
829
|
-
updateBlockletSettings({ did, enableSessionHardening, invite, gateway, aigne, org }, context) {
|
|
829
|
+
updateBlockletSettings({ did, enableSessionHardening, invite, gateway, aigne, org, subService }, context) {
|
|
830
830
|
return settingsManager.updateBlockletSettings(
|
|
831
831
|
this,
|
|
832
|
-
{ did, enableSessionHardening, invite, gateway, aigne, org },
|
|
832
|
+
{ did, enableSessionHardening, invite, gateway, aigne, org, subService },
|
|
833
833
|
context
|
|
834
834
|
);
|
|
835
835
|
}
|