Additional restrictions to device Id
This commit is contained in:
Родитель
924119ee6a
Коммит
d1a7779452
|
@ -27,8 +27,8 @@ const deviceCache = {};
|
|||
*/
|
||||
module.exports = async function (context, device, measurements, timestamp) {
|
||||
if (device) {
|
||||
if (!device.deviceId || !/^[a-zA-Z0-9\-_]+$/.test(device.deviceId)) {
|
||||
throw new StatusError('Invalid format: deviceId must be alphanumeric, lowercase, and may contain hyphens.', 400);
|
||||
if (!device.deviceId || !/^[a-zA-Z0-9-._:]*[a-zA-Z0-9-]+$/.test(device.deviceId)) {
|
||||
throw new StatusError("Invalid format: deviceId must be alphanumeric and may contain '-', '.', '_', ':'. Last character must be alphanumeric or hyphen.", 400);
|
||||
}
|
||||
} else {
|
||||
throw new StatusError('Invalid format: a device specification must be provided.', 400);
|
||||
|
|
|
@ -255,7 +255,7 @@ Function. You can check the integrity of the code being deployed by verifying th
|
|||
of the `iotc-bridge-az-function.zip` file in the root of this repository matches the following:
|
||||
|
||||
```
|
||||
B10A1661111B71E458A9F981926748BB920DD371BB88AE574F47C6BF471B350D
|
||||
D400C44AF5C860D7A9504F3C7495FCAC69407ACFD146692936BAF13AD3AE3BEF
|
||||
```
|
||||
|
||||
# Contributing
|
||||
|
|
Двоичные данные
iotc-bridge-az-function.zip
Двоичные данные
iotc-bridge-az-function.zip
Двоичный файл не отображается.
Загрузка…
Ссылка в новой задаче