elsa-workflows / elsa-workflows/elsa-core
HttpEndpoint does not honor Authorize and Policy inputs
- Dominant language
- C#
- Stars
- 7.9k
- Forks
- 1.5k
- Avg merge
- 15h 22m
- Merged PRs (30d)
- 114
Description
## Description
When using the HttpEndpoint activity in a workflow as a normal activity (i.e. not as a trigger), Elsa does not honor the Authorize and Policy inputs of that activity. As a result, unauthenticated and unauthorized requests will cause the workflow to resume.
## Steps to Reproduce
To help us identify the issue more quickly, please follow these guidelines:
1. **Detailed Steps**:
- Create a workflow consisting of an HttpEndpoint activity and set the following properties:
- Authorize = true
- CanStartWorkflow = false
- Run the workflow
- Send an unauthenticated request that matches the HttpEndpoint path
2. **Attachments**:
- **Workflow JSON**: [workflow-1.json](https://github.com/user-attachments/files/26093384/workflow-1.json)
3. **Reproduction Rate**: Every time
## Expected Behavior
HttpEndpoint will not accept the unauthenticated request.
## Actual Behavior
HttpEndpoint accepts the unauthenticated request and resumes the workflow.
## Environment
- **Elsa Package Version**: 3.5.3
- **Operating System**: Windows 11 (local environment), ECS linux/arm64 on AWS
- **Browser and Version**: Google Chrome 146.0.7680.80
## Troubleshooting Attempts
The created bookmark holds "authorize": false, no matter what was configured on the HttpEndpoint activity.
## Additional Context
The bug is in the ExecuteAsync() method of HttpEndpoint. Instead of creating a bookmark that contains the Authorize and Policy properties, the method calls context.WaitForHttpRequestAsync(), passing only the Path and SupportedMethods properties. Instead, it should call context.WaitForHttpRequestAsync() with HttpEndpointOptions that include Authorize and Policy.
Contributor guide
Assessment
This issue has not been assessed yet.