Skip to content

Allow a prehook for restricting workflow execution behaviour#2182

Open
nolag wants to merge 5 commits into
mainfrom
rtinianov_teeAndRestrictions
Open

Allow a prehook for restricting workflow execution behaviour#2182
nolag wants to merge 5 commits into
mainfrom
rtinianov_teeAndRestrictions

Conversation

@nolag

@nolag nolag commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@nolag nolag requested a review from a team as a code owner June 22, 2026 15:35
Copilot AI review requested due to automatic review settings June 22, 2026 15:35
@nolag nolag requested review from a team as code owners June 22, 2026 15:35
@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown

✅ API Diff Results - github.com/smartcontractkit/chainlink-common

✅ Compatible Changes (19)

pkg/capabilities/v2/actions/confidentialworkflow.(*WorkflowExecution) (1)
  • GetRestrictions — ➕ Added
pkg/capabilities/v2/actions/confidentialworkflow.WorkflowExecution (1)
  • Restrictions — ➕ Added
pkg/workflows/host (4)
  • EncryptionKeyFetcher — ➕ Added

  • ExecutionHelperWithRawSecrets — ➕ Added

  • NewRestrictedExecutionHelper — ➕ Added

  • RestrictionAwareModule — ➕ Added

pkg/workflows/host/mocks (12)
  • MockExecutionHelperWithRawSecrets — ➕ Added

  • MockExecutionHelperWithRawSecrets_CallCapability_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_EmitUserLog_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_EmitUserMetric_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_Expecter — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetDONTime_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetNodeTime_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetOwner_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetRawSecrets_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetSecrets_Call — ➕ Added

  • MockExecutionHelperWithRawSecrets_GetWorkflowExecutionID_Call — ➕ Added

  • NewMockExecutionHelperWithRawSecrets — ➕ Added

pkg/workflows/wasm/host.ModuleConfig (1)
  • PrehookTimeout — ➕ Added

📄 View full apidiff report

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a “pre-hook” execution path that can return user-enforced restrictions, and enforces those restrictions in the host by wrapping the ExecutionHelper (capability calls + secrets access), with WASM runtime support and tests.

Changes:

  • Route triggers through an optional pre-hook and apply returned restrictions (plus optionally forward them to restriction-aware modules).
  • Add restriction-enforcing ExecutionHelper wrappers (including raw-secrets support) and extensive unit tests.
  • Add WASM standard test coverage + a small WASI rawsdk helper to return restrictions.

Reviewed changes

Copilot reviewed 13 out of 17 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
pkg/workflows/wasm/host/standard_tests/restrictions/main_wasip1.go New WASM test module that emits restrictions from a pre-hook.
pkg/workflows/wasm/host/standard_test.go Adds TestStandardRestrictions, refactors trigger runner helper, and tweaks test build logging.
pkg/workflows/wasm/host/module.go Introduces PrehookTimeout and threads a timeout into runWasm.
pkg/workflows/wasm/host/internal/rawsdk/helpers_wasip1.go Adds SendRestrictions to return restriction results from WASM.
pkg/workflows/host/tee_provider_test.go Adds a nil-TEE test case (with a naming nit).
pkg/workflows/host/requirement_selecting_module.go Adds pre-hook execution + restriction wrapping + restriction forwarding.
pkg/workflows/host/requirement_selecting_module_test.go Moves tests into package host, adds pre-hook/restrictions behavior tests and new stubs.
pkg/workflows/host/module.go Adds ExecutionHelperWithRawSecrets + RestrictionAwareModule interfaces.
pkg/workflows/host/mocks/execution_helper_with_raw_secrets.go Generated mock for ExecutionHelperWithRawSecrets.
pkg/workflows/host/execution_restrictions.go Implements restriction-enforcing ExecutionHelper wrappers for capabilities + secrets (+ raw secrets).
pkg/workflows/host/execution_restrictions_test.go Adds broad test coverage for restriction behavior.
pkg/workflows/host/encryption_key_fetcher.go Adds EncryptionKeyFetcher interface for raw secrets.
pkg/capabilities/v2/actions/confidentialworkflow/client.pb.go Regenerated proto to add Restrictions field (includes a small comment typo).
pkg/capabilities/v2/actions/confidentialhttp/client.pb.go Regenerated proto output update.
go.mod / go.sum Bumps chainlink-protos/cre/go dependency.
.mockery.yaml Adds mockery config for ExecutionHelperWithRawSecrets.
Files not reviewed (3)
  • pkg/capabilities/v2/actions/confidentialhttp/client.pb.go: Generated file
  • pkg/capabilities/v2/actions/confidentialworkflow/client.pb.go: Generated file
  • pkg/workflows/host/mocks/execution_helper_with_raw_secrets.go: Generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/workflows/host/execution_restrictions.go Outdated
Comment thread pkg/workflows/host/execution_restrictions.go
Comment thread pkg/workflows/host/execution_restrictions.go
Comment thread pkg/workflows/host/requirement_selecting_module.go
Comment thread pkg/workflows/wasm/host/module.go
Comment thread pkg/workflows/wasm/host/standard_test.go Outdated
Comment thread pkg/workflows/host/tee_provider_test.go Outdated
Comment on lines +117 to +119
// restrictions on the capabilities and the secrets.bool
// This is sent to avoid overhead when a TEE is not compromised, the DON will verify the restrictions on its end as well.
Restrictions *sdk.Restrictions `protobuf:"bytes,10,opt,name=restrictions,proto3" json:"restrictions,omitempty"`
Comment thread pkg/workflows/host/module.go
vreff
vreff previously approved these changes Jun 22, 2026
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.

3 participants