fix(mesh): reject a manifest step that is not a string
decode is the mesh's trust boundary, reached before the handshake
authenticates the peer. The manifest row checked that steps was an array
but not what was in it, so {"steps":[123]} decoded cleanly and 123 would
have become a graph node name in buildRemote.
Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
2 files changed
+9
No files matched your search
@@ -32,6 +32,12 @@ describe('protocol codec', () => {
|
||||
);
|
||||
});
|
||||
|
||||
it('rejects a manifest whose steps array contains a non-string element', () => {
|
||||
expect(() => decode(JSON.stringify({ type: 'manifest', v: V, steps: [123], routes: [] }))).toThrow(
|
||||
/every step must be a string/,
|
||||
);
|
||||
});
|
||||
|
||||
it('throws on malformed json', () => {
|
||||
expect(() => decode('{not json')).toThrow();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user