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

Enable COSE Sign1 authentication for governance endpoints #4392

Merged
merged 30 commits into from
Oct 26, 2022
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
66a9946
Reads of public tables do not require authentication
achamayou Oct 20, 2022
9d5d4c6
wip
achamayou Oct 21, 2022
b80ec69
finish removing the wrappers
achamayou Oct 21, 2022
ce21efe
wip
achamayou Oct 21, 2022
6d8797a
more wip
achamayou Oct 21, 2022
46bf90b
wip
achamayou Oct 21, 2022
39911f4
wip
achamayou Oct 22, 2022
94d1629
last TODO, fmt
achamayou Oct 24, 2022
8f2f673
Merge branch 'main' into cose_authn_gov
achamayou Oct 24, 2022
8893a9a
duh
achamayou Oct 24, 2022
a0b1759
fix
achamayou Oct 24, 2022
e6c3f39
fix membership test
achamayou Oct 24, 2022
6a34f68
Merge branch 'main' into cose_authn_gov
achamayou Oct 24, 2022
2aa310e
.
achamayou Oct 24, 2022
9adfd97
missing endpoints
achamayou Oct 25, 2022
7f161b9
test positive ack flow
achamayou Oct 25, 2022
bf0197c
fix
achamayou Oct 25, 2022
dbbfb42
proposal
achamayou Oct 25, 2022
77ddb24
Merge branch 'main' into cose_authn_gov
achamayou Oct 25, 2022
65b3361
changelog
achamayou Oct 25, 2022
9e29ae9
Merge branch 'cose_authn_gov' of https://github.com/achamayou/CCF int…
achamayou Oct 25, 2022
a220091
Merge branch 'main' into cose_authn_gov
achamayou Oct 25, 2022
4766e45
more tests
achamayou Oct 25, 2022
ad88e1e
suite
achamayou Oct 25, 2022
9c2b435
.
achamayou Oct 25, 2022
1dc4cdc
doc
achamayou Oct 25, 2022
87d9681
Merge branch 'main' into cose_authn_gov
achamayou Oct 26, 2022
cef6a1e
Update doc/schemas/gov_openapi.json
achamayou Oct 26, 2022
ba4eb42
Merge branch 'main' into cose_authn_gov
jumaffre Oct 26, 2022
e761722
schema, schema...
achamayou Oct 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## Unreleased

### Experimental

- Governance endpoints now support [COSE Sign1](https://www.rfc-editor.org/rfc/rfc8152#page-18) input, as well as signed HTTP requests (#4392).

### Removed

- The functions `starts_with`, `ends_with`, `remove_prefix`, and `remove_suffix`, and the type `remove_cvref` have been removed from `nonstd::`. The C++20 equivalents should be used instead.
Expand Down
17 changes: 14 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -632,16 +632,25 @@ if(BUILD_TESTS)
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_suite.py
CONSENSUS cft
LABEL suite
ADDITIONAL_ARGS --test-duration 150 --test-suite rekey_recovery
--test-suite membership_recovery
ADDITIONAL_ARGS
--test-duration
150
--test-suite
rekey_recovery
--test-suite
membership_recovery
--jinja-templates-path
${CMAKE_SOURCE_DIR}/samples/templates
)

add_e2e_test(
NAME reconfiguration_test_suite
PYTHON_SCRIPT ${CMAKE_SOURCE_DIR}/tests/e2e_suite.py
CONSENSUS cft
LABEL suite
ADDITIONAL_ARGS --test-duration 200 --test-suite reconfiguration
ADDITIONAL_ARGS
--test-duration 200 --test-suite reconfiguration --jinja-templates-path
${CMAKE_SOURCE_DIR}/samples/templates
)

add_e2e_test(
Expand All @@ -658,6 +667,8 @@ if(BUILD_TESTS)
200
--test-suite
all
--jinja-templates-path
${CMAKE_SOURCE_DIR}/samples/templates
)

add_e2e_test(
Expand Down
11 changes: 10 additions & 1 deletion doc/audit/builtin_maps.rst
Original file line number Diff line number Diff line change
Expand Up @@ -365,14 +365,23 @@ Service constitution: JavaScript module, exporting ``validate()``, ``resolve()``
``history``
~~~~~~~~~~~

Governance history of the service, captures all governance requests submitted by members.
Governance history of the service, captures signed governance requests submitted by members.

**Key** Member ID: SHA-256 fingerprint of the member certificate, represented as a hex-encoded string.

**Value** Represented as JSON.

See :cpp:struct:`ccf::SignedReq`

``cose_history``
~~~~~~~~~~~~~~~~

Governance history of the service, captures all COSE Sign 1 governance requests submitted by members.

**Key** Member ID: SHA-256 fingerprint of the member certificate, represented as a hex-encoded string.

**Value** COSE Sign1

``public:ccf.internal.``
------------------------

Expand Down
48 changes: 27 additions & 21 deletions doc/schemas/gov_openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@
}
},
"securitySchemes": {
"member_cose_sign1": {
"description": "Request payload must be a COSE Sign1 document, with expected protected headers.Signer must be a member identity registered with this service.",
"scheme": "cose_sign1",
"type": "http"
},
"member_signature": {
"description": "Request must be signed according to the HTTP Signature scheme. The signer must be a member identity registered with this service.",
"scheme": "signature",
Expand All @@ -487,7 +492,7 @@
"info": {
"description": "This API is used to submit and query proposals which affect CCF's public governance tables.",
"title": "CCF Governance API",
"version": "2.9.8"
"version": "2.11.0"
},
"openapi": "3.0.0",
"paths": {
Expand All @@ -514,6 +519,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand Down Expand Up @@ -541,6 +549,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand Down Expand Up @@ -729,11 +740,6 @@
"$ref": "#/components/responses/default"
}
},
"security": [
{
"member_signature": []
}
],
"x-ccf-forwarding": {
"$ref": "#/components/x-ccf-forwarding/sometimes"
}
Expand Down Expand Up @@ -767,6 +773,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand All @@ -791,11 +800,6 @@
"$ref": "#/components/responses/default"
}
},
"security": [
{
"member_signature": []
}
],
"x-ccf-forwarding": {
"$ref": "#/components/x-ccf-forwarding/sometimes"
}
Expand Down Expand Up @@ -828,11 +832,6 @@
"$ref": "#/components/responses/default"
}
},
"security": [
{
"member_signature": []
}
],
"x-ccf-forwarding": {
"$ref": "#/components/x-ccf-forwarding/sometimes"
}
Expand Down Expand Up @@ -888,6 +887,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand All @@ -912,11 +914,6 @@
"$ref": "#/components/responses/default"
}
},
"security": [
{
"member_signature": []
}
],
"x-ccf-forwarding": {
"$ref": "#/components/x-ccf-forwarding/sometimes"
}
Expand Down Expand Up @@ -970,6 +967,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand Down Expand Up @@ -1029,6 +1029,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand Down Expand Up @@ -1064,6 +1067,9 @@
"security": [
{
"member_signature": []
},
{
"member_cose_sign1": []
}
],
"x-ccf-forwarding": {
Expand Down
12 changes: 11 additions & 1 deletion include/ccf/service/tables/members.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ namespace ccf
/// Signed request containing the last state digest.
std::optional<SignedReq> signed_req = std::nullopt;

/// COSE Sign1 containing the last state digest
std::optional<std::vector<uint8_t>> cose_sign1_req = std::nullopt;

MemberAck() {}

MemberAck(const crypto::Sha256Hash& root) : StateDigest(root) {}
Expand All @@ -117,14 +120,21 @@ namespace ccf
StateDigest(root),
signed_req(signed_req_)
{}

MemberAck(
const crypto::Sha256Hash& root,
const std::vector<uint8_t>& cose_sign1_req_) :
StateDigest(root),
cose_sign1_req(cose_sign1_req_)
{}
};
DECLARE_JSON_TYPE_WITH_BASE_AND_OPTIONAL_FIELDS(MemberAck, StateDigest)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#pragma clang diagnostic ignored "-Wgnu-zero-variadic-macro-arguments"
DECLARE_JSON_REQUIRED_FIELDS(MemberAck)
#pragma clang diagnostic pop
DECLARE_JSON_OPTIONAL_FIELDS(MemberAck, signed_req)
DECLARE_JSON_OPTIONAL_FIELDS(MemberAck, signed_req, cose_sign1_req)
using MemberAcks = ServiceMap<MemberId, MemberAck>;
namespace Tables
{
Expand Down
Loading