├── VERSION ├── .github ├── labeler.yml ├── workflows │ ├── label-prs.yaml │ ├── lint-typos.yaml │ ├── lint-openapi.yaml │ ├── lint-splinter.yaml │ ├── shell-check.yaml │ ├── lint-dockerfiles.yaml │ ├── test-psql-migrations.yaml │ ├── 0-6-cron-update-status.yaml │ └── test-docker-build.yaml ├── actions │ └── ec2-runners │ │ └── Dockerfile └── typos_config.toml ├── cli ├── packaging │ ├── man │ │ └── README.md │ └── scabbard_circuit_template.yaml └── src │ └── tests │ └── mod.rs ├── splinterd ├── packaging │ ├── man │ │ └── README.md │ └── systemd │ │ ├── splinterd │ │ └── splinterd.service ├── src │ ├── lib.rs │ └── node │ │ └── running │ │ └── biome.rs └── tests │ ├── framework │ ├── circuit_builder │ │ └── veil │ │ │ └── mod.rs │ └── mod.rs │ └── admin_service.rs ├── services ├── scabbard │ ├── cli │ │ └── packaging │ │ │ ├── man │ │ │ └── README.md │ │ │ └── ubuntu │ │ │ └── postinst │ └── libscabbard │ │ └── src │ │ ├── service │ │ ├── rest_api │ │ │ └── mod.rs │ │ ├── factory │ │ │ └── endpoint_provider.rs │ │ └── v3 │ │ │ ├── consensus │ │ │ └── consensus_action_runner │ │ │ │ └── commands │ │ │ │ └── mod.rs │ │ │ └── publisher │ │ │ └── mod.rs │ │ ├── protocol │ │ ├── v3 │ │ │ └── mod.rs │ │ └── mod.rs │ │ ├── migrations │ │ └── diesel │ │ │ ├── mod.rs │ │ │ ├── sqlite │ │ │ └── migrations │ │ │ │ ├── 2022-06-16-154357_supervisor │ │ │ │ └── down.sql │ │ │ │ ├── 2022-05-05-142800-create-scabbard-alarm-table │ │ │ │ └── down.sql │ │ │ │ ├── 2021-09-02-1355000-create-commit-log-tables │ │ │ │ ├── down.sql │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-25-151237-add-consensus-2pc-event-context-view │ │ │ │ └── down.sql │ │ │ │ ├── 2021-10-05-1414000-rename-commit-log-table │ │ │ │ ├── up.sql │ │ │ │ └── down.sql │ │ │ │ ├── 2022-07-25-085317-add-update-context-action-id │ │ │ │ └── down.sql │ │ │ │ ├── 2022-04-21-160128_add_consensus │ │ │ │ └── up.sql │ │ │ │ ├── 2022-07-08-133500-add-consensus-2pc-views │ │ │ │ └── down.sql │ │ │ │ ├── 2022-04-05-153027_scabbard_commit_history │ │ │ │ └── down.sql │ │ │ │ └── 2022-04-21-174800_scabbard_consensus_event_tables │ │ │ │ └── down.sql │ │ │ └── postgres │ │ │ └── migrations │ │ │ ├── 2022-06-16-154357_supervisor │ │ │ └── down.sql │ │ │ ├── 2022-05-05-142800-create-scabbard-alarm-table │ │ │ └── down.sql │ │ │ ├── 2021-09-02-1355000-create-commit-log-tables │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2022-04-21-160128_add_consensus │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2022-07-25-151237-add-consensus-2pc-event-context-view │ │ │ └── down.sql │ │ │ ├── 2021-10-05-1414000-rename-commit-log-table │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2022-07-25-085317-add-update-context-action-id │ │ │ └── down.sql │ │ │ ├── 2022-06-08-133219-remove-action-and-event-position │ │ │ └── up.sql │ │ │ ├── 2022-07-08-133500-add-consensus-2pc-views │ │ │ └── down.sql │ │ │ ├── 2022-04-05-153027_scabbard_commit_history │ │ │ └── down.sql │ │ │ └── 2022-04-21-174800_scabbard_consensus_event_tables │ │ │ └── down.sql │ │ └── store │ │ ├── scabbard_store │ │ ├── alarm.rs │ │ ├── identified.rs │ │ └── two_phase_commit │ │ │ └── mod.rs │ │ ├── commit_hash │ │ └── diesel │ │ │ ├── schema.rs │ │ │ ├── models.rs │ │ │ └── operations │ │ │ └── mod.rs │ │ └── command │ │ └── mod.rs └── echo │ └── libecho │ └── src │ ├── migrations │ ├── diesel │ │ ├── mod.rs │ │ ├── postgres │ │ │ └── migrations │ │ │ │ └── 2022-03-03-141100_create_echo_tables │ │ │ │ └── down.sql │ │ └── sqlite │ │ │ └── migrations │ │ │ └── 2022-01-27-205126_create_echo_tables │ │ │ └── down.sql │ └── mod.rs │ ├── service │ ├── status.rs │ └── message.rs │ ├── store │ └── command │ │ └── mod.rs │ └── lib.rs ├── CODEOWNERS ├── libsplinter └── src │ ├── migrations │ └── diesel │ │ ├── postgres │ │ └── migrations │ │ │ ├── 00000000000000_diesel_initial_setup │ │ │ └── down.sql │ │ │ ├── 2019-12-12-200956_biome_create-keys │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2019-11-13-213120_biome_create_users │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2021-01-07-083000_biome_create_profiles │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2021-06-30-154942_node_id_store │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2021-02-01-150745_add_admin_role │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2019-11-13-214153_biome_create_credentials │ │ │ └── down.sql │ │ │ ├── 2020-03-12-194828_biome_create_refresh_tokens │ │ │ └── down.sql │ │ │ ├── 2019-11-11-231339_biome_create_notifications │ │ │ └── down.sql │ │ │ ├── 2020-12-02-160706_admin_add_display_name │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2020-01-10-204453_biome_add_foreign_key_constraint │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2020-12-08-121200-oauth-create-inflight-requests │ │ │ └── down.sql │ │ │ ├── 2021-05-10-191805_admin_service_add_public_key │ │ │ ├── up.sql │ │ │ └── down.sql │ │ │ ├── 2020-12-22-201542_biome_oauth_timestamp_trigger │ │ │ └── down.sql │ │ │ ├── 2022-02-17-183942_service_lifecycle │ │ │ └── down.sql │ │ │ ├── 2022-02-09-103052_remove_biome_notifications │ │ │ └── up.sql │ │ │ ├── 2021-01-14-155512_admin_service_add_circuit_status │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2020-11-02-144300_biome_create_oauth_users │ │ │ └── down.sql │ │ │ ├── 2020-12-21-145125_admin_service_allow_null │ │ │ ├── down.sql │ │ │ └── up.sql │ │ │ ├── 2020-12-30-115400_add_roles_and_assignments │ │ │ └── down.sql │ │ │ ├── 2020-07-24-133220_registry_create │ │ │ └── down.sql │ │ │ ├── 2021-01-08-162225_admin_service_add_circuit_version │ │ │ ├── up.sql │ │ │ └── down.sql │ │ │ ├── 2020-12-11-172121_biome_remove-users-table │ │ │ └── up.sql │ │ │ ├── 2021-02-09-042200_update-identity-enum │ │ │ └── up.sql │ │ │ └── 2021-04-13-045000_rename_rbac_tables │ │ │ ├── up.sql │ │ │ └── down.sql │ │ ├── mod.rs │ │ └── sqlite │ │ └── migrations │ │ ├── 2019-12-12-200956_biome_create-keys │ │ └── down.sql │ │ ├── 2019-11-13-213120_biome_create_users │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2021-01-07-083000_biome_create_profiles │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2021-06-30-154942_node_id_store │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2021-02-01-150745_add_admin_role │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2019-11-13-214153_biome_create_credentials │ │ └── down.sql │ │ ├── 2020-03-12-194828_biome_create_refresh_tokens │ │ └── down.sql │ │ ├── 2019-11-11-231339_biome_create_notifications │ │ └── down.sql │ │ ├── 2020-12-02-161638_admin_add_display_name │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2020-12-08-121200-oauth-create-inflight-requests │ │ └── down.sql │ │ ├── 2021-05-10-191805_admin_service_add_public_key │ │ ├── up.sql │ │ └── down.sql │ │ ├── 2020-12-22-201542_biome_oauth_timestamp_trigger │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2022-02-17-183942_service_lifecycle │ │ └── down.sql │ │ ├── 2022-02-09-103052_remove_biome_notifications │ │ └── up.sql │ │ ├── 2020-10-28-135000_biome_create_oath_users │ │ └── down.sql │ │ ├── 2020-12-30-115400_add_roles_and_assignments │ │ └── down.sql │ │ ├── 2021-01-14-155512_admin_service_add_circuit_status │ │ ├── down.sql │ │ └── up.sql │ │ ├── 2020-07-24-133220_registry_create │ │ └── down.sql │ │ ├── 2021-01-08-162225_admin_service_add_circuit_version │ │ ├── up.sql │ │ └── down.sql │ │ └── 2021-04-13-045000_rename_rbac_tables │ │ ├── up.sql │ │ └── down.sql │ ├── runtime │ ├── service │ │ ├── instance │ │ │ └── orchestrator │ │ │ │ └── endpoint_provider.rs │ │ ├── timer │ │ │ └── alarm │ │ │ │ └── mod.rs │ │ ├── dispatch │ │ │ └── type_resolver.rs │ │ └── lifecycle_executor │ │ │ └── executor │ │ │ └── message.rs │ └── mod.rs │ ├── rbac │ └── mod.rs │ ├── admin │ ├── error.rs │ ├── client │ │ └── event │ │ │ └── ws │ │ │ └── mod.rs │ ├── service │ │ └── proposal_store │ │ │ ├── factory.rs │ │ │ └── mod.rs │ └── mod.rs │ ├── transport │ ├── raw.rs │ └── socket │ │ └── mod.rs │ ├── oauth │ ├── rest_api │ │ ├── resources │ │ │ ├── mod.rs │ │ │ └── callback.rs │ │ └── actix │ │ │ └── mod.rs │ └── store │ │ └── diesel │ │ ├── schema.rs │ │ └── models.rs │ ├── node_id │ ├── store │ │ └── diesel │ │ │ ├── schema.rs │ │ │ └── models.rs │ └── mod.rs │ ├── biome │ ├── oauth │ │ ├── mod.rs │ │ └── store │ │ │ └── diesel │ │ │ └── schema.rs │ ├── credentials │ │ ├── rest_api │ │ │ └── resources │ │ │ │ ├── token.rs │ │ │ │ ├── authorize.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── credentials.rs │ │ │ │ └── user.rs │ │ ├── store │ │ │ └── diesel │ │ │ │ └── schema.rs │ │ └── mod.rs │ ├── refresh_tokens │ │ ├── mod.rs │ │ └── store │ │ │ └── diesel │ │ │ └── schema.rs │ ├── profile │ │ ├── mod.rs │ │ └── store │ │ │ └── diesel │ │ │ └── schema.rs │ └── key_management │ │ └── store │ │ └── diesel │ │ ├── schema.rs │ │ └── models.rs │ ├── rest_api │ ├── auth │ │ └── authorization │ │ │ ├── rbac │ │ │ └── mod.rs │ │ │ ├── maintenance │ │ │ └── routes │ │ │ │ └── resources.rs │ │ │ └── routes │ │ │ └── resources.rs │ └── errors │ │ └── mod.rs │ ├── events │ ├── ws │ │ ├── web_socket_client_cmd.rs │ │ ├── connection_status.rs │ │ ├── ws_respoonse.rs │ │ └── parse_bytes.rs │ ├── error │ │ └── mod.rs │ ├── reactor │ │ └── reactor_message.rs │ └── mod.rs │ ├── consensus │ └── two_phase │ │ └── mod.rs │ ├── circuit │ └── mod.rs │ ├── service │ ├── instance │ │ ├── orchestrator │ │ │ └── mod.rs │ │ ├── factory │ │ │ ├── mod.rs │ │ │ └── endpoint.rs │ │ └── message_context.rs │ ├── id │ │ └── mod.rs │ └── routable.rs │ ├── threading │ ├── mod.rs │ └── error.rs │ ├── network │ ├── mod.rs │ ├── dispatch │ │ └── peer.rs │ └── auth │ │ └── state_machine │ │ └── challenge_v1 │ │ └── mod.rs │ └── collections │ ├── mod.rs │ └── error.rs ├── rest_api ├── actix_web_4 │ └── src │ │ └── lib.rs ├── actix_web_1 │ └── src │ │ ├── admin │ │ └── resources │ │ │ ├── mod.rs │ │ │ ├── v2 │ │ │ └── mod.rs │ │ │ └── v1 │ │ │ └── mod.rs │ │ ├── biome │ │ └── mod.rs │ │ └── registry │ │ └── resources │ │ └── mod.rs └── common │ └── src │ ├── paging │ └── mod.rs │ ├── lib.rs │ └── scabbard │ └── batches.rs ├── ci ├── hadolint.yaml ├── splinter-dev.yaml └── publish-crates ├── .env ├── tests ├── .env └── migrations │ └── .env ├── docker ├── compose │ ├── .env │ └── run-lint.yaml ├── lint.dockerfile ├── metrics │ ├── grafana │ │ └── provisioning │ │ │ ├── dashboards │ │ │ └── dashboards.yaml │ │ │ └── datasources │ │ │ └── datasource.yaml │ └── telegraf.dockerfile └── typos.dockerfile └── MAINTAINERS.md /VERSION: -------------------------------------------------------------------------------- 1 | 0.7.1 2 | -------------------------------------------------------------------------------- /.github/labeler.yml: -------------------------------------------------------------------------------- 1 | backport-triage: 2 | - '**' 3 | 4 | main: 5 | - '**' 6 | -------------------------------------------------------------------------------- /cli/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for the `splinter` CLI will 2 | be located. 3 | -------------------------------------------------------------------------------- /splinterd/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for `splinterd` will 2 | be located. 3 | -------------------------------------------------------------------------------- /services/scabbard/cli/packaging/man/README.md: -------------------------------------------------------------------------------- 1 | This is the directory where the generated man pages for `scabbard` will be 2 | located. 3 | -------------------------------------------------------------------------------- /CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @agunde406 @ameliabradley @Caleb-Hill @davececchi @dnewh @dplumb94 @isabeltomb @jsmitchell @peterschwarz @ltseeley @rbuysse @RyanLassigBanks @shannynalayna @vaporos 2 | -------------------------------------------------------------------------------- /.github/workflows/label-prs.yaml: -------------------------------------------------------------------------------- 1 | name: "Label PRs" 2 | on: 3 | pull_request_target: 4 | types: [ opened ] 5 | 6 | jobs: 7 | label_pr: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/labeler@v3 11 | with: 12 | repo-token: "${{ secrets.GITHUB_TOKEN }}" 13 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/00000000000000_diesel_initial_setup/down.sql: -------------------------------------------------------------------------------- 1 | -- This file was automatically created by Diesel to setup helper functions 2 | -- and other internal bookkeeping. This file is safe to edit, any future 3 | -- changes will be added to existing projects as new migrations. 4 | 5 | DROP FUNCTION IF EXISTS diesel_manage_updated_at(_tbl regclass); 6 | DROP FUNCTION IF EXISTS diesel_set_updated_at(); 7 | -------------------------------------------------------------------------------- /.github/workflows/lint-typos.yaml: -------------------------------------------------------------------------------- 1 | name: Check For Typos 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_typos: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Check for typos 23 | run: just ci-lint-typos 24 | -------------------------------------------------------------------------------- /.github/workflows/lint-openapi.yaml: -------------------------------------------------------------------------------- 1 | name: Lint OpenAPI spec 2 | 3 | on: 4 | pull_request: 5 | 6 | concurrency: 7 | group: "${{ github.ref }}-${{ github.workflow }}" 8 | cancel-in-progress: true 9 | 10 | jobs: 11 | lint_openapi: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v2 15 | 16 | - name: Display envvars 17 | run: env 18 | 19 | - name: Install Just 20 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 21 | 22 | - name: Lint OpenAPI files 23 | run: just ci-lint-openapi 24 | -------------------------------------------------------------------------------- /.github/workflows/lint-splinter.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Splinter 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | lint_splinter: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run Lint/Clippy on Splinter 26 | run: just ci-lint-splinter 27 | -------------------------------------------------------------------------------- /rest_api/actix_web_4/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /services/scabbard/cli/packaging/ubuntu/postinst: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | -------------------------------------------------------------------------------- /.github/workflows/shell-check.yaml: -------------------------------------------------------------------------------- 1 | name: Shellcheck Splinter CLI 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | shellcheck_splinter: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run Shellcheck on Splinter 26 | run: just ci-shellcheck 27 | -------------------------------------------------------------------------------- /ci/hadolint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2021 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ignored: 16 | - DL3008 17 | - DL3018 18 | -------------------------------------------------------------------------------- /splinterd/packaging/systemd/splinterd: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | #SPLINTERD_ARGS= 16 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/rest_api/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /.github/workflows/lint-dockerfiles.yaml: -------------------------------------------------------------------------------- 1 | name: Lint Splinter Dockerfiles 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | lint_dockerfiles: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Run hadolint on Splinter Dockerfiles 26 | run: just ci-lint-dockerfiles 27 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/factory/endpoint_provider.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/instance/orchestrator/endpoint_provider.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | -------------------------------------------------------------------------------- /tests/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /docker/compose/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /libsplinter/src/rbac/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "store")] 16 | pub mod store; 17 | -------------------------------------------------------------------------------- /tests/migrations/.env: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | ISOLATION_ID=latest 16 | DISTRO=jammy 17 | REPO_VERSION=0.7.1-dev 18 | -------------------------------------------------------------------------------- /libsplinter/src/admin/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub use super::service::error::MarshallingError; 16 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod v1; 16 | pub mod v2; 17 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "runtime-service")] 16 | pub mod service; 17 | -------------------------------------------------------------------------------- /libsplinter/src/transport/raw.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub use super::socket::TcpTransport as RawTransport; 16 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod callback; 16 | pub(super) mod list_users; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/protocol/v3/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod message; 16 | pub mod two_phase_commit; 17 | -------------------------------------------------------------------------------- /cli/src/tests/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module provides integration tests for the splinter CLI. 16 | 17 | mod circuit; 18 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/biome/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "biome-key-management")] 16 | pub mod key_management; 17 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/registry/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod nodes; 16 | pub(super) mod nodes_identity; 17 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | ## Maintainers 2 | 3 | ### Active Maintainers 4 | | Name | GitHub | 5 | | --- | --- | 6 | | Amelia Bradley | ameliabradley | 7 | | Andi Gunderson | agunde406 | 8 | | Caleb Hill | Caleb-Hill | 9 | | Darian Plumb | dplumb94 | 10 | | Dave Cecchi | davececchi | 11 | | Davey Newhall | dnewh | 12 | | Isabel Tomb | isabeltomb | 13 | | James Mitchell | jsmitchell | 14 | | Logan Seeley | ltseeley | 15 | | Peter Schwarz | peterschwarz | 16 | | Ryan Banks | RyanLassigBanks | 17 | | Ryan Beck-Buysse | rbuysse | 18 | | Shannyn Telander | shannynalayna | 19 | | Shawn Amundson | vaporos | 20 | 21 | 22 | # Retired Maintainers 23 | | Name | GitHub | 24 | | --- | --- | 25 | | Anne Chenette | chenette | 26 | | Eloá Franca Verona | eloaverona | 27 | | Zac Skalko | zapplebee | 28 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | node_id { 17 | id -> Text, 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /libsplinter/src/biome/oauth/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Biome functionality to support OAuth authentication methods. 16 | 17 | pub mod store; 18 | -------------------------------------------------------------------------------- /splinterd/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | #[cfg(feature = "node")] 15 | #[macro_use] 16 | extern crate log; 17 | #[cfg(feature = "node")] 18 | pub mod node; 19 | -------------------------------------------------------------------------------- /splinterd/tests/framework/circuit_builder/veil/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Veils that can be used with [`CircuitBuilder`] 16 | 17 | pub mod scabbard; 18 | -------------------------------------------------------------------------------- /cli/packaging/scabbard_circuit_template.yaml: -------------------------------------------------------------------------------- 1 | version: v1 2 | args: 3 | - name: ADMIN_KEYS 4 | required: false 5 | default: $(SIGNER_PUB_KEY) 6 | description: >- 7 | Public keys used to verify transactions in the scabbard service 8 | - name: NODES 9 | required: true 10 | description: "List of node IDs" 11 | - name: SIGNER_PUB_KEY 12 | required: false 13 | description: "Public key of the signer" 14 | rules: 15 | create-services: 16 | service-type: 'scabbard' 17 | service-args: 18 | - key: 'admin_keys' 19 | value: [$(ADMIN_KEYS)] 20 | - key: 'peer_services' 21 | value: '$(ALL_OTHER_SERVICES)' 22 | - key: 'version' 23 | value: '2' 24 | first-service: 'a000' 25 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/token.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Deserialize)] 16 | pub struct RefreshToken { 17 | pub token: String, 18 | } 19 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/rbac/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod handler; 16 | pub mod rest_api; 17 | 18 | pub use handler::RoleBasedAuthorizationHandler; 19 | -------------------------------------------------------------------------------- /rest_api/common/src/paging/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | // There are at least three versions of Request in this crate so the rename is 16 | // worth it. 17 | 18 | pub mod v1; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/protocol/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "scabbardv3")] 16 | pub mod v3; 17 | 18 | pub const SCABBARD_PROTOCOL_VERSION: u32 = 1; 19 | -------------------------------------------------------------------------------- /libsplinter/src/biome/refresh_tokens/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines a basic representation of a user and provides an API to manage credentials. 16 | 17 | pub mod store; 18 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/actix/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod callback; 16 | pub(super) mod list_users; 17 | pub(super) mod login; 18 | pub(super) mod logout; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "postgres")] 16 | pub mod postgres; 17 | #[cfg(feature = "sqlite")] 18 | pub mod sqlite; 19 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/web_socket_client_cmd.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use awc::ws::Frame; 16 | 17 | pub(super) enum WebSocketClientCmd { 18 | Frame(Frame), 19 | Stop, 20 | } 21 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/alarm.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Debug, PartialEq, Eq, Clone)] 16 | pub enum AlarmType { 17 | TwoPhaseCommit, 18 | } 19 | -------------------------------------------------------------------------------- /libsplinter/src/biome/profile/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Biome functionality to support user profiles. 16 | 17 | #[cfg(feature = "rest-api-actix-web-1")] 18 | pub mod rest_api; 19 | pub mod store; 20 | -------------------------------------------------------------------------------- /libsplinter/src/consensus/two_phase/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! A simple n-party, two-phase commit (2PC) consensus algorithm implemented as a `ConsensusEngine` 16 | 17 | pub mod v1; 18 | pub mod v2; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/service/status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Clone, Debug, PartialEq, Eq)] 16 | pub enum EchoServiceStatus { 17 | Prepared, 18 | Finalized, 19 | Retired, 20 | } 21 | -------------------------------------------------------------------------------- /docker/lint.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM splintercommunity/splinter-dev:v13 16 | 17 | ENV PATH=$PATH:/project/splinter/bin 18 | 19 | RUN rustup component add rustfmt clippy 20 | 21 | WORKDIR /project/splinter 22 | -------------------------------------------------------------------------------- /libsplinter/src/circuit/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Circuit routing and message handling. 16 | 17 | pub mod handlers; 18 | pub mod routing; 19 | #[cfg(feature = "circuit-template")] 20 | pub mod template; 21 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/orchestrator/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod factory; 16 | mod service; 17 | 18 | pub use factory::OrchestratableServiceFactory; 19 | pub use service::OrchestratableService; 20 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/errors/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod request_error; 16 | mod rest_api_server_error; 17 | 18 | pub use request_error::RequestError; 19 | pub use rest_api_server_error::RestApiServerError; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-12-12-200956_biome_create-keys/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE keys; 17 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Traits, types, and implementations for interacting with node_id's. 16 | 17 | /// Store logic for accessing and modifying an instances node_id. 18 | pub mod store; 19 | -------------------------------------------------------------------------------- /rest_api/common/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub mod error; 16 | pub mod paging; 17 | #[cfg(feature = "scabbard")] 18 | pub mod scabbard; 19 | pub mod status; 20 | 21 | pub const SPLINTER_PROTOCOL_VERSION: u32 = 2; 22 | -------------------------------------------------------------------------------- /libsplinter/src/biome/refresh_tokens/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | refresh_tokens (id) { 17 | id -> Int8, 18 | user_id -> Text, 19 | token -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-12-12-200956_biome_create-keys/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE keys; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-213120_biome_create_users/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE splinter_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/admin/client/event/ws/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // Unless required by applicable law or agreed to in writing, software 9 | // distributed under the License is distributed on an "AS IS" BASIS, 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11 | // See the License for the specific language governing permissions and 12 | // limitations under the License. 13 | 14 | //! Websocket-backed implementations of the AdminServiceEventClient. 15 | 16 | #[cfg(feature = "admin-service-event-client-actix-web-client")] 17 | pub mod actix_web_client; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-213120_biome_create_users/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE splinter_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-07-083000_biome_create_profiles/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE user_profile; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-06-30-154942_node_id_store/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS node_id; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-07-083000_biome_create_profiles/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE user_profile; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-06-30-154942_node_id_store/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS node_id; 17 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | oauth_inflight_request (id) { 17 | id -> Text, 18 | pkce_verifier -> Text, 19 | client_redirect_url -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-01-150745_add_admin_role/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DELETE FROM roles WHERE id='admin'; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-02-01-150745_add_admin_role/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DELETE FROM roles WHERE id='admin'; 17 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/timer/alarm/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! An alarm can be used to prematurely wake all or specific message handlers 16 | mod channel; 17 | 18 | pub use channel::{ChannelTimerAlarm, ChannelTimerAlarmFactory}; 19 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | user_credentials { 17 | id -> Int8, 18 | user_id -> Text, 19 | username -> Text, 20 | password -> Text, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-214153_biome_create_credentials/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS user_credentials; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-06-16-154357_supervisor/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE supervisor_notification; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-214153_biome_create_credentials/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS user_credentials; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-03-12-194828_biome_create_refresh_tokens/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS refresh_tokens; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-03-12-194828_biome_create_refresh_tokens/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS refresh_tokens; 17 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/postgres/migrations/2022-03-03-141100_create_echo_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | 15 | DROP TABLE echo_services; 16 | DROP TABLE echo_peers; 17 | DROP TABLE echo_requests; 18 | DROP TABLE echo_request_errors; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-06-16-154357_supervisor/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE supervisor_notification; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/v3/consensus/consensus_action_runner/commands/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module contains the commands that will be used by the `ConsensusActionRunner` 16 | 17 | pub mod actions; 18 | pub mod context; 19 | -------------------------------------------------------------------------------- /libsplinter/src/admin/service/proposal_store/factory.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::store::ProposalStore; 16 | 17 | pub trait ProposalStoreFactory: Clone + Send + Sync { 18 | fn new_proposal_store<'a>(&'a self) -> Box; 19 | } 20 | -------------------------------------------------------------------------------- /libsplinter/src/events/error/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod parse_error; 16 | mod reactor_error; 17 | mod web_socket_error; 18 | 19 | pub use parse_error::ParseError; 20 | pub use reactor_error::ReactorError; 21 | pub use web_socket_error::WebSocketError; 22 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/connection_status.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::events::WebSocketError; 16 | 17 | pub(super) enum ConnectionStatus { 18 | Open, 19 | UnexpectedClose(WebSocketError), 20 | Close(Result<(), WebSocketError>), 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-11-231339_biome_create_notifications/down.sql: -------------------------------------------------------------------------------- 1 | -- Licensed under the Apache License, Version 2.0 (the "License"); 2 | -- you may not use this file except in compliance with the License. 3 | -- You may obtain a copy of the License at 4 | -- 5 | -- http://www.apache.org/licenses/LICENSE-2.0 6 | -- 7 | -- Unless required by applicable law or agreed to in writing, software 8 | -- distributed under the License is distributed on an "AS IS" BASIS, 9 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | -- See the License for the specific language governing permissions and 11 | -- limitations under the License. 12 | -- ----------------------------------------------------------------------------- 13 | 14 | DROP TABLE notification_properties; 15 | DROP TABLE user_notifications; 16 | DROP TABLE notifications; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-02-160706_admin_add_display_name/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN display_name; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN display_name; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-11-231339_biome_create_notifications/down.sql: -------------------------------------------------------------------------------- 1 | -- Licensed under the Apache License, Version 2.0 (the "License"); 2 | -- you may not use this file except in compliance with the License. 3 | -- You may obtain a copy of the License at 4 | -- 5 | -- http://www.apache.org/licenses/LICENSE-2.0 6 | -- 7 | -- Unless required by applicable law or agreed to in writing, software 8 | -- distributed under the License is distributed on an "AS IS" BASIS, 9 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 10 | -- See the License for the specific language governing permissions and 11 | -- limitations under the License. 12 | -- ----------------------------------------------------------------------------- 13 | 14 | DROP TABLE notification_properties; 15 | DROP TABLE user_notifications; 16 | DROP TABLE notifications; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-02-161638_admin_add_display_name/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN display_name; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN display_name; 21 | -------------------------------------------------------------------------------- /splinterd/tests/admin_service.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Splinter integration tests. 16 | 17 | // macros_use must come before any modules that make use of the macro 18 | #[macro_use] 19 | mod framework; 20 | 21 | #[cfg(feature = "node")] 22 | mod admin; 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-01-10-204453_biome_add_foreign_key_constraint/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE keys DROP CONSTRAINT biome_user; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-02-160706_admin_add_display_name/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN display_name TEXT; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN display_name TEXT; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-08-121200-oauth-create-inflight-requests/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS oauth_inflight_request; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-02-161638_admin_add_display_name/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN display_name TEXT; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN display_name TEXT; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-08-121200-oauth-create-inflight-requests/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS oauth_inflight_request; 17 | -------------------------------------------------------------------------------- /libsplinter/src/threading/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module will contain components that will be used to support different threading models 16 | 17 | pub(crate) mod error; 18 | pub mod lifecycle; 19 | pub(crate) mod pacemaker; 20 | pub(crate) mod pool; 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-05-10-191805_admin_service_add_public_key/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node ADD COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member ADD COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-05-10-191805_admin_service_add_public_key/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node ADD COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member ADD COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-05-05-142800-create-scabbard-alarm-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_alarm; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-05-05-142800-create-scabbard-alarm-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_alarm; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | scabbard_commit_hash (circuit_id, service_id) { 17 | circuit_id -> Text, 18 | service_id -> Text, 19 | commit_hash -> Text, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-05-10-191805_admin_service_add_public_key/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node DROP COLUMN public_key BYTEA; 18 | 19 | ALTER TABLE circuit_member DROP COLUMN public_key BYTEA; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-06-30-154942_node_id_store/up.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS node_id ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-05-10-191805_admin_service_add_public_key/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | 17 | ALTER TABLE proposed_node DROP COLUMN public_key BINARY; 18 | 19 | ALTER TABLE circuit_member DROP COLUMN public_key BINARY; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-06-30-154942_node_id_store/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS node_id ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/node_id/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use diesel::{Insertable, Queryable}; 16 | 17 | use super::schema::node_id; 18 | 19 | #[derive(Queryable, Insertable)] 20 | #[table_name = "node_id"] 21 | pub struct NodeID { 22 | pub id: String, 23 | } 24 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-09-02-1355000-create-commit-log-tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-160128_add_consensus/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_service DROP COLUMN consensus; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-09-02-1355000-create-commit-log-tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TRIGGER IF EXISTS oauth_user_sessions_timestamp_update; 17 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TRIGGER IF EXISTS oauth_user_sessions_timestamp_update; 17 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/factory/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "rest-api-actix-web-1")] 16 | mod endpoint; 17 | mod service; 18 | 19 | #[cfg(feature = "rest-api-actix-web-1")] 20 | pub use endpoint::EndpointFactory; 21 | pub use service::ServiceFactory; 22 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/ws_respoonse.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// Response object returned by `WebSocket` client callbacks. 16 | #[derive(Debug)] 17 | pub enum WsResponse { 18 | Empty, 19 | Close, 20 | Pong(String), 21 | Text(String), 22 | Bytes(Vec), 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2022-02-17-183942_service_lifecycle/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE service_lifecycle_status; 17 | DROP TABLE service_lifecycle_argument; 18 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-25-151237-add-consensus-2pc-event-context-view/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the Licens 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apachorg/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the Licens 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_events_and_contexts_all; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-25-151237-add-consensus-2pc-event-context-view/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the Licens 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apachorg/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the Licens 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_events_and_contexts_all; 17 | -------------------------------------------------------------------------------- /libsplinter/src/biome/key_management/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | keys (public_key, user_id) { 17 | public_key -> Text, 18 | encrypted_private_key -> Text, 19 | user_id -> Text, 20 | display_name -> Text, 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2022-02-17-183942_service_lifecycle/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE service_lifecycle_status; 17 | DROP TABLE service_lifecycle_argument; 18 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/diesel/sqlite/migrations/2022-01-27-205126_create_echo_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | 15 | DROP TABLE IF EXISTS echo_services; 16 | DROP TABLE IF EXISTS echo_peers; 17 | DROP TABLE IF EXISTS echo_requests; 18 | DROP TABLE IF EXISTS echo_request_errors; 19 | -------------------------------------------------------------------------------- /services/echo/libecho/src/service/message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub enum EchoMessage { 16 | Request { 17 | message: String, 18 | correlation_id: u64, 19 | }, 20 | Response { 21 | message: String, 22 | correlation_id: u64, 23 | }, 24 | } 25 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-10-05-1414000-rename-commit-log-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_log RENAME TO scabbard_commit_hash; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/service/v3/publisher/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod artifact; 16 | mod publisher_context; 17 | 18 | pub use artifact::{SignedTimestamp, SignedTimestampCreator, SignedTimestampCreatorFactory}; 19 | pub use publisher_context::ScabbardPublishingContext; 20 | -------------------------------------------------------------------------------- /libsplinter/src/network/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Network connection management and message dispatching framework. 16 | 17 | pub mod auth; 18 | pub mod connection_manager; 19 | pub mod dispatch; 20 | pub mod handlers; 21 | #[cfg(feature = "runtime-service")] 22 | pub(crate) mod reply; 23 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-10-05-1414000-rename-commit-log-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_hash RENAME TO scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-10-05-1414000-rename-commit-log-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_log RENAME TO scabbard_commit_hash; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-10-05-1414000-rename-commit-log-table/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_commit_hash RENAME TO scabbard_commit_log; 17 | -------------------------------------------------------------------------------- /.github/workflows/test-psql-migrations.yaml: -------------------------------------------------------------------------------- 1 | name: Test PSQL Migrations 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | test_psql_migrations: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | 19 | - name: Display envvars 20 | run: env 21 | 22 | - name: Install Just 23 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 24 | 25 | - name: Test PSQL Migrations 26 | run: just ci-test-migrations 27 | 28 | - uses: actions/upload-artifact@v3 29 | if: failure() 30 | with: 31 | name: pr-${{ github.event.number }}-test-psql-migrations.log 32 | path: ./tests/migrations/test-psql-migrations.log 33 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines a basic API to register and authenticate a User using a username and a password. 16 | //! Not recommended for use in production. 17 | 18 | #[cfg(feature = "rest-api-actix-web-1")] 19 | pub mod rest_api; 20 | pub mod store; 21 | -------------------------------------------------------------------------------- /libsplinter/src/events/reactor/reactor_message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use futures::Future; 16 | 17 | use crate::events::ws::Listen; 18 | 19 | pub(super) enum ReactorMessage { 20 | Stop, 21 | StartWs(Listen), 22 | HttpRequest(Box + Send + 'static>), 23 | } 24 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-25-085317-add-update-context-action-id/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_event DROP COLUMN update_context_action_id; 17 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-25-085317-add-update-context-action-id/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_event DROP COLUMN update_context_action_id; 17 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/authorize.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines results from user authorization. 16 | 17 | use crate::rest_api::sessions::Claims; 18 | 19 | pub(crate) enum AuthorizationResult { 20 | Authorized(Claims), 21 | Unauthorized, 22 | Failed, 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-01-150745_add_admin_role/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | INSERT INTO roles VALUES ('admin', 'Administrator'); 17 | INSERT INTO role_permissions VALUES ('admin', '*'); 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2019-11-13-213120_biome_create_users/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS splinter_user ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-02-01-150745_add_admin_role/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | INSERT INTO roles VALUES ('admin', 'Administrator'); 17 | INSERT INTO role_permissions VALUES ('admin', '*'); 18 | -------------------------------------------------------------------------------- /ci/splinter-dev.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | # ------------------------------------------------------------------------------ 15 | 16 | version: '3.7' 17 | 18 | services: 19 | splinter-dev: 20 | image: splintercommunity/splinter-dev:v13 21 | build: 22 | context: .. 23 | dockerfile: ci/splinter-dev.dockerfile 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-11-13-213120_biome_create_users/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS splinter_user ( 17 | id TEXT PRIMARY KEY 18 | ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2022-02-09-103052_remove_biome_notifications/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE notification_properties; 17 | DROP TABLE user_notifications; 18 | DROP TABLE notifications; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2022-02-09-103052_remove_biome_notifications/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE notification_properties; 17 | DROP TABLE user_notifications; 18 | DROP TABLE notifications; 19 | -------------------------------------------------------------------------------- /libsplinter/src/service/id/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Definitions of structs which represent circuit and service identifiers. 16 | 17 | mod circuit; 18 | mod qualified; 19 | mod service; 20 | 21 | pub use circuit::CircuitId; 22 | pub use qualified::FullyQualifiedServiceId; 23 | pub use service::ServiceId; 24 | -------------------------------------------------------------------------------- /libsplinter/src/transport/socket/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod frame; 16 | mod tcp; 17 | mod tls; 18 | 19 | pub use tcp::TcpTransport; 20 | pub use tls::{TlsConnection, TlsInitError, TlsTransport}; 21 | 22 | #[cfg(test)] 23 | pub mod tests { 24 | pub use super::tls::tests::create_test_tls_transport; 25 | } 26 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/v2/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines the REST API resources for protocol version 2 16 | pub(in super::super) mod circuits; 17 | pub(in super::super) mod circuits_circuit_id; 18 | pub(in super::super) mod proposals; 19 | pub(in super::super) mod proposals_circuit_id; 20 | -------------------------------------------------------------------------------- /.github/workflows/0-6-cron-update-status.yaml: -------------------------------------------------------------------------------- 1 | name: 0-6 Update Branch Status 2 | 3 | on: 4 | workflow_run: 5 | workflows: ["0-6 Cron"] 6 | types: 7 | - completed 8 | 9 | jobs: 10 | update_status: 11 | runs-on: ubuntu-18.04 12 | steps: 13 | - uses: actions/checkout@v2 14 | with: 15 | fetch-depth: 0 16 | ref: 0-6 17 | 18 | - name: get SHA 19 | run: echo "SHA=$(git rev-parse HEAD)" >> $GITHUB_ENV 20 | 21 | - name: Update commit status 22 | run: | 23 | env 24 | curl \ 25 | -X POST \ 26 | -H "Authorization: token ${{ secrets.GH_TOKEN }}" \ 27 | -H "Accept: application/vnd.github.v3+json" \ 28 | https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.SHA }} \ 29 | -d '{"state": "${{ github.event.workflow_run.conclusion }}", "context": "Cron"}' 30 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-01-10-204453_biome_add_foreign_key_constraint/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE keys 17 | ADD CONSTRAINT biome_user FOREIGN KEY (user_id) REFERENCES splinter_user(id); 18 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/maintenance/routes/resources.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2020 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module provides resources for the maintenance mode authorization handler's REST API 16 | //! endpoints 17 | 18 | #[derive(Deserialize)] 19 | pub struct PostMaintenanceModeQuery { 20 | pub enabled: bool, 21 | } 22 | -------------------------------------------------------------------------------- /rest_api/actix_web_1/src/admin/resources/v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines the REST API resources for protocol version 1 16 | 17 | pub(in super::super) mod circuits; 18 | pub(in super::super) mod circuits_circuit_id; 19 | pub(in super::super) mod proposals; 20 | pub(in super::super) mod proposals_circuit_id; 21 | -------------------------------------------------------------------------------- /libsplinter/src/service/routable.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Contains `Routable` trait. 16 | 17 | use super::ServiceType; 18 | 19 | /// Links a component to specific service types. 20 | pub trait Routable { 21 | /// Return a list of associated `ServiceTypes` 22 | fn service_types(&self) -> &[ServiceType]; 23 | } 24 | -------------------------------------------------------------------------------- /.github/actions/ec2-runners/Dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM ubuntu:jammy 16 | 17 | RUN apt-get update && apt-get install -yq --no-install-recommends \ 18 | python3 \ 19 | python3-pip \ 20 | && pip3 install \ 21 | botocore \ 22 | boto3 \ 23 | requests 24 | 25 | COPY aws.py /aws.py 26 | 27 | ENTRYPOINT ["/aws.py"] 28 | -------------------------------------------------------------------------------- /services/echo/libecho/src/migrations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "diesel")] 16 | pub mod diesel; 17 | 18 | #[cfg(feature = "postgres")] 19 | pub use self::diesel::postgres::run_migrations as run_postgres_migrations; 20 | #[cfg(feature = "sqlite")] 21 | pub use self::diesel::sqlite::run_migrations as run_sqlite_migrations; 22 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/message_context.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// The ServiceMessageContext is a struct that provides information about an incoming message. 16 | #[derive(Clone, Debug)] 17 | pub struct ServiceMessageContext { 18 | pub sender: String, 19 | pub circuit: String, 20 | pub correlation_id: String, 21 | } 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-21-160128_add_consensus/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE scabbard_service 17 | ADD COLUMN consensus Text NOT NULL DEFAULT '2PC' 18 | CHECK ( consensus IN ('2PC') ); 19 | -------------------------------------------------------------------------------- /libsplinter/src/admin/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Splinter administrative components. 16 | 17 | #[cfg(feature = "admin-service-client")] 18 | pub mod client; 19 | pub mod error; 20 | pub mod lifecycle; 21 | pub mod messages; 22 | pub mod service; 23 | pub mod store; 24 | mod token; 25 | 26 | pub const CIRCUIT_PROTOCOL_VERSION: i32 = 2; 27 | -------------------------------------------------------------------------------- /libsplinter/src/events/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Low-level websocket-based event client. 16 | 17 | mod error; 18 | mod reactor; 19 | mod ws; 20 | 21 | pub use error::{ParseError, ReactorError, WebSocketError}; 22 | pub use reactor::{Igniter, Reactor, ReactorShutdownSignaler}; 23 | pub use ws::{ParseBytes, WebSocketClient, WsResponse}; 24 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines credentials used to register and authenticate users. 16 | 17 | pub(super) mod authorize; 18 | pub(super) mod credentials; 19 | #[cfg(feature = "biome-key-management")] 20 | pub(super) mod key_management; 21 | pub(super) mod token; 22 | pub(super) mod user; 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-14-155512_admin_service_add_circuit_status/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_status; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_status; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_status; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-10-28-135000_biome_create_oath_users/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP INDEX IF EXISTS idx_oauth_user_access_token; 17 | DROP INDEX IF EXISTS idx_oauth_user_provider_user_ref; 18 | DROP TABLE IF EXISTS oauth_user; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-30-115400_add_roles_and_assignments/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS role_permissions; 17 | DROP TABLE IF EXISTS assignments; 18 | DROP TABLE IF EXISTS roles; 19 | DROP TABLE IF EXISTS identities; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-14-155512_admin_service_add_circuit_status/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_status; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_status; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_status; 24 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-06-08-133219-remove-action-and-event-position/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE consensus_2pc_action DROP COLUMN position; 17 | 18 | ALTER TABLE consensus_2pc_event DROP COLUMN position; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-07-08-133500-add-consensus-2pc-views/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_actions_all; 17 | DROP VIEW consensus_2pc_events_all; 18 | DROP VIEW consensus_2pc_actions_and_events_all; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-07-08-133500-add-consensus-2pc-views/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP VIEW consensus_2pc_actions_all; 17 | DROP VIEW consensus_2pc_events_all; 18 | DROP VIEW consensus_2pc_actions_and_events_all; 19 | -------------------------------------------------------------------------------- /docker/metrics/grafana/provisioning/dashboards/dashboards.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: 1 16 | 17 | providers: 18 | - name: 'splinter-metrics' 19 | orgId: 1 20 | folder: '' 21 | type: file 22 | disableDeletion: false 23 | updateIntervalSeconds: 10 #how often Grafana will scan for changed dashboards 24 | options: 25 | path: /var/lib/grafana/dashboards 26 | -------------------------------------------------------------------------------- /docker/typos.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM alpine:3 16 | 17 | RUN apk add --no-cache curl 18 | 19 | WORKDIR /tmp 20 | 21 | RUN curl -O -L https://github.com/crate-ci/typos/releases/download/v1.10.2/typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz \ 22 | && tar xzvf typos-v1.10.2-x86_64-unknown-linux-musl.tar.gz 23 | 24 | ENV PATH=$PATH:/tmp 25 | 26 | WORKDIR /project 27 | -------------------------------------------------------------------------------- /libsplinter/src/collections/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Collections used within this crate. 16 | 17 | mod bi_hash_map; 18 | mod error; 19 | mod ref_map; 20 | #[cfg(feature = "oauth")] 21 | mod ttl_map; 22 | 23 | pub(crate) use bi_hash_map::BiHashMap; 24 | pub(crate) use ref_map::RefMap; 25 | #[cfg(feature = "oauth")] 26 | pub(crate) use ttl_map::TtlMap; 27 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-11-02-144300_biome_create_oauth_users/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP INDEX IF EXISTS idx_oauth_user_access_token; 17 | DROP INDEX IF EXISTS idx_oauth_user_provider_user_ref; 18 | DROP TABLE IF EXISTS oauth_user; 19 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-21-145125_admin_service_allow_null/down.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE proposed_circuit ALTER COLUMN application_metadata SET NOT NULL; 17 | ALTER TABLE proposed_circuit ALTER COLUMN comments SET NOT NULL; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-21-145125_admin_service_allow_null/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE proposed_circuit ALTER COLUMN application_metadata DROP NOT NULL; 17 | ALTER TABLE proposed_circuit ALTER COLUMN comments DROP NOT NULL; 18 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-30-115400_add_roles_and_assignments/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS role_permissions; 17 | DROP TABLE IF EXISTS assignments; 18 | DROP TABLE IF EXISTS roles; 19 | DROP TABLE IF EXISTS identities; 20 | -------------------------------------------------------------------------------- /rest_api/common/src/scabbard/batches.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use serde::Serialize; 16 | 17 | #[derive(Debug, Clone, PartialEq, Eq, Serialize)] 18 | pub struct BatchLinkResponse<'a> { 19 | link: &'a str, 20 | } 21 | 22 | impl<'a> From<&'a str> for BatchLinkResponse<'a> { 23 | fn from(link: &'a str) -> Self { 24 | Self { link } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-05-153027_scabbard_commit_history/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_service; 17 | DROP TABLE IF EXISTS scabbard_peer; 18 | DROP TABLE IF EXISTS scabbard_v3_commit_history; 19 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-05-153027_scabbard_commit_history/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS scabbard_service; 17 | DROP TABLE IF EXISTS scabbard_peer; 18 | DROP TABLE IF EXISTS scabbard_v3_commit_history; 19 | -------------------------------------------------------------------------------- /splinterd/tests/framework/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! A framework for running a network of Splinter nodes in a single process for 16 | //! integration testing purposes. 17 | 18 | #[cfg(feature = "node")] 19 | pub mod network; 20 | #[macro_use] 21 | #[cfg(feature = "node")] 22 | pub mod shutdown; 23 | #[cfg(feature = "node")] 24 | pub mod circuit_builder; 25 | -------------------------------------------------------------------------------- /libsplinter/src/rest_api/auth/authorization/routes/resources.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Resources for the authorization tools' REST API endpoints 16 | 17 | #[derive(Serialize)] 18 | pub struct PermissionResponse { 19 | pub permission_id: &'static str, 20 | pub permission_display_name: &'static str, 21 | pub permission_description: &'static str, 22 | } 23 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-160128_add_consensus/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | CREATE TYPE scabbard_consensus AS ENUM ('2PC'); 16 | 17 | ALTER TABLE scabbard_service 18 | ADD COLUMN consensus scabbard_consensus NOT NULL Default '2PC'; 19 | -------------------------------------------------------------------------------- /docker/metrics/grafana/provisioning/datasources/datasource.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | apiVersion: 1 16 | 17 | datasources: 18 | - name: splinter_metrics 19 | access: proxy 20 | database: metrics 21 | editable: true 22 | isDefault: true 23 | orgId: 1 24 | password: foobar 25 | type: influxdb 26 | url: http://splinter-influx:8086 27 | user: admin 28 | -------------------------------------------------------------------------------- /libsplinter/src/collections/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Debug, PartialEq, Eq)] 16 | pub struct RefMapRemoveError(pub String); 17 | 18 | impl std::error::Error for RefMapRemoveError {} 19 | 20 | impl std::fmt::Display for RefMapRemoveError { 21 | fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { 22 | f.write_str(&self.0) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /splinterd/packaging/systemd/splinterd.service: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [Unit] 16 | Description=Splinter Daemon 17 | After=network-online.target 18 | 19 | [Service] 20 | User=splinterd 21 | Group=splinterd 22 | EnvironmentFile=-/etc/default/splinterd 23 | ExecStart=/usr/bin/splinterd $SPLINTERD_ARGS 24 | Restart=on-failure 25 | RestartSec=300 26 | 27 | [Install] 28 | WantedBy=multi-user.target 29 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::oauth_inflight_request; 16 | 17 | #[derive(Insertable, Queryable, Identifiable, PartialEq, Eq, Debug)] 18 | #[table_name = "oauth_inflight_request"] 19 | pub struct OAuthInflightRequest { 20 | pub id: String, 21 | pub pkce_verifier: String, 22 | pub client_redirect_url: String, 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/dispatch/type_resolver.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::error::InternalError; 16 | use crate::service::{FullyQualifiedServiceId, ServiceType}; 17 | 18 | pub trait ServiceTypeResolver { 19 | fn resolve_type( 20 | &self, 21 | service_id: &FullyQualifiedServiceId, 22 | ) -> Result, InternalError>; 23 | } 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-07-24-133220_registry_create/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS splinter_nodes; 17 | DROP TABLE IF EXISTS splinter_nodes_endpoints; 18 | DROP TABLE IF EXISTS splinter_nodes_keys; 19 | DROP TABLE IF EXISTS splinter_nodes_metadata; 20 | -------------------------------------------------------------------------------- /.github/typos_config.toml: -------------------------------------------------------------------------------- 1 | # Copyright 2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | [default.extend-words] 16 | OTU = "OTU" 17 | # workaround for false positive in splinterd/api/static/openapi.yaml 18 | # https://github.com/crate-ci/typos/issues/484 19 | 20 | [default.extend-identifiers] 21 | ERRORs = "ERRORs" 22 | # workaround for false positive in tests/migrations/bin/test_psql_migrations 23 | # https://github.com/crate-ci/typos/issues/399 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-07-24-133220_registry_create/down.sql: -------------------------------------------------------------------------------- 1 | --- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS splinter_nodes; 17 | DROP TABLE IF EXISTS splinter_nodes_endpoints; 18 | DROP TABLE IF EXISTS splinter_nodes_keys; 19 | DROP TABLE IF EXISTS splinter_nodes_metadata; 20 | -------------------------------------------------------------------------------- /services/echo/libecho/src/store/command/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod finalize_service; 16 | mod prepare_service; 17 | mod purge_service; 18 | mod retire_service; 19 | 20 | pub use finalize_service::EchoFinalizeServiceCommand; 21 | pub use prepare_service::EchoPrepareServiceCommand; 22 | pub use purge_service::EchoPurgeServiceCommand; 23 | pub use retire_service::EchoRetireServiceCommand; 24 | -------------------------------------------------------------------------------- /libsplinter/src/biome/profile/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | user_profile (user_id) { 17 | user_id -> Text, 18 | subject -> Text, 19 | name -> Nullable, 20 | given_name -> Nullable, 21 | family_name -> Nullable, 22 | email -> Nullable, 23 | picture -> Nullable, 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/events/ws/parse_bytes.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::events::ParseError; 16 | 17 | pub trait ParseBytes: Send + Sync + Clone { 18 | fn from_bytes(bytes: &[u8]) -> Result; 19 | } 20 | 21 | impl ParseBytes> for Vec { 22 | fn from_bytes(bytes: &[u8]) -> Result, ParseError> { 23 | Ok(bytes.to_vec()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /docker/compose/run-lint.yaml: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | version: "3.7" 16 | 17 | services: 18 | 19 | lint-splinter: 20 | build: 21 | context: ../ 22 | dockerfile: ./lint.dockerfile 23 | args: 24 | - http_proxy 25 | - https_proxy 26 | - no_proxy 27 | image: lint-splinter:${ISOLATION_ID} 28 | volumes: 29 | - ../../:/project/splinter 30 | command: just lint 31 | -------------------------------------------------------------------------------- /docker/metrics/telegraf.dockerfile: -------------------------------------------------------------------------------- 1 | # Copyright 2018-2022 Cargill Incorporated 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | FROM ubuntu:bionic 16 | 17 | RUN apt-get update \ 18 | && apt-get install -qy --no-install-recommends \ 19 | ca-certificates \ 20 | tar \ 21 | wget \ 22 | && wget -q https://dl.influxdata.com/telegraf/releases/telegraf_1.17.2-1_amd64.deb \ 23 | && dpkg -i telegraf_1.17.2-1_amd64.deb \ 24 | && rm -r /var/lib/apt/lists/* 25 | 26 | WORKDIR /project 27 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-08-162225_admin_service_add_circuit_version/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-08-162225_admin_service_add_circuit_version/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_version INTEGER DEFAULT 1; 24 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/identified.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | /// A struct used to pair a type to an ID 16 | #[derive(Debug, PartialEq, Eq, Clone)] 17 | pub struct Identified { 18 | pub id: i64, 19 | pub record: T, 20 | } 21 | 22 | impl Identified { 23 | pub fn deconstruct(self) -> (i64, T) { 24 | (self.id, self.record) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2020-12-11-172121_biome_remove-users-table/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | -- Dropping the column with `CASCADE` drops foreign key constraints from all 17 | -- tables that have this constraint 18 | ALTER TABLE splinter_user DROP COLUMN id CASCADE; 19 | 20 | DROP TABLE splinter_user; 21 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/command/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod finalize_service; 16 | mod prepare_service; 17 | mod purge_service; 18 | mod retire_service; 19 | 20 | pub use finalize_service::ScabbardFinalizeServiceCommand; 21 | pub use prepare_service::ScabbardPrepareServiceCommand; 22 | pub use purge_service::ScabbardPurgeServiceCommand; 23 | pub use retire_service::ScabbardRetireServiceCommand; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-02-09-042200_update-identity-enum/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TYPE identity_type AS ENUM ('key', 'user'); 17 | 18 | ALTER TABLE identities 19 | ALTER COLUMN identity_type 20 | SET DATA TYPE identity_type 21 | USING (enum_range(null::identity_type))[identity_type::int]; 22 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-04-13-045000_rename_rbac_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE roles RENAME TO rbac_roles; 17 | ALTER TABLE role_permissions RENAME TO rbac_role_permissions; 18 | ALTER TABLE identities RENAME TO rbac_identities; 19 | ALTER TABLE assignments RENAME TO rbac_assignments; 20 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-04-13-045000_rename_rbac_tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE roles RENAME TO rbac_roles; 17 | ALTER TABLE role_permissions RENAME TO rbac_role_permissions; 18 | ALTER TABLE identities RENAME TO rbac_identities; 19 | ALTER TABLE assignments RENAME TO rbac_assignments; 20 | -------------------------------------------------------------------------------- /splinterd/src/node/running/biome.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! This module defines the running biome subsystem. 16 | 17 | use splinter::biome::UserProfileStore; 18 | 19 | pub struct BiomeSubsystem { 20 | pub(crate) profile_store: Box, 21 | } 22 | 23 | impl BiomeSubsystem { 24 | pub fn user_profile_store(&self) -> &dyn UserProfileStore { 25 | &*self.profile_store 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /libsplinter/src/biome/key_management/store/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::keys; 16 | 17 | #[derive(Insertable, Queryable, Identifiable, PartialEq, Eq, Debug)] 18 | #[table_name = "keys"] 19 | #[primary_key(public_key, user_id)] 20 | pub struct KeyModel { 21 | pub public_key: String, 22 | pub encrypted_private_key: String, 23 | pub user_id: String, 24 | pub display_name: String, 25 | } 26 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-04-13-045000_rename_rbac_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE rbac_roles RENAME TO roles; 17 | ALTER TABLE rbac_role_permissions RENAME TO role_permissions; 18 | ALTER TABLE rbac_identities RENAME TO identities; 19 | ALTER TABLE rbac_assignments RENAME TO assignments; 20 | 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-08-162225_admin_service_add_circuit_version/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_version; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_version; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_version; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-04-13-045000_rename_rbac_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE rbac_roles RENAME TO roles; 17 | ALTER TABLE rbac_role_permissions RENAME TO role_permissions; 18 | ALTER TABLE rbac_identities RENAME TO identities; 19 | ALTER TABLE rbac_assignments RENAME TO assignments; 20 | 21 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-08-162225_admin_service_add_circuit_version/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | ALTER TABLE circuit 17 | DROP COLUMN circuit_version; 18 | 19 | ALTER TABLE proposed_circuit 20 | DROP COLUMN circuit_version; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | DROP COLUMN circuit_version; 24 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-14-155512_admin_service_add_circuit_status/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_status INTEGER NOT NULL DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/oauth/rest_api/resources/callback.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[derive(Deserialize)] 16 | pub struct CallbackQuery { 17 | pub code: String, 18 | pub state: String, 19 | } 20 | 21 | pub fn generate_redirect_query(splinter_access_token: &str, display_name: &str) -> String { 22 | format!( 23 | "access_token=OAuth2:{}&display_name={}", 24 | splinter_access_token, display_name 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-14-155512_admin_service_add_circuit_status/up.sql: -------------------------------------------------------------------------------- 1 | ---- Copyright 2018-2020 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- -- 15 | 16 | ALTER TABLE circuit 17 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 18 | 19 | ALTER TABLE proposed_circuit 20 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 21 | 22 | ALTER TABLE admin_event_proposed_circuit 23 | ADD COLUMN circuit_status SMALLINT NOT NULL DEFAULT 1; 24 | -------------------------------------------------------------------------------- /libsplinter/src/threading/error.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use std::{error, fmt}; 16 | 17 | #[derive(Clone, Debug, PartialEq, Eq)] 18 | pub struct PacemakerStartError(pub String); 19 | 20 | impl error::Error for PacemakerStartError {} 21 | 22 | impl fmt::Display for PacemakerStartError { 23 | fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 24 | write!(f, "Pacemaker was unable to start: {}", self.0) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2021-09-02-1355000-create-commit-log-tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS scabbard_commit_log ( 17 | circuit_id TEXT NOT NULL, 18 | service_id TEXT NOT NULL, 19 | commit_hash TEXT NOT NULL, 20 | PRIMARY KEY (circuit_id, service_id) 21 | ); 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/postgres/migrations/2022-04-21-174800_scabbard_consensus_event_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS consensus_2pc_event; 17 | DROP TABLE IF EXISTS consensus_2pc_deliver_event; 18 | DROP TABLE IF EXISTS consensus_2pc_start_event; 19 | DROP TABLE IF EXISTS consensus_2pc_vote_event; 20 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2021-09-02-1355000-create-commit-log-tables/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS scabbard_commit_log ( 17 | circuit_id TEXT NOT NULL, 18 | service_id TEXT NOT NULL, 19 | commit_hash TEXT NOT NULL, 20 | PRIMARY KEY (circuit_id, service_id) 21 | ); 22 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/migrations/diesel/sqlite/migrations/2022-04-21-174800_scabbard_consensus_event_tables/down.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | DROP TABLE IF EXISTS consensus_2pc_event; 17 | DROP TABLE IF EXISTS consensus_2pc_deliver_event; 18 | DROP TABLE IF EXISTS consensus_2pc_start_event; 19 | DROP TABLE IF EXISTS consensus_2pc_vote_event; 20 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/credentials.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Defines credentials used to register and authenticate users. 16 | 17 | #[derive(Deserialize)] 18 | pub(crate) struct UsernamePassword { 19 | pub username: String, 20 | pub hashed_password: String, 21 | } 22 | 23 | #[derive(Serialize)] 24 | pub(crate) struct NewUser<'a> { 25 | pub user_id: &'a str, 26 | pub username: &'a str, 27 | } 28 | -------------------------------------------------------------------------------- /libsplinter/src/biome/credentials/rest_api/resources/user.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #[cfg(feature = "biome-key-management")] 16 | use super::key_management::NewKey; 17 | 18 | #[derive(Deserialize)] 19 | pub(crate) struct ModifyUser { 20 | pub username: String, 21 | pub hashed_password: String, 22 | pub new_password: Option, 23 | #[cfg(feature = "biome-key-management")] 24 | pub new_key_pairs: Vec, 25 | } 26 | -------------------------------------------------------------------------------- /ci/publish-crates: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Copyright 2018-2022 Cargill Incorporated 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License"); 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | 16 | top_dir=$(cd $(dirname $(dirname $0)) && pwd) 17 | 18 | export VERSION=AUTO_STRICT 19 | export REPO_VERSION=$($top_dir/bin/get_version) 20 | 21 | docker build -f ci/publish-splinter-crates.dockerfile -t publish-splinter-crates ci/ 22 | docker run \ 23 | --rm \ 24 | -v $(pwd):/project/splinter \ 25 | -e REPO_VERSION=$REPO_VERSION \ 26 | -e CARGO_CRED=$CARGO_TOKEN \ 27 | publish-splinter-crates 28 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/models.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use super::schema::*; 16 | 17 | #[derive(Insertable, Identifiable, AsChangeset)] 18 | #[cfg_attr(test, derive(Debug, PartialEq))] 19 | #[table_name = "scabbard_commit_hash"] 20 | #[primary_key(circuit_id, service_id)] 21 | pub struct NewCommitHash<'a> { 22 | pub circuit_id: &'a str, 23 | pub service_id: &'a str, 24 | pub commit_hash: &'a str, 25 | } 26 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/commit_hash/diesel/operations/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2021 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | pub(super) mod get_current_commit_hash; 16 | pub(super) mod set_current_commit_hash; 17 | 18 | pub struct CommitHashStoreOperations<'a, C> { 19 | conn: &'a C, 20 | } 21 | 22 | impl<'a, C: diesel::Connection> CommitHashStoreOperations<'a, C> { 23 | pub fn new(conn: &'a C) -> Self { 24 | CommitHashStoreOperations { conn } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /libsplinter/src/admin/service/proposal_store/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod admin_service_proposals; 16 | mod admin_service_proposals_factory; 17 | pub mod error; 18 | mod factory; 19 | pub mod proposal_iter; 20 | pub mod store; 21 | 22 | pub use admin_service_proposals::AdminServiceProposals; 23 | pub use admin_service_proposals_factory::AdminServiceProposalsFactory; 24 | pub use factory::ProposalStoreFactory; 25 | pub use store::ProposalStore; 26 | -------------------------------------------------------------------------------- /services/echo/libecho/src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | #![allow(clippy::extra_unused_lifetimes)] 16 | 17 | #[cfg(feature = "diesel_migrations")] 18 | pub mod migrations; 19 | pub mod service; 20 | pub mod store; 21 | 22 | #[macro_use] 23 | #[cfg(any(feature = "sqlite", feature = "postgres"))] 24 | extern crate diesel; 25 | #[cfg(feature = "diesel_migrations")] 26 | #[macro_use] 27 | extern crate diesel_migrations; 28 | #[macro_use] 29 | extern crate serde; 30 | -------------------------------------------------------------------------------- /services/scabbard/libscabbard/src/store/scabbard_store/two_phase_commit/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! Structs and enums specific to the two phase commit consensus algorithm 16 | 17 | mod action; 18 | mod context; 19 | mod event; 20 | mod message; 21 | mod state; 22 | 23 | pub use action::{Action, Notification}; 24 | pub use context::{Context, ContextBuilder, Participant}; 25 | pub use event::Event; 26 | pub use message::Message; 27 | pub use state::State; 28 | -------------------------------------------------------------------------------- /libsplinter/src/network/dispatch/peer.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::peer::interconnect::NetworkMessageSender; 16 | 17 | use super::{MessageSender, PeerId}; 18 | 19 | impl MessageSender for NetworkMessageSender { 20 | fn send(&self, recipient: PeerId, message: Vec) -> Result<(), (PeerId, Vec)> { 21 | NetworkMessageSender::send(self, recipient.into(), message) 22 | .map_err(|(id, msg)| (id.into(), msg)) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2019-12-12-200956_biome_create-keys/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS keys ( 17 | public_key TEXT NOT NULL, 18 | encrypted_private_key TEXT NOT NULL, 19 | user_id TEXT NOT NULL, 20 | display_name TEXT NOT NULL, 21 | PRIMARY KEY(public_key, user_id) 22 | ); 23 | -------------------------------------------------------------------------------- /.github/workflows/test-docker-build.yaml: -------------------------------------------------------------------------------- 1 | name: Build Docker 2 | 3 | on: 4 | pull_request: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | concurrency: 10 | group: "${{ github.ref }}-${{ github.workflow }}" 11 | cancel-in-progress: true 12 | 13 | jobs: 14 | build_docker: 15 | runs-on: ubuntu-18.04 16 | steps: 17 | - uses: actions/checkout@v2 18 | with: 19 | fetch-depth: 0 20 | 21 | - name: Display envvars 22 | run: env 23 | 24 | - name: Install Just 25 | run: curl --proto '=https' --tlsv1.2 -sSf https://just.systems/install.sh | sudo bash -s -- --to /usr/local/bin 26 | 27 | - name: Test Docker Build 28 | run: just docker-build 29 | 30 | - name: Copy Artifacts 31 | run: docker-compose -f docker/compose/copy-debs.yaml up 32 | 33 | - name: Archive Artifacts 34 | run: zip -r splinter-pr${{ github.event.number }}.zip build/* 35 | 36 | - uses: actions/upload-artifact@v2 37 | with: 38 | name: splinter-pr${{ github.event.number }} 39 | path: splinter-pr*.zip 40 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/postgres/migrations/2021-01-07-083000_biome_create_profiles/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS user_profile ( 17 | user_id TEXT PRIMARY KEY, 18 | subject TEXT NOT NULL UNIQUE, 19 | name TEXT, 20 | given_name TEXT, 21 | family_name TEXT, 22 | email TEXT, 23 | picture TEXT 24 | ); 25 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2020-12-22-201542_biome_oauth_timestamp_trigger/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TRIGGER oauth_user_sessions_timestamp_update 17 | AFTER UPDATE on oauth_user_sessions 18 | BEGIN 19 | UPDATE oauth_user_sessions 20 | SET last_authenticated = strftime('%s','now') 21 | WHERE splinter_access_token = old.splinter_access_token; 22 | END; 23 | -------------------------------------------------------------------------------- /libsplinter/src/migrations/diesel/sqlite/migrations/2021-01-07-083000_biome_create_profiles/up.sql: -------------------------------------------------------------------------------- 1 | -- Copyright 2018-2022 Cargill Incorporated 2 | -- 3 | -- Licensed under the Apache License, Version 2.0 (the "License"); 4 | -- you may not use this file except in compliance with the License. 5 | -- You may obtain a copy of the License at 6 | -- 7 | -- http://www.apache.org/licenses/LICENSE-2.0 8 | -- 9 | -- Unless required by applicable law or agreed to in writing, software 10 | -- distributed under the License is distributed on an "AS IS" BASIS, 11 | -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | -- See the License for the specific language governing permissions and 13 | -- limitations under the License. 14 | -- ----------------------------------------------------------------------------- 15 | 16 | CREATE TABLE IF NOT EXISTS user_profile ( 17 | user_id TEXT PRIMARY KEY, 18 | subject TEXT NOT NULL UNIQUE, 19 | name TEXT, 20 | given_name TEXT, 21 | family_name TEXT, 22 | email TEXT, 23 | picture TEXT 24 | ); 25 | -------------------------------------------------------------------------------- /libsplinter/src/biome/oauth/store/diesel/schema.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | table! { 16 | oauth_users (subject) { 17 | subject -> Text, 18 | user_id -> Text, 19 | } 20 | } 21 | 22 | table! { 23 | oauth_user_sessions (splinter_access_token) { 24 | splinter_access_token -> Text, 25 | subject -> Text, 26 | oauth_access_token -> Text, 27 | oauth_refresh_token -> Nullable, 28 | last_authenticated -> BigInt, 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /libsplinter/src/network/auth/state_machine/challenge_v1/mod.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | mod accepting_action; 16 | mod accepting_state; 17 | mod initiating_action; 18 | mod initiating_state; 19 | 20 | pub(crate) use accepting_action::ChallengeAuthorizationAcceptingAction; 21 | pub(crate) use accepting_state::ChallengeAuthorizationAcceptingState; 22 | pub(crate) use initiating_action::ChallengeAuthorizationInitiatingAction; 23 | pub(crate) use initiating_state::ChallengeAuthorizationInitiatingState; 24 | -------------------------------------------------------------------------------- /libsplinter/src/runtime/service/lifecycle_executor/executor/message.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | //! The message used by the LifecycleExecutor to know when to execute service handler 16 | 17 | use crate::service::{FullyQualifiedServiceId, ServiceType}; 18 | 19 | #[derive(Clone, Debug)] 20 | pub enum ExecutorMessage { 21 | WakeUpAll, 22 | WakeUp { 23 | service_type: ServiceType<'static>, 24 | service_id: Option, 25 | }, 26 | Shutdown, 27 | } 28 | -------------------------------------------------------------------------------- /libsplinter/src/service/instance/factory/endpoint.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2018-2022 Cargill Incorporated 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | use crate::service::rest_api::ServiceEndpointProvider; 16 | 17 | pub trait EndpointFactory { 18 | /// Get the [`ServiceEndpoint`] definitions that represent the REST API resources provided by 19 | /// the services that this factory can create. 20 | /// 21 | /// [`ServiceEndpoint`]: rest_api/struct.ServiceEndpoint.html 22 | fn get_rest_endpoint_provider(&self) -> Box; 23 | } 24 | --------------------------------------------------------------------------------