-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
MatrixAI/Polykey
#611Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 1Secret Vault Sharing and Secret History ManagementSecret Vault Sharing and Secret History Management
Description
Specification
While testing hole punching with the testnet, we found a few issues with the CLI.
- Nodes Get All is throwing an error
- We are getting a weird output format for nodes connections what is the 0 and what is this NA for?
- I think nodes connections is better suited for dictionary format - list format or table format (can you check which ones done robustly)
- The output changes sometimes, to just join the NA after the ip address, so no port is available
- Summary - the nodes connections command is just very non-deterministic
- Secret leak is occurring on agent service, there should be no authorisation metadata see --format=json
- What's usageCount
Automatic Encoding
For these two formats, encoding is applied by default so that special characters will not mess up the padding for any given output.
- dict format
- will automatically encase any string in a
\"\"
and apply encoding to the input
- will automatically encase any string in a
- table format
- will automatically encase any string in a
\"\"
and apply encoding to the input
- will automatically encase any string in a
Manual Encoding with Utility Functions
For any other format passed into outputFormatter
, there will be no encoding of escapable characters by default.
It is up to the user to use the following functions in src/utils/utils.ts
to encode parts of their input:
/**
* This function:
*
* 1. Keeps regular spaces, only ' ', as they are.
* 2. Converts \\n \\r \\t to escaped versions, \\\\n \\\\r and \\\\t.
* 3. Converts other control characters to their Unicode escape sequences.\
* 4. Converts ' \` " to escaped versions, \\\\' \\\\\` and \\\\"
*
* Unless you're using this in a `JSON.stringify` replacer, you probably want to use {@link encodeEscapedWrapped} instead.
*/
function encodeEscaped(str: string): string
/**
* This function:
* 1. Keeps regular spaces, only ' ', as they are.
* 2. Converts \\n \\r \\t to escaped versions, \\\\n \\\\r and \\\\t.
* 3. Converts other control characters to their Unicode escape sequences.
* 4. Converts ' \` " to escaped versions, \\\\' \\\\\` and \\\\"
* 5. Wraps the whole thing in `""` if any characters have been encoded.
*/
function encodeEscapedWrapped(str: string): string
To use this:
const v = `test ${encodeEscapedWrapped("\u0000\"\n")}` // returns '"\\u0000\\"\\n"'
Note that any encoded strings must be encased in ""
anyways. This is so that when the user copy-pastes the output as the input of another command, or pipes the output to another command, those escaped characters will be collapsed correctly.
Additional context
- Related: 6th Testnet Deployment Polykey#551
Tasks
- 1. Fix up
nodes getall
command, it's throwing an error relating tohost
not being defined. - 2. Review and fix up the
nodes connections
command output formatting. The output is very unclear. - 3. client call metadata is being included in the
nodes connections --format json
output. This should not be the case. - 4.
agent status
command outputs too much information. We should strip out the key and certificate information.
Metadata
Metadata
Assignees
Labels
developmentStandard developmentStandard developmentr&d:polykey:core activity 1Secret Vault Sharing and Secret History ManagementSecret Vault Sharing and Secret History Management