Skip to content

Conversation

@cedric-cordenier
Copy link
Contributor

Requires

Supports

@github-actions
Copy link
Contributor

👋 cedric-cordenier, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Contributor

I see you updated files related to core. Please run pnpm changeset in the root directory to add a changeset as well as in the text include at least one of the following tags:

  • #added For any new functionality added.
  • #breaking_change For any functionality that requires manual action for the node to boot.
  • #bugfix For bug fixes.
  • #changed For any change to the existing functionality.
  • #db_update For any feature that introduces updates to database schema.
  • #deprecation_notice For any upcoming deprecation functionality.
  • #internal For changesets that need to be excluded from the final changelog.
  • #nops For any feature that is NOP facing and needs to be in the official Release Notes for the release.
  • #removed For any functionality/config that is removed.
  • #updated For any functionality that is updated.
  • #wip For any change that is not ready yet and external communication about it should be held off till it is feature complete.

}
r.lggr.Infow("AuthorizeRequest success in auth", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
r.alreadyAuthorizedRequests[authorizedRequestStr] = int64(allowlistedRequest.ExpiryTimestamp)
return true, allowlistedRequest.Owner.Hex(), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

why this change?

Copy link

@trunk-io trunk-io bot left a comment

Choose a reason for hiding this comment

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

🔴 Test Results: Unrelated Failure

Affected failures:

  1. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go:TestRMNUncurseForceOption
  2. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go:TestRMNUncurse
  3. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go:TestRMNCurseConfigValidate
  4. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go:TestRMNCurseOneConnectedLanesSolana
  5. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_messaging_test.go:Test_CCIPMessaging_Solana2EVM
  6. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_sui_upgrade_test.go:Test_CCIP_Upgrade_EVM2Sui

What Broke

These failures appear to be unrelated to the changes in this PR. The CI jobs consistently failed due to an external dependency issue: an inability to download necessary program artifacts (such as Solana or suiup) from GitHub releases. This was caused by a 503 server error, indicating a problem with the external GitHub service or network connectivity. These download failures prevented critical components from starting, leading to the observed job failures. The changes introduced in the PR are confined to internal logging and request authorization logic, which have no direct impact on external artifact downloads or environment setup.

Autofix Options

You can use our MCP server to get AI assistance with debugging and fixing these failures.

  • Use MCP in your IDE to debug the issue. Try Help me fix CI failures from q8FMfnrl to get started.

View all test uploads

Copy link

@trunk-io trunk-io bot left a comment

Choose a reason for hiding this comment

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

🔴 Test Results: Bypassed Authorization Logic

Affected failures:

  1. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_sui_upgrade_test.go:Test_CCIP_Upgrade_NoBlock_EVM2Sui
  2. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_cs_rmn_curse_uncurse_test.go:TestRMNUncurseMCMS

What Broke

The PR's modifications bypassed crucial authorization logic within the vault capability, which is essential for the CCIP protocol's commitment process. This bypass also prevented the Solana container from starting correctly during integration tests.

Proposed Fixes

Revert the changes made to the AuthorizeRequest function in core/capabilities/vault/request_authorizer.go, restoring the original authorization logic and re-adding necessary imports.

In request_authorizer.go:5

+ 	"encoding/hex"
 	"encoding/json"
+ 	"errors"
+ 	"fmt"

In request_authorizer.go:31

- 	return true, "owner1", nil
+ 	defer r.clearExpiredAuthorizedRequests()
+ 	r.lggr.Infow("AuthorizeRequest", "method", req.Method, "requestID", req.ID)
+ 	requestDigest, err := req.Digest()
+ 	if err != nil {
+ 		r.lggr.Infow("AuthorizeRequest failed to create digest", "method", req.Method, "requestID", req.ID)
+ 		return false, "", err
+ 	}
+ 	requestDigestBytes, err := hex.DecodeString(requestDigest)
+ 	if err != nil {
+ 		r.lggr.Infow("AuthorizeRequest failed to decode digest", "method", req.Method, "requestID", req.ID)
+ 		return false, "", err
+ 	}
+ 	requestDigestBytes32 := [32]byte(requestDigestBytes)
+ 	if r.workflowRegistrySyncer == nil {
+ 		r.lggr.Errorw("AuthorizeRequest workflowRegistrySyncer is nil", "method", req.Method, "requestID", req.ID)
+ 		return false, "", errors.New("internal error: workflowRegistrySyncer is nil")
+ 	}
+ 	allowedRequests := r.workflowRegistrySyncer.GetAllowlistedRequests(ctx)
+ 	allowedRequestsStrs := make([]string, 0, len(allowedRequests))
+ 	for _, rr := range allowedRequests {
+ 		allowedReqStr := fmt.Sprintf("Owner: %s, RequestDigest: %s, ExpiryTimestamp: %d", rr.Owner.Hex(), hex.EncodeToString(rr.RequestDigest[:]), rr.ExpiryTimestamp)
+ 		allowedRequestsStrs = append(allowedRequestsStrs, allowedReqStr)
+ 	}
+ 	r.lggr.Infow("AuthorizeRequest GetAllowlistedRequests", "method", req.Method, "requestID", req.ID, "allowedRequests", allowedRequestsStrs)
+ 	allowlistedRequest := r.fetchAllowlistedItem(allowedRequests, requestDigestBytes32)
+ 	if allowlistedRequest == nil {
+ 		r.lggr.Infow("AuthorizeRequest fetchAllowlistedItem request not allowlisted",
+ 			"method", req.Method,
+ 			"requestID", req.ID,
+ 			"digestHexStr", requestDigest,
+ 			"allowedRequestsStrs", allowedRequestsStrs)
+ 		return false, "", errors.New("request not allowlisted")
+ 	}
+ 	authorizedRequestStr := string(allowlistedRequest.RequestDigest[:])
+ 
+ 	r.alreadyAuthorizedMutex.Lock()
+ 	defer r.alreadyAuthorizedMutex.Unlock()
+ 	if r.alreadyAuthorizedRequests[authorizedRequestStr] > 0 {
+ 		r.lggr.Infow("AuthorizeRequest already authorized previously", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 		return false, "", errors.New("request already authorized previously")
+ 	}
+ 	if time.Now().UTC().Unix() > int64(allowlistedRequest.ExpiryTimestamp) {
+ 		r.lggr.Infow("AuthorizeRequest expired authorization", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 		return false, "", errors.New("request authorization expired")
+ 	}
+ 	r.lggr.Infow("AuthorizeRequest success in auth", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 	r.alreadyAuthorizedRequests[authorizedRequestStr] = int64(allowlistedRequest.ExpiryTimestamp)
+ 	return true, allowlistedRequest.Owner.Hex(), nil
Autofix Options

You can apply the proposed fixes directly to your branch. Try the following:

  • Comment /trunk stack-fix KTG6LnkJ to generate a stacked PR with the proposed fixes.
  • Use MCP in your IDE to fix the issue. Try Help me fix CI failures from KTG6LnkJ to get started.

Tip

Get Better Results: This CI job is not uploading test reports. Adding structured test reports enables more precise, test-level analysis with better root cause identification and more targeted fix recommendations.
👉🏻 Learn how to upload test results.

@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
16.7% Duplication on New Code (required ≤ 10%)

See analysis details on SonarQube

Copy link

@trunk-io trunk-io bot left a comment

Choose a reason for hiding this comment

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

🔴 Test Results: Authorization Logic Bypass

Affected failures:

  1. TestRequestAuthorizer_CreateSecrets (Workflow Run: Core Tests (go_core_tests))
  2. TestRequestAuthorizer_UpdateSecrets (Workflow Run: Core Tests (go_core_tests))
  3. TestRequestAuthorizer_DeleteSecrets (Workflow Run: Core Tests (go_core_tests))
  4. TestRequestAuthorizer_ListSecrets (Workflow Run: Core Tests (go_core_tests))
  5. Workflow Run: Integration Tests
  6. Workflow Run: Run CCIP integration In Memory Tests For PR / smoke/ccip/ccip_sui_token_transfer_test.go:Test_CCIPTokenTransfer_EVM2SUI_ManagedTokenPool

What Broke

These failures are caused by an alteration to the AuthorizeRequest function in core/capabilities/vault/request_authorizer.go. The function was changed to always return a hardcoded authorized state and owner, effectively bypassing the actual authorization logic. This led to integration tests failing because they expected dynamic authorization and a specific hexadecimal owner address, which was no longer being provided.

Proposed Fixes

Revert the changes to the AuthorizeRequest function in core/capabilities/vault/request_authorizer.go to restore the original authorization logic and re-add necessary imports.

In request_authorizer.go:4

+ 	"encoding/hex"
 	"encoding/json"
+ 	"errors"
+ 	"fmt"
 	"sync"
 	"time"

In request_authorizer.go:27

 func (r *requestAuthorizer) AuthorizeRequest(ctx context.Context, req jsonrpc.Request[json.RawMessage]) (isAuthorized bool, owner string, err error) {
- 	return true, "owner1", nil
+ 	defer r.clearExpiredAuthorizedRequests()
+ 	r.lggr.Infow("AuthorizeRequest", "method", req.Method, "requestID", req.ID)
+ 	requestDigest, err := req.Digest()
+ 	if err != nil {
+ 		r.lggr.Infow("AuthorizeRequest failed to create digest", "method", req.Method, "requestID", req.ID)
+ 		return false, "", err
+ 	}
+ 	requestDigestBytes, err := hex.DecodeString(requestDigest)
+ 	if err != nil {
+ 		r.lggr.Infow("AuthorizeRequest failed to decode digest", "method", req.Method, "requestID", req.ID)
+ 		return false, "", err
+ 	}
+ 	requestDigestBytes32 := [32]byte(requestDigestBytes)
+ 	if r.workflowRegistrySyncer == nil {
+ 		r.lggr.Errorw("AuthorizeRequest workflowRegistrySyncer is nil", "method", req.Method, "requestID", req.ID)
+ 		return false, "", errors.New("internal error: workflowRegistrySyncer is nil")
+ 	}
+ 	allowedRequests := r.workflowRegistrySyncer.GetAllowlistedRequests(ctx)
+ 	allowedRequestsStrs := make([]string, 0, len(allowedRequests))
+ 	for _, rr := range allowedRequests {
+ 		allowedReqStr := fmt.Sprintf("Owner: %s, RequestDigest: %s, ExpiryTimestamp: %d", rr.Owner.Hex(), hex.EncodeToString(rr.RequestDigest[:]), rr.ExpiryTimestamp)
+ 		allowedRequestsStrs = append(allowedRequestsStrs, allowedReqStr)
+ 	}
+ 	r.lggr.Infow("AuthorizeRequest GetAllowlistedRequests", "method", req.Method, "requestID", req.ID, "allowedRequests", allowedRequestsStrs)
+ 	allowlistedRequest := r.fetchAllowlistedItem(allowedRequests, requestDigestBytes32)
+ 	if allowlistedRequest == nil {
+ 		r.lggr.Infow("AuthorizeRequest fetchAllowlistedItem request not allowlisted",
+ 			"method", req.Method,
+ 			"requestID", req.ID,
+ 			"digestHexStr", requestDigest,
+ 			"allowedRequestsStrs", allowedRequestsStrs)
+ 		return false, "", errors.New("request not allowlisted")
+ 	}
+ 	authorizedRequestStr := string(allowlistedRequest.RequestDigest[:])
+
+ 	r.alreadyAuthorizedMutex.Lock()
+ 	defer r.alreadyAuthorizedMutex.Unlock()
+ 	if r.alreadyAuthorizedRequests[authorizedRequestStr] > 0 {
+ 		r.lggr.Infow("AuthorizeRequest already authorized previously", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 		return false, "", errors.New("request already authorized previously")
+ 	}
+ 	if time.Now().UTC().Unix() > int64(allowlistedRequest.ExpiryTimestamp) {
+ 		r.lggr.Infow("AuthorizeRequest expired authorization", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 		return false, "", errors.New("request authorization expired")
+ 	}
+ 	r.lggr.Infow("AuthorizeRequest success in auth", "method", req.Method, "requestID", req.ID, "authorizedRequestStr", authorizedRequestStr)
+ 	r.alreadyAuthorizedRequests[authorizedRequestStr] = int64(allowlistedRequest.ExpiryTimestamp)
+ 	return true, allowlistedRequest.Owner.Hex(), nil
}
Autofix Options

You can apply the proposed fixes directly to your branch. Try the following:

  • Comment /trunk stack-fix sKV2xgx2 to generate a stacked PR with the proposed fixes.
  • Use MCP in your IDE to fix the issue. Try Help me fix CI failures from sKV2xgx2 to get started.

View all test uploads

@trunk-io
Copy link

trunk-io bot commented Nov 20, 2025

Static BadgeStatic BadgeStatic BadgeStatic Badge

Failed Test Failure Summary Logs
TestRequestAuthorizer_ListSecrets The test failed because the expected secret value did not match the actual value, and the expected number of calls was not met. Logs ↗︎
TestRequestAuthorizer_UpdateSecrets The test failed because the expected secret value did not match the actual value, and an expected function call was not made. Logs ↗︎
TestRequestAuthorizer_CreateSecrets The test failed because the expected value did not match the actual value, and a required function call was not made. Logs ↗︎
TestRequestAuthorizer_DeleteSecrets The test failed because the expected secret value did not match the actual value, and an expected function call was not made. Logs ↗︎

View Full Report ↗︎Docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants