Skip to content

Commit 81da84f

Browse files
authored
fix: apply changes from external audit (#42)
1 parent 898e5c5 commit 81da84f

65 files changed

Lines changed: 2943 additions & 1306 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/vuln_nancy.yaml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,32 @@
11
name: Scan Vulnerabilities
2-
32
on:
43
pull_request:
54
paths:
65
- 'go.mod'
76
- 'go.sum'
8-
97
jobs:
108
nancy-scan:
119
runs-on: ubuntu-latest
12-
1310
steps:
14-
- name: Checkout code
15-
uses: actions/checkout@v4
16-
17-
- name: Set up Go
18-
uses: actions/setup-go@v5
19-
with:
20-
go-version-file: go.mod
21-
22-
- name: Run Nancy vulnerability scanner
23-
run: make nancy
24-
11+
- name: Checkout code
12+
uses: actions/checkout@v4
13+
- name: Set up Go
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version-file: go.mod
17+
- name: Run Nancy vulnerability scanner
18+
run: make nancy
19+
env:
20+
NANCY_TOKEN: ${{secrets.NANCY_TOKEN}}
21+
NANCY_USER: ${{secrets.NANCY_USER}}
2522
vulncheck:
2623
runs-on: ubuntu-latest
27-
2824
steps:
2925
- name: Checkout code
3026
uses: actions/checkout@v4
31-
3227
- name: Set up Go
3328
uses: actions/setup-go@v5
3429
with:
3530
go-version-file: go.mod
36-
3731
- name: Run vulncheck
3832
run: go tool govulncheck ./...

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,11 @@ nancy:
9696
@go list -json -deps ./... | docker run --rm -i \
9797
--volume "$(PWD)":/workspace \
9898
--workdir /workspace \
99+
-e NANCY_USER \
100+
-e NANCY_TOKEN \
99101
$(NANCY_IMAGE) sleuth \
102+
--username $(NANCY_USER) \
103+
--token $(NANCY_TOKEN) \
100104
--exclude-vulnerability-file .nancy-ignore
101105
@echo "Completed Nancy vulnerability scan!"
102106

api/component/dispatcher/v1/query.pulsar.go

Lines changed: 586 additions & 206 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/component/forwarder/v1/query.pulsar.go

Lines changed: 326 additions & 133 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

controller/action/fee.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,5 +240,5 @@ func ComputeFeeAmount(amount math.Int, basisPoints uint64) (math.Int, error) {
240240
return math.ZeroInt(), err
241241
}
242242

243-
return fee.QuoRaw(core.BPSNormalizer), nil
243+
return fee.QuoRaw(actiontypes.BPSNormalizer), nil
244244
}

controller/action/fee_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ func TestComputeFeesToDistribute(t *testing.T) {
220220
feesInfo: []*actiontypes.FeeInfo{
221221
{
222222
Recipient: recipient1.String(),
223-
BasisPoints: core.BPSNormalizer, // 100%
223+
BasisPoints: actiontypes.BPSNormalizer, // 100%
224224
},
225225
},
226226
expFeeToDistribute: &actiontypes.FeesToDistribute{
@@ -390,7 +390,7 @@ func TestValidateAttributes(t *testing.T) {
390390
FeesInfo: []*actiontypes.FeeInfo{
391391
{
392392
Recipient: recipient.String(),
393-
BasisPoints: core.BPSNormalizer + 1,
393+
BasisPoints: actiontypes.BPSNormalizer + 1,
394394
},
395395
},
396396
},
@@ -446,7 +446,7 @@ func TestValidateAttributes(t *testing.T) {
446446
FeesInfo: []*actiontypes.FeeInfo{
447447
{
448448
Recipient: recipient.String(),
449-
BasisPoints: core.BPSNormalizer,
449+
BasisPoints: actiontypes.BPSNormalizer,
450450
},
451451
},
452452
},

controller/adapter/ibc_test.go

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package adapter_test
2222

2323
import (
24+
"encoding/json"
2425
"testing"
2526

2627
"github.com/stretchr/testify/require"
@@ -34,6 +35,7 @@ import (
3435
"github.com/noble-assets/orbiter/testutil"
3536
"github.com/noble-assets/orbiter/testutil/testdata"
3637
"github.com/noble-assets/orbiter/types"
38+
forwardingtypes "github.com/noble-assets/orbiter/types/controller/forwarding"
3739
"github.com/noble-assets/orbiter/types/core"
3840
)
3941

@@ -109,6 +111,42 @@ func TestParsePayload(t *testing.T) {
109111
},
110112
},
111113
},
114+
// NOTE: the following test case comes from an external audit report.
115+
{
116+
name: "success - orbiter payload with incomplete CCTP attributes",
117+
setup: func(reg codectypes.InterfaceRegistry) {
118+
reg.RegisterImplementations(
119+
(*core.ForwardingAttributes)(nil),
120+
&forwardingtypes.CCTPAttributes{},
121+
)
122+
},
123+
payloadBz: func() []byte {
124+
memo := map[string]any{
125+
"orbiter": map[string]any{
126+
"forwarding": map[string]any{
127+
"protocol_id": 2,
128+
"attributes": map[string]any{
129+
"@type": "/noble.orbiter.controller.forwarding.v1.CCTPAttributes",
130+
"mint_recipient": "PNWAxASH2RPmgMV+/Tb4e78ON1WL8SoFGnwbWWHxfuA=",
131+
},
132+
},
133+
},
134+
}
135+
136+
memoBz, err := json.MarshalIndent(memo, "", " ")
137+
require.NoError(t, err)
138+
139+
return memoBz
140+
}(),
141+
expectPayload: &core.Payload{
142+
Forwarding: &core.Forwarding{
143+
ProtocolId: core.PROTOCOL_CCTP,
144+
Attributes: &codectypes.Any{
145+
TypeUrl: "/noble.orbiter.controller.forwarding.v1.CCTPAttributes",
146+
},
147+
},
148+
},
149+
},
112150
}
113151

114152
for _, tc := range testCases {
@@ -120,8 +158,7 @@ func TestParsePayload(t *testing.T) {
120158
}
121159

122160
parser, err := adapterctrl.NewIBCParser(encCfg.Codec)
123-
require.NoError(t, err)
124-
161+
require.NoError(t, err, "expected no error creating parser")
125162
payload, err := parser.ParsePayload(tc.payloadBz)
126163

127164
if tc.expErr != "" {
@@ -132,12 +169,10 @@ func TestParsePayload(t *testing.T) {
132169
require.Equal(t, tc.expectPayload.Forwarding.ProtocolId, payload.Forwarding.ProtocolId, "expected different id")
133170
require.Equal(t, tc.expectPayload.Forwarding.Attributes.TypeUrl, payload.Forwarding.Attributes.TypeUrl, "expected different forwarding attributes type url")
134171

135-
if tc.expectPayload.PreActions != nil {
136-
require.Len(t, payload.PreActions, len(tc.expectPayload.PreActions))
137-
if len(payload.PreActions) > 0 {
138-
require.Equal(t, tc.expectPayload.PreActions[0].Id, payload.PreActions[0].Id)
139-
require.Equal(t, tc.expectPayload.PreActions[0].Attributes.TypeUrl, payload.PreActions[0].Attributes.TypeUrl)
140-
}
172+
require.Len(t, payload.PreActions, len(tc.expectPayload.PreActions))
173+
if len(tc.expectPayload.PreActions) != 0 {
174+
require.Equal(t, tc.expectPayload.PreActions[0].Id, payload.PreActions[0].Id)
175+
require.Equal(t, tc.expectPayload.PreActions[0].Attributes.TypeUrl, payload.PreActions[0].Attributes.TypeUrl)
141176
}
142177
}
143178
})

depinject.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ func InjectForwardingControllers(in ComponentsInputs) {
138138
panic(errorsmod.Wrap(err, "error creating internal controller"))
139139
}
140140

141-
in.Orbiters.SetForwardingControllers(cctp, hyperlane, internal)
141+
if err := in.Orbiters.SetForwardingControllers(cctp, hyperlane, internal); err != nil {
142+
panic(errorsmod.Wrap(err, "error setting forwarder controllers"))
143+
}
142144
}
143145

144146
func InjectActionControllers(in ComponentsInputs) {
@@ -151,7 +153,9 @@ func InjectActionControllers(in ComponentsInputs) {
151153
panic(errorsmod.Wrap(err, "error creating fee controller"))
152154
}
153155

154-
in.Orbiters.SetActionControllers(fee)
156+
if err := in.Orbiters.SetActionControllers(fee); err != nil {
157+
panic(errorsmod.Wrap(err, "error setting action controllers"))
158+
}
155159
}
156160

157161
func InjectAdapterControllers(in ComponentsInputs) {
@@ -163,5 +167,7 @@ func InjectAdapterControllers(in ComponentsInputs) {
163167
panic(errorsmod.Wrap(err, "error creating IBC adapter"))
164168
}
165169

166-
in.Orbiters.SetAdapterControllers(ibc)
170+
if err := in.Orbiters.SetAdapterControllers(ibc); err != nil {
171+
panic(errorsmod.Wrap(err, "error setting adapter controllers"))
172+
}
167173
}

e2e/go.mod

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ go 1.24
55
require (
66
cosmossdk.io/errors v1.0.2
77
cosmossdk.io/math v1.5.1
8+
github.com/bcp-innovations/hyperlane-cosmos v1.0.1
89
github.com/circlefin/noble-cctp v0.0.0-20241031192117-4285c94ec194
910
github.com/circlefin/noble-fiattokenfactory v0.0.0-20250123235012-5f9bd9dd2c5b
1011
github.com/cometbft/cometbft v0.38.17
@@ -13,14 +14,14 @@ require (
1314
github.com/cosmos/ibc-go/v8 v8.6.1
1415
github.com/noble-assets/orbiter v0.0.0-00010101000000-000000000000
1516
github.com/strangelove-ventures/interchaintest/v8 v8.8.0
16-
github.com/stretchr/testify v1.10.0
17+
github.com/stretchr/testify v1.11.1
1718
go.uber.org/zap v1.27.0
1819
)
1920

2021
require (
21-
cel.dev/expr v0.23.0 // indirect
22+
cel.dev/expr v0.24.0 // indirect
2223
cloud.google.com/go v0.121.2 // indirect
23-
cloud.google.com/go/auth v0.16.2 // indirect
24+
cloud.google.com/go/auth v0.16.3 // indirect
2425
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
2526
cloud.google.com/go/compute/metadata v0.7.0 // indirect
2627
cloud.google.com/go/iam v1.5.2 // indirect
@@ -56,15 +57,14 @@ require (
5657
github.com/StirlingMarketingGroup/go-namecase v1.0.0 // indirect
5758
github.com/avast/retry-go/v4 v4.5.1 // indirect
5859
github.com/aws/aws-sdk-go v1.44.224 // indirect
59-
github.com/bcp-innovations/hyperlane-cosmos v1.0.1 // indirect
6060
github.com/beorn7/perks v1.0.1 // indirect
6161
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
6262
github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect
6363
github.com/bits-and-blooms/bitset v1.20.0 // indirect
6464
github.com/cenkalti/backoff/v4 v4.1.3 // indirect
6565
github.com/cespare/xxhash/v2 v2.3.0 // indirect
6666
github.com/chzyer/readline v1.5.1 // indirect
67-
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f // indirect
67+
github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect
6868
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
6969
github.com/cockroachdb/errors v1.12.0 // indirect
7070
github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect
@@ -124,7 +124,7 @@ require (
124124
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
125125
github.com/gogo/googleapis v1.4.1 // indirect
126126
github.com/gogo/protobuf v1.3.3 // indirect
127-
github.com/golang/glog v1.2.4 // indirect
127+
github.com/golang/glog v1.2.5 // indirect
128128
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
129129
github.com/golang/mock v1.7.0-rc.1 // indirect
130130
github.com/golang/protobuf v1.5.4 // indirect
@@ -137,7 +137,7 @@ require (
137137
github.com/google/s2a-go v0.1.9 // indirect
138138
github.com/google/uuid v1.6.0 // indirect
139139
github.com/googleapis/enterprise-certificate-proxy v0.3.6 // indirect
140-
github.com/googleapis/gax-go/v2 v2.14.2 // indirect
140+
github.com/googleapis/gax-go/v2 v2.15.0 // indirect
141141
github.com/gorilla/handlers v1.5.2 // indirect
142142
github.com/gorilla/mux v1.8.1 // indirect
143143
github.com/gorilla/websocket v1.5.3 // indirect
@@ -204,6 +204,7 @@ require (
204204
github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect
205205
github.com/oklog/run v1.1.0 // indirect
206206
github.com/onsi/ginkgo/v2 v2.23.4 // indirect
207+
github.com/onsi/gomega v1.38.0 // indirect
207208
github.com/opencontainers/go-digest v1.0.0 // indirect
208209
github.com/opencontainers/image-spec v1.1.0-rc2 // indirect
209210
github.com/pelletier/go-toml v1.9.5 // indirect
@@ -231,8 +232,8 @@ require (
231232
github.com/spaolacci/murmur3 v1.1.0 // indirect
232233
github.com/spf13/afero v1.14.0 // indirect
233234
github.com/spf13/cast v1.8.0 // indirect
234-
github.com/spf13/cobra v1.9.1 // indirect
235-
github.com/spf13/pflag v1.0.6 // indirect
235+
github.com/spf13/cobra v1.10.1 // indirect
236+
github.com/spf13/pflag v1.0.10 // indirect
236237
github.com/spf13/viper v1.19.0 // indirect
237238
github.com/spiffe/go-spiffe/v2 v2.5.0 // indirect
238239
github.com/subosito/gotenv v1.6.0 // indirect
@@ -243,8 +244,8 @@ require (
243244
github.com/tidwall/gjson v1.17.1 // indirect
244245
github.com/tidwall/match v1.1.1 // indirect
245246
github.com/tidwall/pretty v1.2.0 // indirect
246-
github.com/tklauser/go-sysconf v0.3.12 // indirect
247-
github.com/tklauser/numcpus v0.6.1 // indirect
247+
github.com/tklauser/go-sysconf v0.3.15 // indirect
248+
github.com/tklauser/numcpus v0.10.0 // indirect
248249
github.com/tyler-smith/go-bip32 v1.0.0 // indirect
249250
github.com/tyler-smith/go-bip39 v1.1.0 // indirect
250251
github.com/ulikunitz/xz v0.5.11 // indirect
@@ -254,7 +255,7 @@ require (
254255
go.etcd.io/bbolt v1.4.0-alpha.0.0.20240404170359-43604f3112c5 // indirect
255256
go.opencensus.io v0.24.0 // indirect
256257
go.opentelemetry.io/auto/sdk v1.1.0 // indirect
257-
go.opentelemetry.io/contrib/detectors/gcp v1.35.0 // indirect
258+
go.opentelemetry.io/contrib/detectors/gcp v1.36.0 // indirect
258259
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.61.0 // indirect
259260
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
260261
go.opentelemetry.io/otel v1.36.0 // indirect
@@ -263,22 +264,22 @@ require (
263264
go.opentelemetry.io/otel/sdk/metric v1.36.0 // indirect
264265
go.opentelemetry.io/otel/trace v1.36.0 // indirect
265266
go.uber.org/multierr v1.11.0 // indirect
266-
golang.org/x/crypto v0.39.0 // indirect
267+
golang.org/x/crypto v0.42.0 // indirect
267268
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
268-
golang.org/x/mod v0.26.0 // indirect
269-
golang.org/x/net v0.41.0 // indirect
269+
golang.org/x/mod v0.28.0 // indirect
270+
golang.org/x/net v0.44.0 // indirect
270271
golang.org/x/oauth2 v0.30.0 // indirect
271-
golang.org/x/sync v0.15.0 // indirect
272-
golang.org/x/sys v0.34.0 // indirect
273-
golang.org/x/term v0.32.0 // indirect
274-
golang.org/x/text v0.26.0 // indirect
272+
golang.org/x/sync v0.17.0 // indirect
273+
golang.org/x/sys v0.36.0 // indirect
274+
golang.org/x/term v0.35.0 // indirect
275+
golang.org/x/text v0.29.0 // indirect
275276
golang.org/x/time v0.12.0 // indirect
276-
golang.org/x/tools v0.34.0 // indirect
277-
google.golang.org/api v0.237.0 // indirect
278-
google.golang.org/genproto v0.0.0-20250505200425-f936aa4a68b2 // indirect
277+
golang.org/x/tools v0.37.0 // indirect
278+
google.golang.org/api v0.246.0 // indirect
279+
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
279280
google.golang.org/genproto/googleapis/api v0.0.0-20250603155806-513f23925822 // indirect
280-
google.golang.org/genproto/googleapis/rpc v0.0.0-20250603155806-513f23925822 // indirect
281-
google.golang.org/grpc v1.73.0 // indirect
281+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect
282+
google.golang.org/grpc v1.74.2 // indirect
282283
google.golang.org/protobuf v1.36.6 // indirect
283284
gopkg.in/ini.v1 v1.67.0 // indirect
284285
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
@@ -299,10 +300,10 @@ require (
299300
)
300301

301302
replace (
303+
cosmossdk.io/collections => github.com/noble-assets/cosmos-sdk/collections v0.0.0-20250923134424-edd65694c2f7
302304
github.com/ChainSafe/go-schnorrkel => github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d
303305
github.com/ChainSafe/go-schnorrkel/1 => github.com/ChainSafe/go-schnorrkel v1.0.0
304306
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
307+
github.com/noble-assets/orbiter => ../
305308
github.com/vedhavyas/go-subkey => github.com/strangelove-ventures/go-subkey v1.0.7
306309
)
307-
308-
replace github.com/noble-assets/orbiter => ../

0 commit comments

Comments
 (0)