eclipse-thingweb / eclipse-thingweb/node-wot
Credentials are not validated
- Dominant language
- TypeScript
- Stars
- 192
- Forks
- 100
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 6
Description
If someone writes the following code:
```js
let servient = new Servient();
servient.addClientFactory(new HttpsClientFactory(httpConfig));
servient.addCredentials(
{
"urn:dev:ops:32473-sensehat-003": {
"username": "USERNAME",
"pasword": "PASSWORD" // look here
}
});
```
in the mentioned line, there is `pasword` instead of `password`. Until a WoT operation is done, no error is shown. When the error finally shows up, it is like the following:
```
Error: No Basic credentials for Thing
at new BasicCredential (/home/me/Downloads/test/node_modules/@node-wot/binding-http/dist/credential.js:68:19)
at HttpClient.setSecurity (/home/me/Downloads/test/node_modules/@node-wot/binding-http/dist/http-client.js:209:35)
at Object.ConsumedThing.ensureClientSecurity (/home/me/Downloads/test/node_modules/@node-wot/core/dist/consumed-thing.js:100:20)
at Object.ConsumedThing.getClientFor (/home/me/Downloads/test/node_modules/@node-wot/core/dist/consumed-thing.js:146:22)
at /home/me/Downloads/test/node_modules/@node-wot/core/dist/consumed-thing.js:161:32
at new Promise ()
at Object.ConsumedThing.readProperty (/home/me/Downloads/test/node_modules/@node-wot/core/dist/consumed-thing.js:155:16)
```
So it is clear that something is wrong with credentials but the error is not specific or even misleading, i.e. making me think that my password is wrong. I had to debug to find this mistake since it is silly but hard to spot. When the credentials are added, everything works perfectly and when they are retrieved, the password is undefined and thus bad credentials.
Environment: Linux
node-wot version: 0.7.4 but valid for all probably
Contributor guide
Assessment
This issue has not been assessed yet.