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

add RFC for Flux security signatures #391

Merged
merged 1 commit into from
Aug 24, 2023
Merged

Conversation

garlick
Copy link
Member

@garlick garlick commented Aug 22, 2023

Problem: flux security signature format is undocumented.

This is a work in progress RFC that attempts to document the format.

@garlick garlick force-pushed the rfc39 branch 4 times, most recently from b4cd722 to 69ee401 Compare August 23, 2023 13:06
@garlick garlick changed the title WIP: add RFC for Flux security signatures add RFC for Flux security signatures Aug 23, 2023
@garlick
Copy link
Member Author

garlick commented Aug 23, 2023

This is ready for a review when someone has a moment.

Copy link
Contributor

@grondo grondo left a comment

Choose a reason for hiding this comment

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

LGTM! Just a couple suggestions for maybe fleshing out the sign-type=none section. If you don't feel that's necessary then I'm fine with this RFC as is!

Might also be good to have @dun give his approval, so I'll request it.

Signing SHALL consist of the following steps:

#. Set the signature component to the string ``none``.

Copy link
Contributor

Choose a reason for hiding this comment

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

For the curious, include how header and payload are constructed for sign-type=none?

Copy link
Member Author

Choose a reason for hiding this comment

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

The header and payload are the same regardless of mechanism and can be read or written in a mechanism independent manner. Maybe I'd better call that out explicitly!

Well that statement is almost true - the header can optionally contain mechanism specific values, although for none and munge it does not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh duh, sorry you do explicitly state that above but it may be helpful to re-state it in the 'none' section. Sorry!

#. Check that the signature component is the string ``none``.

#. Check that the real user id matches the header userid.

Copy link
Contributor

Choose a reason for hiding this comment

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

Include how payload is extracted?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, you do state that the payload is always base64 encoded, my bad!

Copy link

@dun dun left a comment

Choose a reason for hiding this comment

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

LGTM. I just had a few minor questions on some things that were unclear to me.

The header is not encrypted.

- The *payload* is an arbitrary sequence of zero or more bytes that
SHALL be base64 encoded. The payload is not encrypted.
Copy link

Choose a reason for hiding this comment

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

Do you want to specify a particular variant of base64?

Copy link
Member Author

Choose a reason for hiding this comment

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

Great point. Looks like we're using rfc4648 "standard base64". I'll call that out.

In flux-security, we use libsodium SODIUM_BASE64_VARIANT_ORIGINAL

In flux-core we use ccan base64_maps_rfc4648.


The header SHALL contain the following keys:

version (integer)
Copy link

Choose a reason for hiding this comment

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

How are integers encoded? UTF-8 string? binary values of a certain length? MSBF? etc.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is defined in RFC 38.

version (integer)
The Flux Security Signature version (currently must be set to 1).

mechanism (string)
Copy link

Choose a reason for hiding this comment

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

How is this string encoded? NUL terminated?

Or are integer and string encodings defined in another RFC?

spec_39.rst Outdated
#. Compute the SHA-256 hash digest over HEADER.PAYLOAD

#. Construct a MUNGE payload by concatenating a single byte *hash type* field
of *1* (indicating SHA-256) and the SHA-256 hash digest.
Copy link

Choose a reason for hiding this comment

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

How is the 1 represented? Is this the ASCII character 1? Or a single byte signed or unsigned int?

How is the SHA-256 hash digest represented? As a 64-character string? NUL terminated? Or a 32-byte binary encoding?

Would a delimiter between hash type and hash digest be helpful? If they're both in ASCII, a 65-character string of [0-9A-F] might cause confusion at some point. If they're both in binary, it probably doesn't matter.

Copy link
Member Author

Choose a reason for hiding this comment

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

The 1 is a single byte and the SHA-256 digest is the binary encoding. I'll try to make those more clear.

If they're both in binary, it probably doesn't matter.

This. Although looking back, I'm not sure why it didn't go in the structured HEADER portion.

Problem:  Flux-security signatures are undocumented.

Add RFC 39.
@garlick
Copy link
Member Author

garlick commented Aug 23, 2023

Thanks for the excellent comments @dun - just pushed some tweaks to address them.

@garlick
Copy link
Member Author

garlick commented Aug 24, 2023

Setting MWP, thanks @grondo and @dun!

@mergify mergify bot merged commit 7da7f6e into flux-framework:master Aug 24, 2023
6 checks passed
@garlick garlick deleted the rfc39 branch August 24, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants