forked from cerc-io/laconicd-deprecated
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c597101ea | ||
|
|
90943bf1e6 | ||
|
|
512136400d | ||
|
|
c0662cb5f1 | ||
|
|
c73dc0d92a | ||
|
|
8f20f25e43 | ||
|
|
08e369aa64 | ||
|
|
40a78c66bf |
@@ -36,7 +36,7 @@ jobs:
|
|||||||
- uses: codecov/codecov-action@v3
|
- uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
file: ./coverage.txt
|
file: ./coverage.txt
|
||||||
fail_ci_if_error: false
|
fail_ci_if_error: true
|
||||||
if: env.GIT_DIFF
|
if: env.GIT_DIFF
|
||||||
|
|
||||||
test-importer:
|
test-importer:
|
||||||
@@ -91,7 +91,6 @@ jobs:
|
|||||||
path: "./laconic-sdk/"
|
path: "./laconic-sdk/"
|
||||||
repository: cerc-io/laconic-sdk
|
repository: cerc-io/laconic-sdk
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: jest_timeout
|
|
||||||
- name: Environment
|
- name: Environment
|
||||||
run: ls -tlh && env
|
run: ls -tlh && env
|
||||||
- name: build containers scripts
|
- name: build containers scripts
|
||||||
@@ -103,30 +102,7 @@ jobs:
|
|||||||
- name: run-tests.sh
|
- name: run-tests.sh
|
||||||
working-directory: tests/sdk_tests
|
working-directory: tests/sdk_tests
|
||||||
run: ./run-tests.sh
|
run: ./run-tests.sh
|
||||||
- name: reset containers for auction tests
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
if: always()
|
|
||||||
run: docker compose down
|
|
||||||
- name: start auction containers
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
run: docker compose -f docker-compose-auctions.yml up -d
|
|
||||||
- name: run-acution-tests.sh
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
run: ./run-auction-tests.sh
|
|
||||||
- name: reset containers for nameservice tests
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
if: always()
|
|
||||||
run: docker compose -f docker-compose-auctions.yml down
|
|
||||||
- name: start auction containers
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
run: docker compose -f docker-compose-nameservice.yml up -d
|
|
||||||
- name: run-nameservice-expiry-tests.sh
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
run: ./run-nameservice-expiry-tests.sh
|
|
||||||
- name: reset containers for nameservice tests
|
|
||||||
working-directory: tests/sdk_tests
|
|
||||||
if: always()
|
|
||||||
run: docker compose -f docker-compose-nameservice.yml down
|
|
||||||
|
|
||||||
# integration_tests:
|
# integration_tests:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ coverage.txt
|
|||||||
sim_log_file
|
sim_log_file
|
||||||
tests/**/tmp/*
|
tests/**/tmp/*
|
||||||
yarn.lock
|
yarn.lock
|
||||||
x/auction/client/testutil/bidder-bafyre*
|
|
||||||
|
|
||||||
# Vagrant
|
# Vagrant
|
||||||
.vagrant/
|
.vagrant/
|
||||||
|
|||||||
+1
-1
@@ -20,7 +20,7 @@ RUN make build
|
|||||||
FROM alpine:3.17.0
|
FROM alpine:3.17.0
|
||||||
|
|
||||||
# Install ca-certificates
|
# Install ca-certificates
|
||||||
RUN apk add --update ca-certificates jq curl
|
RUN apk add --update ca-certificates jq
|
||||||
WORKDIR /
|
WORKDIR /
|
||||||
|
|
||||||
# Copy over binaries from the build-env
|
# Copy over binaries from the build-env
|
||||||
|
|||||||
+62
@@ -0,0 +1,62 @@
|
|||||||
|
# Security
|
||||||
|
|
||||||
|
As part of our vulnerability disclosure policy, we operate a security vulnerability program through [Immunefi](https://immunefi.com/). This document serves as a complementary guideline for reporting vulnerabilities and how the disclosure process is managed. Please refer to the official Evmos [bug bounty program](https://immunefi.com/bounty/evmos/) for up-to-date information.
|
||||||
|
|
||||||
|
## Guidelines
|
||||||
|
|
||||||
|
We require that all researchers:
|
||||||
|
|
||||||
|
- Use the Evmos [bug bounty program](https://immunefi.com/bounty/evmos/) on Immunefi to disclose all vulnerabilities, and avoid posting vulnerability information in public places, including GitHub, Discord, Telegram, Twitter or other non-private channels.
|
||||||
|
- Make every effort to avoid privacy violations, degradation of user experience, disruption to production systems, and destruction of data.
|
||||||
|
- Keep any information about vulnerabilities that you’ve discovered confidential between yourself and the engineering team until the issue has been resolved and disclosed
|
||||||
|
- Avoid posting personally identifiable information, privately or publicly
|
||||||
|
|
||||||
|
If you follow these guidelines when reporting an issue to us, we commit to:
|
||||||
|
|
||||||
|
- Not pursue or support any legal action related to your research on this vulnerability
|
||||||
|
- Work with you to understand, resolve and ultimately disclose the issue in a timely fashion
|
||||||
|
|
||||||
|
## Disclosure Process
|
||||||
|
|
||||||
|
Evmos uses the following disclosure process:
|
||||||
|
|
||||||
|
1. Once a security report is received via the Immunefi Bug Bounty program, the team works to verify the issue and confirm its severity level using [CVSS](https://nvd.nist.gov/vuln-metrics/cvss) or [Immunefi’s Vulnerability Severity Classification System v2.2](https://immunefi.com/immunefi-vulnerability-severity-classification-system-v2-2/).
|
||||||
|
1. Two people from the affected project will review, replicate and acknowledge the report within 48-96 hours of the alert according to the table below:
|
||||||
|
| Security Level | Hours to First Response (ACK) from Escalation |
|
||||||
|
| -------------------- | --------------------------------------------- |
|
||||||
|
| Critical | 48 |
|
||||||
|
| High | 96 |
|
||||||
|
| Medium | 96 |
|
||||||
|
| Low or Informational | 96 |
|
||||||
|
| None | 96 |
|
||||||
|
|
||||||
|
2. If the report is not applicable or reproducible, the Security Lead (or Security Secondary) will revert to the reporter to request more info or close the report.
|
||||||
|
3. The report is confirmed by the Security Lead to the reporter.
|
||||||
|
2. The team determines the vulnerability’s potential impact on Evmos.
|
||||||
|
1. Vulnerabilities with `Informational` and `Low` categorization will result in creating a public issue.
|
||||||
|
2. Vulnerabilities with `Medium` categorization will result in the creation of an internal ticket and patch of the code.
|
||||||
|
3. Vulnerabilities with `High` or `Critical` will result in the [creation of a new Security Advisory](https://docs.github.com/en/code-security/repository-security-advisories/creating-a-repository-security-advisory)
|
||||||
|
|
||||||
|
Once the vulnerability severity is defined, the following steps apply:
|
||||||
|
|
||||||
|
- For `High` and `Critical`:
|
||||||
|
1. Patches are prepared for supported releases of Evmos in a [temporary private fork](https://docs.github.com/en/code-security/repository-security-advisories/collaborating-in-a-temporary-private-fork-to-resolve-a-repository-security-vulnerability) of the repository.
|
||||||
|
2. Only relevant parties will be notified about an upcoming upgrade. These being validators, the core developer team, and users directly affected by the vulnerability.
|
||||||
|
3. 24 hours following this notification, relevant releases with the patch will be made public.
|
||||||
|
4. The nodes and validators update their Evmos and Ethermint dependencies to use these releases.
|
||||||
|
5. A week (or less) after the security vulnerability has been patched on Evmos, we will disclose that the mentioned release contained a security fix.
|
||||||
|
6. After an additional 2 weeks, we will publish a public announcement of the vulnerability. We also publish a security Advisory on GitHub and publish a [CVE](https://en.wikipedia.org/wiki/Common_Vulnerabilities_and_Exposures)
|
||||||
|
|
||||||
|
- For `Informational` , `Low` and `Medium` severities:
|
||||||
|
1. `Medium` and `Low` severity bug reports are included in a public issue and will be incorporated in the current sprint and patched in the next release. `Informational` reports are additionally categorized as with low or medium priority and might not be included in the next release.
|
||||||
|
2. One week after the releases go out, we will publish a post with further details on the vulnerability as well as our response to it.
|
||||||
|
|
||||||
|
This process can take some time. Every effort will be made to handle the bug in as timely a manner as possible, however, it's important that we follow the process described above to ensure that disclosures are handled consistently and to keep Ethermint and its downstream dependent projects, including but not limited to Evmos, as secure as possible.
|
||||||
|
|
||||||
|
### Payment Process
|
||||||
|
|
||||||
|
The payment process will be executed according to Evmos’s Immunefi Bug Bounty program Rules.
|
||||||
|
|
||||||
|
### Contact
|
||||||
|
|
||||||
|
The Evmos Security Team is constantly being monitored. If you need to reach out to the team directly, please reach out via email: [security@evmos.org](mailto:security@evmos.org)
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
services:
|
|
||||||
laconicd:
|
|
||||||
restart: unless-stopped
|
|
||||||
image: cerc-io/laconicd:local-test
|
|
||||||
environment:
|
|
||||||
- TEST_AUCTION_ENABLED=true
|
|
||||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
|
||||||
volumes:
|
|
||||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
|
||||||
interval: 1s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 30
|
|
||||||
ports:
|
|
||||||
- "6060"
|
|
||||||
- "26657"
|
|
||||||
- "26656"
|
|
||||||
- "9473"
|
|
||||||
- "8545"
|
|
||||||
- "8546"
|
|
||||||
- "9090"
|
|
||||||
- "9091"
|
|
||||||
- "1317"
|
|
||||||
|
|
||||||
sdk-test-runner:
|
|
||||||
image: cerc-io/laconic-sdk-tester:local-test
|
|
||||||
depends_on:
|
|
||||||
laconicd:
|
|
||||||
condition: service_healthy
|
|
||||||
command: tail -F /dev/null
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
services:
|
|
||||||
laconicd:
|
|
||||||
restart: unless-stopped
|
|
||||||
image: cerc-io/laconicd:local-test
|
|
||||||
environment:
|
|
||||||
- TEST_REGISTRY_EXPIRY=true
|
|
||||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
|
||||||
volumes:
|
|
||||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
|
||||||
healthcheck:
|
|
||||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
|
||||||
interval: 1s
|
|
||||||
timeout: 5s
|
|
||||||
retries: 30
|
|
||||||
ports:
|
|
||||||
- "6060"
|
|
||||||
- "26657"
|
|
||||||
- "26656"
|
|
||||||
- "9473"
|
|
||||||
- "8545"
|
|
||||||
- "8546"
|
|
||||||
- "9090"
|
|
||||||
- "9091"
|
|
||||||
- "1317"
|
|
||||||
|
|
||||||
sdk-test-runner:
|
|
||||||
image: cerc-io/laconic-sdk-tester:local-test
|
|
||||||
depends_on:
|
|
||||||
laconicd:
|
|
||||||
condition: service_healthy
|
|
||||||
command: tail -F /dev/null
|
|
||||||
@@ -6,7 +6,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
- ../../init.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "curl", "-v", "http://127.0.0.1:6060"]
|
test: ["CMD", "wget", "-nv", "-t1", "--spider", "http://localhost:6060"]
|
||||||
interval: 1s
|
interval: 1s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 30
|
retries: 30
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
# Get the key from laconicd
|
|
||||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
|
||||||
# Set parameters for the test suite
|
|
||||||
cosmos_chain_id=laconic_9000-1
|
|
||||||
laconicd_rest_endpoint=http://laconicd:1317
|
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
|
||||||
# Run tests
|
|
||||||
docker network inspect sdk_tests_default
|
|
||||||
sleep 30s
|
|
||||||
docker logs sdk_tests-laconicd-1
|
|
||||||
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:auctions"
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
# Get the key from laconicd
|
|
||||||
laconicd_key=$( docker compose exec laconicd echo y | docker compose exec laconicd laconicd keys export mykey --unarmored-hex --unsafe )
|
|
||||||
# Set parameters for the test suite
|
|
||||||
cosmos_chain_id=laconic_9000-1
|
|
||||||
laconicd_rest_endpoint=http://laconicd:1317
|
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
|
||||||
# Run tests
|
|
||||||
docker network inspect sdk_tests_default
|
|
||||||
sleep 30s
|
|
||||||
docker logs sdk_tests-laconicd-1
|
|
||||||
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test:nameservice-expiry"
|
|
||||||
@@ -9,10 +9,4 @@ cosmos_chain_id=laconic_9000-1
|
|||||||
laconicd_rest_endpoint=http://laconicd:1317
|
laconicd_rest_endpoint=http://laconicd:1317
|
||||||
laconicd_gql_endpoint=http://laconicd:9473/api
|
laconicd_gql_endpoint=http://laconicd:9473/api
|
||||||
# Run tests
|
# Run tests
|
||||||
docker network inspect sdk_tests_default
|
|
||||||
sleep 30s
|
|
||||||
docker logs laconicd
|
|
||||||
docker compose exec laconicd sh -c "curl http://127.0.0.1:9473/api"
|
|
||||||
docker compose exec laconicd sh -c "curl http://localhost:9473/api"
|
|
||||||
|
|
||||||
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test"
|
docker compose exec sdk-test-runner sh -c "COSMOS_CHAIN_ID=${cosmos_chain_id} LACONICD_REST_ENDPOINT=${laconicd_rest_endpoint} LACONICD_GQL_ENDPOINT=${laconicd_gql_endpoint} PRIVATE_KEY=${laconicd_key} yarn test"
|
||||||
|
|||||||
+14
-15
@@ -8,16 +8,17 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
canonicalJson "github.com/gibson042/canonicaljson-go"
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
|
||||||
"github.com/ipld/go-ipld-prime/codec/dagcbor"
|
"github.com/ipld/go-ipld-prime/codec/dagcbor"
|
||||||
"github.com/ipld/go-ipld-prime/codec/dagjson"
|
"github.com/ipld/go-ipld-prime/fluent"
|
||||||
"github.com/ipld/go-ipld-prime/linking"
|
"github.com/ipld/go-ipld-prime/linking"
|
||||||
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
|
cidlink "github.com/ipld/go-ipld-prime/linking/cid"
|
||||||
"github.com/ipld/go-ipld-prime/multicodec"
|
"github.com/ipld/go-ipld-prime/multicodec"
|
||||||
basicnode "github.com/ipld/go-ipld-prime/node/basic"
|
|
||||||
"github.com/ipld/go-ipld-prime/storage/memstore"
|
"github.com/ipld/go-ipld-prime/storage/memstore"
|
||||||
|
|
||||||
|
canonicalJson "github.com/gibson042/canonicaljson-go"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
|
basicnode "github.com/ipld/go-ipld-prime/node/basic"
|
||||||
mh "github.com/multiformats/go-multihash"
|
mh "github.com/multiformats/go-multihash"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -67,17 +68,7 @@ func GetAttributeAsString(obj map[string]interface{}, attr string) (string, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes).
|
// CIDFromJSONBytesUsingIpldPrime returns CID (dagcbor) for json (as bytes).
|
||||||
// This is combination of samples for unmarshalling and linking
|
|
||||||
// see: https://pkg.go.dev/github.com/ipld/go-ipld-prime
|
|
||||||
func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
|
func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
|
||||||
np := basicnode.Prototype.Any // Pick a stle for the in-memory data.
|
|
||||||
nb := np.NewBuilder() // Create a builder.
|
|
||||||
err := dagjson.Decode(nb, bytes.NewReader(content)) // Hand the builder to decoding -- decoding will fill it in!
|
|
||||||
if err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
n := nb.Build() // Call 'Build' to get the resulting Node. (It's immutable!)
|
|
||||||
|
|
||||||
lsys := cidlink.DefaultLinkSystem()
|
lsys := cidlink.DefaultLinkSystem()
|
||||||
|
|
||||||
// We want to store the serialized data somewhere.
|
// We want to store the serialized data somewhere.
|
||||||
@@ -96,6 +87,14 @@ func CIDFromJSONBytesUsingIpldPrime(content []byte) (string, error) {
|
|||||||
MhLength: 32, // sha2-256 hash has a 32-byte sum.
|
MhLength: 32, // sha2-256 hash has a 32-byte sum.
|
||||||
}}
|
}}
|
||||||
|
|
||||||
|
// And we need some data to link to! Here's a quick piece of example data:
|
||||||
|
n, err := fluent.Build(basicnode.Prototype.Any, func(na fluent.NodeAssembler) {
|
||||||
|
na.AssignBytes(content)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
// Now: time to apply the LinkSystem, and do the actual store operation!
|
// Now: time to apply the LinkSystem, and do the actual store operation!
|
||||||
lnk, err := lsys.Store(
|
lnk, err := lsys.Store(
|
||||||
linking.LinkContext{}, // The zero value is fine. Configure it it you want cancellability or other features.
|
linking.LinkContext{}, // The zero value is fine. Configure it it you want cancellability or other features.
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package utils
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/stretchr/testify/require"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestAndValidateCIDGeneration(t *testing.T) {
|
|
||||||
testCases := []struct {
|
|
||||||
name string
|
|
||||||
content string
|
|
||||||
expected string
|
|
||||||
}{
|
|
||||||
// empty string and empty json blows up
|
|
||||||
// {
|
|
||||||
// "empty string", "", "bafyreiengp2sbi6ez34a2jctv34bwyjl7yoliteleaswgcwtqzrhmpyt2m",
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// "empty json", "{}", "bafyreihpfkdvib5muloxlj5b3tgdwibjdcu3zdsuhyft33z7gtgnlzlkpm",
|
|
||||||
// },
|
|
||||||
|
|
||||||
{
|
|
||||||
"test record", "{\"build_artifact_cid\":\"QmP8jTG1m9GSDJLCbeWhVSVgEzCPPwXRdCRuJtQ5Tz9Kc9\",\"repo_registration_record_cid\":\"QmSnuWmxptJZdLJpKRarxBMS2Ju2oANVrgbr2xWbie9b2D\",\"tls_cert_cid\":\"QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR\",\"type\":\"WebsiteRegistrationRecord\",\"url\":\"https://cerc.io\",\"version\":\"0.0.1\"}",
|
|
||||||
"bafyreiek4hnoqmits66bjyxswapplweuoqe4en2ux6u772o4y3askpd3ny",
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, tc := range testCases {
|
|
||||||
deprecatedAndCorrect, _ := CIDFromJSONBytes([]byte(tc.content))
|
|
||||||
newImpl, err := CIDFromJSONBytesUsingIpldPrime([]byte(tc.content))
|
|
||||||
require.NoError(t, err)
|
|
||||||
require.Equal(t, deprecatedAndCorrect, newImpl, tc.name)
|
|
||||||
require.Equal(t, tc.expected, newImpl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user