Skip to content

Fixed inconsistencies between listen and emit #943

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e1d565a
fix: restrict extra properties
matthias-pichler Jul 18, 2024
ec69fd1
fix: move output to correct level
matthias-pichler Jul 18, 2024
cd7a0b9
fix: examples in dsl-reference
matthias-pichler Jul 18, 2024
93dcd34
fix: add even more property checks
matthias-pichler Jul 18, 2024
21eac79
Merge branch 'main' into schema-extra-props
cdavernas Jul 29, 2024
5bf4ad7
Fixed inconsistencies between listen and emit tasks
JBBianchi Aug 2, 2024
e605f67
Adding missing titles for better pojo generation
fjtirado Aug 2, 2024
0579a94
Charles comments
fjtirado Aug 2, 2024
302fe64
Merge branch 'main' into Adding_title_for_auth_schema
fjtirado Aug 2, 2024
333c83c
Merge pull request #944 from fjtirado/Adding_title_for_auth_schema
ricardozanini Aug 2, 2024
2ac77b4
Merge branch 'main' into schema-extra-props
cdavernas Aug 3, 2024
555a0f7
Fix Badges
cdavernas Aug 3, 2024
fcd10fd
Create SECURITY.md
cdavernas Aug 3, 2024
04cd3be
Merge pull request #928 from matthias-pichler-warrify/schema-extra-props
cdavernas Aug 4, 2024
ebd2e10
docs: specify runtime argument
matthias-pichler Aug 4, 2024
821b56f
docs: specify task and workflow arguments
matthias-pichler Aug 4, 2024
233accb
docs: document string substitution feature
matthias-pichler Aug 4, 2024
876bf2c
feat: allow query parameters in call http
matthias-pichler Aug 4, 2024
839492e
fix: remove duplicate uri scheme from error types
matthias-pichler Aug 4, 2024
92562e0
docs: document uri template support
matthias-pichler Aug 5, 2024
caec8ab
fix: broken links
matthias-pichler Aug 5, 2024
97d59e7
Fixed inconsistencies between listen and emit tasks
JBBianchi Aug 2, 2024
7c749d3
Merge branch 'fix-917-semantic-inconsistencies-listen-vs-emit' of htt…
JBBianchi Aug 5, 2024
fceb957
Merge branch 'main' into fix-readme-badges
ricardozanini Aug 6, 2024
34c678b
Merge branch 'main' into feat-security
cdavernas Aug 6, 2024
1ecec3f
Merge pull request #947 from serverlessworkflow/feat-security
cdavernas Aug 6, 2024
0aaead4
Updated Badge styles and text
cdavernas Aug 6, 2024
98d73ee
Merge branch 'main' into fix-readme-badges
cdavernas Aug 6, 2024
f1c32af
Merge pull request #946 from serverlessworkflow/fix-readme-badges
cdavernas Aug 6, 2024
43c3d15
Merge branch 'main' into string-substitution
matthias-pichler Aug 6, 2024
c49c263
Merge branch 'main' into query-params
matthias-pichler Aug 6, 2024
5961814
Merge branch 'main' into runtime-arg
matthias-pichler Aug 6, 2024
52ad683
Merge branch 'main' into fix-error-types
ricardozanini Aug 6, 2024
ca94f62
Merge pull request #957 from matthias-pichler-warrify/fix-error-types
ricardozanini Aug 6, 2024
624d402
Merge branch 'main' into workflow-task-arg
ricardozanini Aug 6, 2024
7fcc3ca
Merge pull request #953 from matthias-pichler-warrify/workflow-task-arg
ricardozanini Aug 6, 2024
808d72b
Merge branch 'main' into string-substitution
ricardozanini Aug 6, 2024
434e0eb
Merge pull request #955 from matthias-pichler-warrify/string-substitu…
ricardozanini Aug 6, 2024
85c43c8
Merge branch 'main' into query-params
ricardozanini Aug 6, 2024
538a0a6
Merge pull request #956 from matthias-pichler-warrify/query-params
ricardozanini Aug 6, 2024
0ea6dcb
Merge branch 'main' into runtime-arg
matthias-pichler Aug 6, 2024
151392d
Merge pull request #952 from matthias-pichler-warrify/runtime-arg
cdavernas Aug 6, 2024
b7236c8
Fixed inconsistencies between listen and emit tasks
JBBianchi Aug 2, 2024
87758fc
Merge branch 'fix-917-semantic-inconsistencies-listen-vs-emit' of htt…
JBBianchi Aug 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[![contributions welcome](https://img.shields.io/badge/contributions-welcome-green.svg?style=flat)](https://github.com/serverlessworkflow/specification/issues)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/serverlessworkflow/specification/blob/master/LICENSE)
[<img src="http://img.shields.io/badge/slack-@serverless--workflow-red?style=social&logo=slack">](https://cloud-native.slack.com/messages/serverless-workflow)
[<img src="http://img.shields.io/badge/web-serverlessworkflow.io-red?style=social&logo=google-chrome">](https://serverlessworkflow.io/)
[![contributions Welcome](https://img.shields.io/badge/Contributions-Welcome-green.svg?style=flat)](https://github.com/serverlessworkflow/specification/issues)
[![license](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://github.com/serverlessworkflow/specification/blob/master/LICENSE)
[<img alt="GitHub Release" src="https://img.shields.io/github/v/release/serverlessworkflow/specification?label=Release">](https://github.com/serverlessworkflow/specification/releases/latest)
<br>
[<img src="http://img.shields.io/badge/Website-blue?style=flat&logo=google-chrome&logoColor=white">](https://serverlessworkflow.io/)
[<img src="http://img.shields.io/badge/Slack-4A154B?style=flat&logo=slack&logoColor=white">](https://cloud-native.slack.com/messages/serverless-workflow)
[<img src="https://img.shields.io/badge/LinkedIn-blue?logo=linkedin&logoColor=white">](https://www.linkedin.com/company/serverless-workflow/)
[<img src="https://img.shields.io/twitter/follow/CNCFWorkflow?style=social">](https://twitter.com/CNCFWorkflow)

## Table of Contents
Expand Down
25 changes: 25 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Security Policy

## Reporting a Vulnerability

The Serverless Workflow team and community take security bugs very seriously. We appreciate your efforts to responsibly disclose your findings, and will make every effort to acknowledge your contributions.

To report a security issue, please use the GitHub Security Advisory ["Report a Vulnerability"](https://github.com/serverlessworkflow/specification/security/advisories/new) tab.

The Serverless Workflow team will send a response indicating the next steps in handling your report. After the initial reply to your report, the security team will keep you informed of the progress towards a fix and full announcement, and may ask for additional information or guidance.

## Security Best Practices

To help ensure the security of your workflows, we recommend the following best practices:

- **Keep Up to Date**: Always use the latest version of the Serverless Workflow DSL.
- **Review Code**: Regularly review your workflows and code for potential security issues.
- **Access Control**: Implement proper access controls to restrict who can create, modify, or execute workflows.
- **Monitor and Audit**: Continuously monitor and audit workflows to detect and respond to any suspicious activities.
- **Secure External Resources**: Ensure that any resources external to a workflow definition are always secured using modern authentication policies as defined in the DSL.
- **Use Trusted Containers and Scripts**: When relying on [run tasks](https://github.com/serverlessworkflow/specification/blob/main/dsl-reference.md#run), only use trusted container images, scripts, commands and workflows.
- **Custom Functions**: Only use custom functions from the [Serverless Workflow Catalog](https://github.com/serverlessworkflow/catalog) or from trusted sources to avoid introducing vulnerabilities.

---

Thank you for helping to keep the Serverless Workflow DSL secure!
2 changes: 1 addition & 1 deletion ctk/features/set.feature
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Feature: Set Task
I want to ensure that set tasks can be executed within the workflow
So that my implementation conforms to the expected behavior

# Tests emit tasks
# Tests set tasks
Scenario: Set Task
Given a workflow with definition:
"""yaml
Expand Down
134 changes: 94 additions & 40 deletions dsl-reference.md

Large diffs are not rendered by default.

53 changes: 43 additions & 10 deletions dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Workflows in the Serverless Workflow DSL can exist in several phases, each indic

Additionally, the flow of execution within a workflow can be controlled using [directives*](dsl-reference.md#flow-directive), which provide instructions to the workflow engine on how to manage and handle specific aspects of workflow execution.

**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*
\**To learn more about flow directives and how they can be utilized to control the execution and behavior of workflows, please refer to [Flow Directives](dsl-reference.md#flow-directive).*

#### Components

Expand All @@ -102,14 +102,14 @@ The Serverless Workflow DSL defines several default [task](dsl-reference.md#task

- [Call](dsl-reference.md#call), used to call services and/or functions.
- [Do](dsl-reference.md#do), used to define one or more subtasks to perform in sequence.
- [Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
- [Emit](dsl-reference.md#emit), used to emit [events](dsl-reference.md#event).
- [For](dsl-reference.md#for), used to iterate over a collection of items, and conditionally perform a task for each of them.
- [Fork](dsl-reference.md#fork), used to define one or more two subtasks to perform in parallel.
- [Listen](dsl-reference.md#listen), used to listen for an [event](dsl-reference.md#event) or more.
- [Raise](dsl-reference.md#raise), used to raise an [error](dsl-reference.md#error) and potentially fault the [workflow](dsl-reference.md#workflow).
- [Run](dsl-reference.md#run), used to run a [container](dsl-reference.md#container-process), a [script](dsl-reference.md#script-process), a [shell](dsl-reference.md#shell-process) command or even another [workflow](dsl-reference.md#workflow-process).
- [Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
- [Set](dsl-reference.md#set), used to dynamically set or update the [workflow](dsl-reference.md#workflow)'s data during the its execution.
- [Switch](dsl-reference.md#switch), used to dynamically select and execute one of multiple alternative paths based on specified conditions
- [Try](dsl-reference.md#try), used to attempt executing a specified [task](dsl-reference.md#task), and to handle any resulting [errors](dsl-reference.md#error) gracefully, allowing the [workflow](dsl-reference.md#workflow) to continue without interruption.
- [Wait](dsl-reference.md#wait), used to pause or wait for a specified duration before proceeding to the next task.

Expand Down Expand Up @@ -138,7 +138,7 @@ A workflow begins with the first task defined.

Once the task has been executed, different things can happen:

- `continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implictly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
- `continue`: the task ran to completion, and the next task, if any, should be executed. The task to run next is implicitly the next in declaration order, or explicitly defined by the `then` property of the executed task. If the executed task is the last task, then the workflow's execution gracefully ends.
- `fault`: the task raised an uncaught error, which abruptly halts the workflow's execution and makes it transition to `faulted` [status phase](#status-phases).
- `end`: the task explicitly and gracefully ends the workflow's execution.

Expand Down Expand Up @@ -196,17 +196,50 @@ Runtimes **may** optionally support other runtime expression languages, which au

CloudFlows defines [several arguments](#runtime-expression-arguments) that runtimes **must** provide during the evaluation of runtime expressions.

When the evaluation of an expression fails, runtimes **must** raise an error with type `https://https://serverlessworkflow.io/spec/1.0.0/errors/expression` and status `400`.
When the evaluation of an expression fails, runtimes **must** raise an error with type `https://serverlessworkflow.io/spec/1.0.0/errors/expression` and status `400`.

#### Runtime expression arguments

| Name | Type | Description |
|:-----|:----:|:------------|
| context | `map` | The task's context data. |
| context | `any` | The task's context data. |
| input | `any` | The task's filtered input. |
| secrets | `map` | A key/value map of the workflow secrets.<br>To avoid unintentional bleeding, secrets can only be used in the `input.from` runtime expression. |
| task | [`taskDescriptor`](#task-descriptor) | Describes the current task. |
| workflow | [`workflowDescritor`](#workflow-descriptor) | Describes the current workflow. |
| workflow | [`workflowDescriptor`](#workflow-descriptor) | Describes the current workflow. |
| runtime | [`runtimeDescriptor`](#runtime-descriptor) | Describes the runtime. |

##### Runtime Descriptor

This argument contains information about the runtime executing the workflow.

| Name | Type | Description | Example |
|:-----|:----:|:------------| ------- |
| name | `string` | A human friendly name for the runtime. | `Synapse`, `Sonata` |
| version | `string` | The version of the runtime. This can be an arbitrary string | a incrementing positive integer (`362`), semantic version (`1.4.78`), commit hash (`04cd3be6da98fc35422c8caa821e0aa1ef6b2c02`) or container image label (`v0.7.43-alpine`) |
| metadata | `map` | An object/map of implementation specific key-value pairs. This can be chosen by runtime implementors and usage of this argument signals that a given workflow definition might not be runtime agnostic | A Software as a Service (SaaS) provider might choose to expose information about the tenant the workflow is executed for e.g. `{ "organization": { "id": "org-ff51cff2-fc83-4d70-9af1-8dacdbbce0be", "name": "example-corp" }, "featureFlags": ["fastZip", "arm64"] }`. |

##### Task Descriptor

| Name | Type | Description | Example |
|:-----|:----:|:------------|:--------|
| name | `string` | The task's name. | `getPet` |
| definition | `map` | The tasks definition (specified under the name) as a parsed object | `{ "call": "http", "with": { ... } }` |
| input | `any` | The task's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the context of the runtime expression (for jq `.`) | - |
| startedAt.iso8601 | `string` | The start time of the task as a ISO 8601 date time string. It uses `T` as the date-time delimiter, either UTC (`Z`) or a time zone offset (`+01:00`). The precision can be either seconds, milliseconds or nanoseconds | `2022-01-01T12:00:00Z`, `2022-01-01T12:00:00.123456Z`, `2022-01-01T12:00:00.123+01:00` |
| startedAt.epochMillis | `integer` | The start time of the task as a integer value of milliseconds since midnight of 1970-01-01 UTC | `1641024000123` (="2022-01-01T08:00:00.123Z") |
| startedAt.epochNanos | `integer` | The start time of the task as a integer value of nanoseconds since midnight of 1970-01-01 UTC | `1641024000123456` (="2022-01-01T08:00:00.123456Z") |

##### Workflow Descriptor

| Name | Type | Description | Example |
|:-----|:----:|:------------|:--------|
| id | `string` | A unique id of the workflow execution. Now specific format is imposed | UUIDv4: `4a5c8422-5868-4e12-8dd9-220810d2b9ee`, ULID: `0000004JFGDSW1H037G7J7SFB9` |
| definition | `map` | The workflow's definition as a parsed object | `{ "document": { ... }, "do": [...] }` |
| input | `any` | The workflow's input *BEFORE* the `input.from` expression. For the result of `input.from` expression use the `$input` argument | - |
| startedAt.iso8601 | `string` | The start time of the execution as a ISO 8601 date time string. It uses `T` as the date-time delimiter, either UTC (`Z`) or a time zone offset (`+01:00`). The precision can be either seconds, milliseconds or nanoseconds | `2022-01-01T12:00:00Z`, `2022-01-01T12:00:00.123456Z`, `2022-01-01T12:00:00.123+01:00` |
| startedAt.epochMillis | `integer` | The start time of the execution as a integer value of milliseconds since midnight of 1970-01-01 UTC | `1641024000123` (="2022-01-01T08:00:00.123Z") |
| startedAt.epochNanos | `integer` | The start time of the execution as a integer value of nanoseconds since midnight of 1970-01-01 UTC | `1641024000123456` (="2022-01-01T08:00:00.123456Z") |

### Fault Tolerance

Expand All @@ -220,7 +253,7 @@ Errors in Serverless Workflow are described using the [Problem Details RFC](http

*Example error:*
```yaml
type: https://https://serverlessworkflow.io/spec/1.0.0/errors/communication
type: https://serverlessworkflow.io/spec/1.0.0/errors/communication
title: Service Unavailable
status: 503
detail: The service is currently unavailable. Please try again later.
Expand Down Expand Up @@ -263,7 +296,7 @@ Workflows and tasks alike can be configured to timeout after a defined amount of

When a timeout occur, runtimes **must** abruptly interrupt the execution of the workflow/task, and **must** raise an error that, if uncaught, force the workflow/task to transition to the [`faulted` status phase](#status-phases).

A timeout error **must** have its `type` set to `https://https://serverlessworkflow.io/spec/1.0.0/errors/timeout` and **should** have its `status` set to `408`.
A timeout error **must** have its `type` set to `https://serverlessworkflow.io/spec/1.0.0/errors/timeout` and **should** have its `status` set to `408`.

### Interoperability

Expand All @@ -275,7 +308,7 @@ Serverless Workflow DSL is designed to seamlessly interact with a variety of ser
- [**AsyncAPI**](dsl-reference.md#asyncapi-call): Facilitates interaction with asynchronous messaging protocols. AsyncAPI is designed for event-driven architectures, allowing workflows to publish and subscribe to events.
- [**OpenAPI**](dsl-reference.md#openapi-call): Enables communication with services that provide OpenAPI specifications, which is useful for defining and consuming RESTful APIs.

Runtimes **must** raise an error with type `https://https://serverlessworkflow.io/spec/1.0.0/errors/communication` if and when a problem occurs during a call.
Runtimes **must** raise an error with type `https://serverlessworkflow.io/spec/1.0.0/errors/communication` if and when a problem occurs during a call.

#### Custom and Non-Standard Interactions

Expand Down
6 changes: 2 additions & 4 deletions examples/accumulate-room-readings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@ do:
correlate:
roomId:
from: .roomid
output:
as: .data.reading
- with:
source: https://my.home.com/sensor
type: my.home.sensors.humidity
correlate:
roomId:
from: .roomid
output:
as: .data.reading
output:
as: .data.reading
- logReading:
for:
each: reading
Expand Down
25 changes: 25 additions & 0 deletions examples/http-query-params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# yaml-language-server: $schema=https://serverlessworkflow.io/schemas/1.0.0-alpha2/workflow.yaml
document:
dsl: 1.0.0-alpha2
namespace: examples
name: http-query-params
version: 1.0.0-alpha2
input:
schema:
format: json
document:
type: object
required:
- searchQuery
properties:
searchQuery:
type: string
do:
- searchStarWarsCharacters:
call: http
with:
method: get
endpoint: https://swapi.dev/api/people/
query:
search: ${.searchQuery}

Loading
Loading