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!: change grpc deny to allow #6177

Closed

Conversation

stringhandler
Copy link
Collaborator

Description

Removes the antipattern of a deny list and puts in an allow list

Motivation and Context

A deny list is an antipattern because new methods are not automatically added to the list

How Has This Been Tested?

Tested with dan testing

What process can a PR reviewer use to test or verify this change?

Breaking Changes

  • None
  • Requires data directory on base node to be deleted
  • Requires hard fork
  • Other - Please specify

BREAKING CHANGE: Removed grpc_server_deny_methods and added grpc_server_allow_methods

@@ -13,39 +14,26 @@ grpc_enabled = true
#grpc_tls_enabled = false

# Uncomment all gRPC server methods that should be denied default (only active when `grpc_enabled = true`)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# Uncomment all gRPC server methods that should be denied default (only active when `grpc_enabled = true`)
# All gRPC server methods that should be allowed (only active when `grpc_enabled = true`)

@ghpbot-tari-project ghpbot-tari-project added P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged labels Mar 1, 2024
Comment on lines +17 to +38
grpc_server_allow_methods = [
"get_version",
"check_for_updates",
"get_sync_info",
"get_sync_progress",
#"get_tip_info",
"identify",
"get_network_status",
#"list_headers",
"get_header_by_hash",
"get_blocks",
"get_block_timing",
"get_constants",
"get_block_size",
"get_block_fees",
#"get_tokens_in_circulation",
#"get_network_difficulty",
#"get_new_block_template",
#"get_new_block",
#"get_new_block_blob",
#"submit_block",
#"submit_block_blob",
#"submit_transaction",
#"search_kernels",
#"search_utxos",
#"fetch_matching_utxos",
"get_peers",
"get_mempool_transactions",
#"transaction_state",
#"list_connected_peers",
#"get_mempool_stats",
#"get_active_validator_nodes",
#"get_shard_key",
#"get_template_registrations",
#"get_side_chain_utxos",
"get_tip_info",
"list_headers",
"get_tokens_in_circulation",
"get_network_difficulty",
"get_new_block_template",
"get_new_block",
"get_new_block_blob",
"submit_block",
"submit_block_blob",
"submit_transaction",
"search_kernels",
"search_utxos",
"fetch_matching_utxos",
"transaction_state",
"list_connected_peers",
"get_mempool_stats",
"get_active_validator_nodes",
"get_shard_key",
"get_template_registrations",
"get_side_chain_utxos",
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add the missing methods back in but commented out

Comment on lines +17 to 18
grpc_server_allow_methods = [
"get_version",
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto other methods commented out

Copy link

github-actions bot commented Mar 1, 2024

Test Results (Integration tests)

12 tests  +12   12 ✅ +12   59s ⏱️ +59s
 2 suites + 2    0 💤 ± 0 
 2 files   + 2    0 ❌ ± 0 
 1 errors

For more details on these parsing errors, see this check.

Results for commit 65dd095. ± Comparison against base commit 464f2c3.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Mar 1, 2024

Test Results (CI)

    3 files    117 suites   39m 12s ⏱️
1 263 tests 1 263 ✅ 0 💤 0 ❌
3 781 runs  3 781 ✅ 0 💤 0 ❌

Results for commit 65dd095.

♻️ This comment has been updated with latest results.

Comment on lines 16 to +17
# Uncomment all gRPC server methods that should be denied default (only active when `grpc_enabled = true`)
grpc_server_deny_methods = [
grpc_server_allow_methods = [
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is still outdated

Comment on lines 16 to +17
# Uncomment all gRPC server methods that should be denied default (only active when `grpc_enabled = true`)
grpc_server_deny_methods = [
grpc_server_allow_methods = [
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto comment outdated

Comment on lines 188 to 189
base_node_config.base_node.grpc_server_allow_methods = vec![];

Copy link
Contributor

@hansieodendaal hansieodendaal Mar 1, 2024

Choose a reason for hiding this comment

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

I suspect this list must be fully populated now instead of being left empty.
Cucumber errors:

Captured output: called `Result::unwrap()` on an `Err` value: Status { code: PermissionDenied, message: "`ListConnectedPeers` method not made available"
Step panicked. Captured output: called `Result::unwrap()` on an `Err` value: ExitError { exit_code: GrpcError, details: Some("Base node not responding to gRPC requests: 'get_new_block_template'") }
Step panicked. Captured output: called `Result::unwrap()` on an `Err` value: Status { code: PermissionDenied, message: "`GetTipInfo` method not made available",

@SWvheerden
Copy link
Collaborator

Replacing this with: #6218

@SWvheerden SWvheerden closed this Mar 14, 2024
SWvheerden added a commit that referenced this pull request Mar 20, 2024
Description
---
Removes the antipattern of a deny list and puts in an allow list

Motivation and Context
---
A deny list is an antipattern because new methods are not automatically
added to the list

Replaces: #6177

---------

Co-authored-by: stringhandler <[email protected]>
Co-authored-by: Stan Bondi <[email protected]>
Co-authored-by: Hansie Odendaal <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-acks_required Process - Requires more ACKs or utACKs P-reviews_required Process - Requires a review from a lead maintainer to be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants