Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(host): update format for serialized claims #1094

Merged

Conversation

connorsmith256
Copy link
Contributor

Feature or Problem

This:

  • updates the serialized format for claims
    • actor and provider claims are now separate, removing the unused fields from each
    • sub (subject), iss, (issuer), caps (capabilities), and rev (revision) are no longer abbreviated
      • serde's alias is used to maintain backwards-compatibility with deserializing
    • capabilities and tags are now Vec<String> instead of a comma-delimited string
      • backwards-compatibility was maintained via a custom deserializer/visitor
    • both abbreviated and non-abbreviated fields are sent over the wire to maintain backwards-compatibility
  • updates wash to expect the non-abbreviated fields

Note wadm needs to be updated to not expect the abbreviated fields as well, before the abbreviated fields can be removed

Related Issues

Resolves #508
Related to #1093

Release Information

Next

Consumer Impact

None for now

Testing

Unit Test(s)

Acceptance or Integration

Manual Verification

Tested e2e with latest released wash, and built with changes in this PR:

wash get claims


                                   Claims
  Issuer          ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW
  Subject         MCFMFDWFHGKELOXPCNCDXKK5OFLHBVEWRAOXR5JSQUD2TOFRE3DFPM7E
  Capabilities    wasmcloud:httpserver,wasmcloud:keyvalue
  Version         0.4.0
  Revision        0

  Issuer          ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW
  Subject         MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5
  Capabilities    wasmcloud:httpserver,wasmcloud:builtin:logging
  Version         0.3.8
  Revision        4
./target/debug/wash get claims


                                   Claims
  Issuer          ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW
  Subject         MCFMFDWFHGKELOXPCNCDXKK5OFLHBVEWRAOXR5JSQUD2TOFRE3DFPM7E
  Capabilities    wasmcloud:httpserver,wasmcloud:keyvalue
  Version         0.4.0
  Revision        0

  Issuer          ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW
  Subject         MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5
  Capabilities    wasmcloud:httpserver,wasmcloud:builtin:logging
  Version         0.3.8
  Revision        4

And also inspected the underlying stored data, to confirm that heterogenous serialized data is supported:

nats kv get LATTICEDATA_default CLAIMS_MCFMFDWFHGKELOXPCNCDXKK5OFLHBVEWRAOXR5JSQUD2TOFRE3DFPM7E --raw | jq
{
  "call_alias": "",
  "capabilities": [
    "wasmcloud:httpserver",
    "wasmcloud:keyvalue"
  ],
  "issuer": "ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW",
  "name": "kvcounter",
  "revision": "0",
  "subject": "MCFMFDWFHGKELOXPCNCDXKK5OFLHBVEWRAOXR5JSQUD2TOFRE3DFPM7E",
  "tags": [],
  "version": "0.4.0"
}

nats kv get LATTICEDATA_default CLAIMS_MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5 --raw | jq
{
  "call_alias": "",
  "caps": "wasmcloud:httpserver,wasmcloud:builtin:logging",
  "contract_id": "",
  "iss": "ACOJJN6WUP4ODD75XEBKKTCCUJJCY5ZKQ56XVKYK4BEJWGVAOOQHZMCW",
  "name": "Echo",
  "rev": "4",
  "sub": "MBCFOPM6JW2APJLXJD3Z5O4CN7CPYJ2B4FTKLJUR5YR5MITIU7HD3WD5",
  "tags": "",
  "version": "0.3.8"
}

@connorsmith256 connorsmith256 requested review from a team as code owners November 26, 2023 00:02
Copy link
Contributor

@vados-cosmonic vados-cosmonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

Signed-off-by: Connor Smith <connor.smith.256@gmail.com>
@connorsmith256 connorsmith256 merged commit 37618a3 into wasmCloud:main Nov 28, 2023
47 checks passed
@connorsmith256 connorsmith256 deleted the fix/update-stored-claims branch November 28, 2023 21:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Rust Host] Update the serialization format for claims
3 participants