* Add secret scripting integration for JavaScript Introduced a new `Elsa.Secrets.Scripting` module that provides secret management capabilities within JavaScript workflows. This includes configuring the Jint engine to use workflow variables, adding new type and variable definition providers, and integrating with existing secret management features. * Refactor secret name extraction to a separate method Moved the logic for extracting secret names from the main method to a dedicated private method `GetSecretNamesFromExpression`. This improves code readability and maintains the single responsibility principle by delegating secret name extraction to its own method. * Add input evaluation, sensitive input handling, and middleware refactor Introduced methods for evaluating activity input properties and handling inputs marked as sensitive. Refactored `ExecutionLogMiddleware` constructor for consistency. Enhanced `SendHttpRequestBase` to mark authorization inputs as potentially containing secrets. Removed obsolete entries and adjusted persistence logic for clarity. * Refactor IActivityStateProtector interface Remove unused using directives and unnecessary comments. Simplify the definition of the `ProtectedActivityStateContext` record. * Add activity state filtering mechanism Introduce an abstract filter base class, context, and result models to enable filtering of activity state. Implement a default filter manager to run these filters and apply a specific filter for obfuscating HTTP request headers. Update necessary dependencies and extension methods to integrate the new filtering functionality. * Add expired secrets management Implemented services to manage expired secrets by periodically checking and updating their status. Introduced a new hosted service to perform the sweep and configurable options for the sweep interval. Updated related classes and configurations accordingly. * Update SweepInterval in appsettings.json Changed the Secrets Management SweepInterval from 30 seconds to 4 hours. This adjustment aims to reduce the frequency of sweep operations and improve overall system performance. * Update comment to reflect configuring engine with secrets The comment was changed to better describe the handler's function, specifying that it configures the Jint engine with secrets instead of workflow variables. This clarifies the purpose and usage of the handler in the context of the code. * Remove unused inputDescriptors variable This commit removes the inputDescriptors variable, which was declared but never used in DefaultActivityExecutionMapper.cs. This helps in cleaning up the code and potentially reducing memory usage. Ensuring that all declared variables are utilized can improve code readability and maintainability.
258 lines
6.8 KiB
JSON
258 lines
6.8 KiB
JSON
{
|
|
"Logging": {
|
|
"LogLevel": {
|
|
"Default": "Warning",
|
|
"Elsa": "Warning",
|
|
"MassTransit": "Warning",
|
|
"Microsoft.Extensions.Http": "Warning",
|
|
"Microsoft.Hosting.Lifetime": "Information",
|
|
"Microsoft.EntityFrameworkCore": "Warning",
|
|
"Microsoft.AspNetCore": "Warning",
|
|
"Quartz": "Warning",
|
|
"System.Net.Http": "Warning"
|
|
}
|
|
},
|
|
"AllowedHosts": "*",
|
|
"ConnectionStrings": {
|
|
"Sqlite": "Data Source=App_Data/elsa.sqlite.db;Cache=Shared;",
|
|
"PostgreSql": "Server=localhost;Username=elsa;Database=elsa;Port=5432;Password=elsa;SSLMode=Prefer;MaxPoolSize=2000;Timeout=60",
|
|
"CockroachDb": "Host=localhost;Port=26257;Database=elsa;SslMode=Disable;Username=root;IncludeErrorDetail=true",
|
|
"MongoDb": "mongodb://localhost:27017/elsa-workflows",
|
|
"AzureServiceBus": "",
|
|
"RabbitMq": "amqp://guest:guest@localhost:5672",
|
|
"Redis": "localhost:6379,abortConnect=false"
|
|
},
|
|
"Multitenancy": {
|
|
"Tenants": [
|
|
{
|
|
"Id": "default",
|
|
"Name": "Default"
|
|
},
|
|
{
|
|
"Id": "tenant-1",
|
|
"Name": "Tenant 1"
|
|
},
|
|
{
|
|
"Id": "tenant-2",
|
|
"Name": "Tenant 2"
|
|
},
|
|
{
|
|
"Id": "tenant-2a",
|
|
"TenantId": "tenant-2",
|
|
"Name": "Tenant 2a"
|
|
}
|
|
]
|
|
},
|
|
"Smtp": {
|
|
"Host": "localhost",
|
|
"Port": 2525,
|
|
"DefaultSender": "noreply@crmservices.com"
|
|
},
|
|
"Http": {
|
|
"BaseUrl": "https://localhost:5001",
|
|
"BasePath": "/workflows",
|
|
"ApiRoutePrefix": "elsa/api",
|
|
"AvailableContentTypes": [
|
|
"application/json",
|
|
"application/xml",
|
|
"text/plain",
|
|
"text/html"
|
|
]
|
|
},
|
|
"Identity": {
|
|
"Tokens": {
|
|
"SigningKey": "sufficiently-large-secret-signing-key",
|
|
"AccessTokenLifetime": "1:00:00:00",
|
|
"RefreshTokenLifetime": "7:00:00:00"
|
|
},
|
|
"Roles": [
|
|
{
|
|
"Id": "admin",
|
|
"Name": "Administrator",
|
|
"Permissions": [
|
|
"*"
|
|
],
|
|
"TenantId": "default"
|
|
}
|
|
],
|
|
"Users": [
|
|
{
|
|
"Id": "a2323f46-42db-4e15-af8b-94238717d817",
|
|
"Name": "admin",
|
|
"HashedPassword": "TfKzh9RLix6FPcCNeHLkGrysFu3bYxqzGqduNdi8v1U=",
|
|
"HashedPasswordSalt": "JEy9kBlhHCNsencitRHlGxmErmSgY+FVyMJulCH27Ds=",
|
|
"Roles": [
|
|
"admin"
|
|
],
|
|
"TenantId": "default"
|
|
}
|
|
],
|
|
"Applications": [
|
|
{
|
|
"Id": "d57030226341448daff5a2935aba2d3f",
|
|
"Name": "Postman",
|
|
"Roles": [
|
|
"admin"
|
|
],
|
|
"ClientId": "HXr0Vzdm9KCZbwsJ",
|
|
"ClientSecret": "a<~QGGHTEA%u4;CU&'Wga5ED:_&Gd1C)",
|
|
"HashedApiKey": "Z5ClHs3mbzx8Pnw3+PxbMq8A/Y+VKMCCDTGYtax8JFM=",
|
|
"HashedApiKeySalt": "kBisa1X8FwBfN2zmyGMFRgIVVBleghhQAJ4WGyTkaD0=",
|
|
"HashedClientSecret": "jEv58d0SVbGQ3nBZM0lkzHghG4Y+lMKW80wipz+9vHk=",
|
|
"HashedClientSecretSalt": "xRKy14Ok1/tU3kLf/8V1fcbLIegy9vcM90Peu2tzohU=",
|
|
"TenantId": "default"
|
|
}
|
|
]
|
|
},
|
|
"Environments": {
|
|
"Environments": [
|
|
{
|
|
"Name": "Local",
|
|
"ServerUrl": "https://localhost:5001/elsa/api"
|
|
},
|
|
{
|
|
"Name": "Staging",
|
|
"ServerUrl": "https://staging.acme.com/elsa/api"
|
|
},
|
|
{
|
|
"Name": "Production",
|
|
"ServerUrl": "https://production.acme.com/elsa/api"
|
|
}
|
|
]
|
|
},
|
|
"AppRole": "Default",
|
|
"Runtime": {
|
|
"DistributedLocking": {
|
|
"Provider": "File",
|
|
"LockAcquisitionTimeout": "00:00:10"
|
|
},
|
|
"DistributedLockProvider": "File",
|
|
"WorkflowDispatcher": {
|
|
"Channels": [
|
|
{
|
|
"Name": "Low"
|
|
},
|
|
{
|
|
"Name": "Medium"
|
|
},
|
|
{
|
|
"Name": "High"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
"Scripting": {
|
|
"Python": {
|
|
"PythonDllPath": "",
|
|
"Scripts": [
|
|
"def greet(name): return f'Hello {name}!'",
|
|
"def say_hello_world(): return greet('World')"
|
|
]
|
|
}
|
|
},
|
|
"AzureServiceBus": {
|
|
"Queues": [
|
|
{
|
|
"Name": "queue1"
|
|
},
|
|
{
|
|
"Name": "queue2"
|
|
}
|
|
],
|
|
"Topics": [
|
|
{
|
|
"Name": "topic1",
|
|
"Subscriptions": [
|
|
{
|
|
"Name": "subscription1"
|
|
},
|
|
{
|
|
"Name": "subscription2"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"Secrets": {
|
|
"Management": {
|
|
"SweepInterval": "04:00:00"
|
|
}
|
|
},
|
|
"Agents": {
|
|
"ApiKeys": [
|
|
{
|
|
"Name": "MyApiKey",
|
|
"Value": "my-api-key"
|
|
}
|
|
],
|
|
"Services": [
|
|
{
|
|
"Name": "ChatCompletion",
|
|
"Type": "OpenAIChatCompletion",
|
|
"Settings": {
|
|
"ModelId": "gpt-4o",
|
|
"ApiKeyRef": "MyApiKey"
|
|
}
|
|
},
|
|
{
|
|
"Name": "TextToImage",
|
|
"Type": "OpenAITextToImage",
|
|
"Settings": {
|
|
"ModelId": "dall-e-3",
|
|
"ApiKeyRef": "MyApiKey"
|
|
}
|
|
}
|
|
],
|
|
"Agents": [
|
|
{
|
|
"Name": "Copywriter",
|
|
"Description": "A persona that writes articles on any topic.",
|
|
"Services": [
|
|
"ChatCompletion"
|
|
],
|
|
"FunctionName": "WriteArticle",
|
|
"PromptTemplate": "You are a writer of articles about any topic and any additional instructions given to you. The syntax of the article content will be markdown, and your response will be in JSON format containing a \"title\" field and a \"markdown\" field using the following JSON structure: { \"title\": \"The title of the Article\", \"markdown\": \"The article content in markdown syntax.\" }. This is the topic: {{$Topic}}. The article consists of around {{$ParagraphCount}} paragraphs. The article must be written in the language {{$Language}} using the following style: {{$WritingStyle}}. Additional instructions (if any): {{$AdditionalInstructions}}.",
|
|
"InputVariables": [
|
|
{
|
|
"Name": "Topic",
|
|
"Description": "The topic to write an article about.",
|
|
"Type": "string"
|
|
},
|
|
{
|
|
"Name": "ParagraphCount",
|
|
"Description": "The number of paragraphs to write.",
|
|
"Type": "int"
|
|
},
|
|
{
|
|
"Name": "Language",
|
|
"Description": "The language to write the text in.",
|
|
"Type": "string"
|
|
},
|
|
{
|
|
"Name": "WritingStyle",
|
|
"Description": "The style to write the text in.",
|
|
"Type": "string"
|
|
},
|
|
{
|
|
"Name": "AdditionalInstructions",
|
|
"Description": "Any additional instructions.",
|
|
"Type": "string"
|
|
}
|
|
],
|
|
"OutputVariable": {
|
|
"Name": "Article",
|
|
"Description": "The article consisting of a title and markdown text."
|
|
},
|
|
"ExecutionSettings": {
|
|
"MaxTokens": null,
|
|
"Temperature": 0.5,
|
|
"TopP": 0.9,
|
|
"PresencePenalty": 0.5,
|
|
"FrequencyPenalty": 0.5,
|
|
"ResponseFormat": "json_object"
|
|
}
|
|
}
|
|
]
|
|
}
|
|
}
|