refact(bsr): Use JSON for session meta and summary data

The session metadata is provided all at once when a new bsr is opened.
While the session recording metadata records metadata about a recording
while the recording is happening, notably it records each time a new
connection occurs.

The nested structure of the session metadata does not lend itself to the
append-only syntax of the recording meta file. In addition we do not
want to mix different kinds of metadata together. Thus the session
metadata is now written to a separate file in the BSR, and is written as
JSON which better handles the nested structure and allows for simpler
encoding/decoding.

Similarly the summary files are intended to be written to as containers
close and have been switched to JSON.
This commit is contained in:
Timothy Messier committed 2023-05-31 12:18:23 +00:00
1 parent 7dc15f1f39
commit 78ea1a9f3a
50 files changed
+738 -1718

No files matched your search

@@ -2,10 +2,13 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING session.meta
CREATED session.meta
CREATING session.summary
CREATED session.summary
CREATING session-recording.meta
CREATED session-recording.meta
CREATING session-meta.json
CREATED session-meta.json
CLOSED session-meta.json
CREATING session-recording-summary.json
CREATED session-recording-summary.json
CREATING bsrKey.pub
CREATED bsrKey.pub
CLOSING bsrKey.pub
@@ -26,10 +29,10 @@ CREATING pubKeySelfSignature.sign
CREATED pubKeySelfSignature.sign
CLOSING pubKeySelfSignature.sign
CLOSED pubKeySelfSignature.sign
CLOSING session.meta
CLOSED session.meta
CLOSING session.summary
CLOSED session.summary
CLOSING session-recording.meta
CLOSED session-recording.meta
CLOSING session-recording-summary.json
CLOSED session-recording-summary.json
CLOSING SHA256SUM
CLOSED SHA256SUM
CLOSING SHA256SUM.sig
@@ -3,5 +3,6 @@
.* wrappedPrivKey
.* pubKeyBsrSignature.sign
.* pubKeySelfSignature.sign
1aac36a2c36e4de69c5bf3522ada1c7f080ac807f2182c013ec8ddf60bedae10 session.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session.summary
.* session-meta.json
523569b06adc4a1996c7d3833105a48485428e663bf8a11ed9b4d8f84f68b85c session-recording.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 session-recording-summary.json
@@ -2,10 +2,10 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING connection.meta
CREATED connection.meta
CREATING connection.summary
CREATED connection.summary
CREATING connection-recording.meta
CREATED connection-recording.meta
CREATING connection-recording-summary.json
CREATED connection-recording-summary.json
CREATING requests-inbound.data
CREATED requests-inbound.data
CREATING requests-outbound.data
@@ -14,10 +14,10 @@ CLOSING requests-inbound.data
CLOSED requests-inbound.data
CLOSING requests-outbound.data
CLOSED requests-outbound.data
CLOSING connection.meta
CLOSED connection.meta
CLOSING connection.summary
CLOSED connection.summary
CLOSING connection-recording.meta
CLOSED connection-recording.meta
CLOSING connection-recording-summary.json
CLOSED connection-recording-summary.json
CLOSING SHA256SUM
CLOSED SHA256SUM
CLOSING SHA256SUM.sig
@@ -1,4 +1,4 @@
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 requests-inbound.data
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 requests-outbound.data
e4df3504aaa6fee4426f67ba998cdd90f84c579d98db979e589d8ca2ffd1e733 connection.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 connection.summary
e4df3504aaa6fee4426f67ba998cdd90f84c579d98db979e589d8ca2ffd1e733 connection-recording.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 connection-recording-summary.json
@@ -2,10 +2,10 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING channel.meta
CREATED channel.meta
CREATING channel.summary
CREATED channel.summary
CREATING channel-recording.meta
CREATED channel-recording.meta
CREATING channel-recording-summary.json
CREATED channel-recording-summary.json
CREATING messages-inbound.data
CREATED messages-inbound.data
CREATING requests-inbound.data
@@ -22,10 +22,10 @@ CLOSING messages-outbound.data
CLOSED messages-outbound.data
CLOSING requests-outbound.data
CLOSED requests-outbound.data
CLOSING channel.meta
CLOSED channel.meta
CLOSING channel.summary
CLOSED channel.summary
CLOSING channel-recording.meta
CLOSED channel-recording.meta
CLOSING channel-recording-summary.json
CLOSED channel-recording-summary.json
CLOSING SHA256SUM
CLOSED SHA256SUM
CLOSING SHA256SUM.sig
@@ -2,5 +2,5 @@ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 messages-inbou
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 requests-inbound.data
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 messages-outbound.data
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 requests-outbound.data
27a58452605f6e30ca048cc540e9d963c7270212fcb2c7b73fc69e314ffd1902 channel.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 channel.summary
27a58452605f6e30ca048cc540e9d963c7270212fcb2c7b73fc69e314ffd1902 channel-recording.meta
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 channel-recording-summary.json
@@ -0,0 +1,3 @@
id: session_123456789
protocol: TEST
connection: conn_1.connection
@@ -1,36 +0,0 @@
id: session_123456789
protocol: TEST
user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0
worker_publicId: w_12345
worker_version: 0.25.5
worker_sha: beepboopgitsha
staticHost_publicId: host123
staticHostCatalog_publicId: staticcat123
staticHostCatalog_projectId: proj123
staticHost_address: 127.0.0.1
scs123_staticCredentialStore_publicId: scs123
scs123_staticCredentialStore_projectId: proj123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_publicId: scjson123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_projectId: proj123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_objectHmac: hmac
vcs123_vaultCredentialStore_publicId: vcs123
vcs123_vaultCredentialStore_projectId: proj123
vcs123_vaultCredentialStore_vaultAddress: an/address
vcs123_vaultCredentialStore_namespace: name
vcs123_vaultCredentialStore_tlsServerName: imaserver
vcs123_vaultCredentialStore_tlsSkipVerify: false
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_publicId: vl123
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_projectId: proj123
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_vaultPath: /a/path
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_httpMethod: GET
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_credentialType: magic
connection: conn_1.connection
@@ -2,10 +2,13 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING session.meta
CREATED session.meta
CREATING session.summary
CREATED session.summary
CREATING session-recording.meta
CREATED session-recording.meta
CREATING session-meta.json
CREATED session-meta.json
CLOSED session-meta.json
CREATING session-recording-summary.json
CREATED session-recording-summary.json
CREATING bsrKey.pub
CREATED bsrKey.pub
CLOSING bsrKey.pub
@@ -3,3 +3,4 @@
.* wrappedPrivKey
.* pubKeyBsrSignature.sign
.* pubKeySelfSignature.sign
.* session-meta.json
@@ -2,7 +2,7 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING connection.meta
CREATED connection.meta
CREATING connection.summary
CREATED connection.summary
CREATING connection-recording.meta
CREATED connection-recording.meta
CREATING connection-recording-summary.json
CREATED connection-recording-summary.json
@@ -2,7 +2,7 @@ CREATING SHA256SUM.sig
CREATED SHA256SUM.sig
CREATING SHA256SUM
CREATED SHA256SUM
CREATING channel.meta
CREATED channel.meta
CREATING channel.summary
CREATED channel.summary
CREATING channel-recording.meta
CREATED channel-recording.meta
CREATING channel-recording-summary.json
CREATED channel-recording-summary.json
@@ -0,0 +1,2 @@
id: session_123456789
protocol: TEST
@@ -1,35 +0,0 @@
id: session_123456789
protocol: TEST
user_publicId: user123
user_scope_publicId: global
user_scope_type: global
target_publicId: target123
target_scope_publicId: proj123
target_scope_type: project
target_scope_parentId: org123
target_defaultPort: 0
target_sessionMaxSeconds: 0
target_sessionConnectionLimit: 0
worker_publicId: w_12345
worker_version: 0.25.5
worker_sha: beepboopgitsha
staticHost_publicId: host123
staticHostCatalog_publicId: staticcat123
staticHostCatalog_projectId: proj123
staticHost_address: 127.0.0.1
scs123_staticCredentialStore_publicId: scs123
scs123_staticCredentialStore_projectId: proj123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_publicId: scjson123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_projectId: proj123
scs123_staticCredentialStore_credential_scjson123_staticJsonCredential_objectHmac: hmac
vcs123_vaultCredentialStore_publicId: vcs123
vcs123_vaultCredentialStore_projectId: proj123
vcs123_vaultCredentialStore_vaultAddress: an/address
vcs123_vaultCredentialStore_namespace: name
vcs123_vaultCredentialStore_tlsServerName: imaserver
vcs123_vaultCredentialStore_tlsSkipVerify: false
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_publicId: vl123
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_projectId: proj123
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_vaultPath: /a/path
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_httpMethod: GET
vcs123_vaultCredentialStore_credential_vl123_vaultLibrary_credentialType: magic