* refactor(auth)!: retire the legacy permission constants and duplicate descriptors Completes the cutover started in #7980. Seven `<Module>Permissions` classes holding `verb:resource` strings are removed: AIPermissions, ConsoleLogs, Dashboard, ExternalAuthentication, OpenTelemetry, Secrets and StructuredLogs. AIPermissions was not in #7982's list, which was written before the cutover finished; it is dead by the same measure as the rest. Removed rather than marked obsolete, which #7982 asked to be an explicit decision. Every string these classes held carries two colons, so it does not parse under the new grammar and authorizes nothing. Keeping them obsolete would leave code that compiles, still reads as a permission check, and silently grants no access -- a warning that is easy to suppress in front of a runtime failure that is invisible. A compile error names the call site and can be fixed against the migration guide's mapping table. Classes their own modules still reference, WorkflowPermissions and IdentityPermissions among them, are untouched. External Authentication's parallel descriptor system is collapsed onto the core types: its own PermissionDescriptor record, its IPermissionDescriptorProvider and IPermissionDescriptorRegistry, and DefaultPermissionDescriptorRegistry. That was not only tidiness. The module's registry was fed exclusively by its legacy names, so after the cutover every well-formed grant failed the `unknown_permission_descriptor` check and the warning fired constantly for correct configuration. The resolver now consults the core catalog, which is keyed by resource and lists the verbs each accepts, and a wildcard is treated as advertised because it names a pattern rather than a resource to look up. The descriptor endpoint serves the core catalog too: choosing what an external mapping may confer means choosing from everything Elsa declares. The module contributes its resource descriptors explicitly rather than relying on the host's assembly scan, for the same reason it registers AddElsaAuthorization itself. The two naming tests now pin the new resource name instead of the legacy string. The convention worth holding was always that the module is called 'diagnostics/console-logs', not that a retired constant kept its old value. Refs #7982 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * fix(client): match the permission descriptor client model to the catalog Moving the descriptor endpoint onto the core catalog changed its shape from a single permission string to a resource plus the verbs that resource accepts, and the Refit client model kept the old one. It still deserialized and still compiled, handing callers a blank Name and no way to reach the verbs -- the data went missing without anything failing. The client model now mirrors the served descriptor, and a contract test compares the two property sets so the next divergence is a test failure rather than an empty field. NonCoreVerbs is excluded: the server derives it from SupportedVerbs, so a client holding the verbs can compute it. Found by review, not by the suites: nothing here throws. Refs #7982 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| Contracts | ||
| Endpoints/ConsoleLogs | ||
| Extensions | ||
| Features | ||
| Permissions | ||
| RealTime | ||
| Services | ||
| ShellFeatures | ||
| AssemblyInfo.cs | ||
| Elsa.Diagnostics.ConsoleLogs.csproj | ||
| README.md | ||
| Usings.cs | ||
Elsa Diagnostics Console Logs
Elsa.Diagnostics.ConsoleLogs is an opt-in Core module for operational diagnostics. It hosts ConsoleLogStreaming.Core, adds Elsa workflow metadata, and exposes recent plus live console output to authorized callers.
What It Captures
- Raw
stdoutandstderrlines from the current backend process. - Source metadata for the current process, machine, and container environment when available.
- Recent bounded history and live SignalR events.
- Dropped-line summaries when recent buffers or subscriber queues overflow.
The module is separate from Elsa.Diagnostics.StructuredLogs. It does not parse ILogger records, provide durable audit storage, call orchestrator log APIs, or implement trace/metric exploration.
Capture, redaction, buffering, source tracking, provider contracts, and live subscriptions come from ConsoleLogStreaming.Core. Elsa keeps only the module wiring, workflow metadata accessor, authorization, REST endpoints, SignalR hub, and DTO mapping.
Configure
services.AddElsa(elsa =>
{
elsa.UseConsoleLogs(options =>
{
options.RecentCapacity = 5_000;
options.SubscriberCapacity = 1_000;
options.MaxRecentQuerySize = 1_000;
options.MaxLineLength = 16_384;
options.PreserveAnsi = true; // pass colors through to consumers
});
});
Map the live hub:
app.UseConsoleLogs();
Capturing Colors
The capture passes raw stdout/stderr bytes through to consumers. ANSI escape sequences (colors, cursor
moves) are preserved by default; consumers (e.g. the Studio's Raw ANSI toggle) decide whether to render
them or strip them on display.
Whether colors actually arrive at the capture depends on whether the .NET console logger emits them.
Microsoft.Extensions.Logging.Console's SimpleConsoleFormatter defaults to LoggerColorBehavior.Default,
which suppresses colors whenever Console.IsOutputRedirected is true — that includes most Docker/Kubernetes
deployments, IDE-hosted runs (JetBrains Rider, VS Code), and any piped stdout. To force colors regardless,
add the following to appsettings.json (no module dependency required):
"Logging": {
"Console": {
"FormatterOptions": {
"ColorBehavior": "Enabled"
}
}
}
With ColorBehavior = Enabled, the logger writes ANSI sequences such as \x1b[32m and \x1b[0m into the
tee, the capture publishes them verbatim, and the Studio renders them.
Contracts
- Recent lines:
POST /diagnostics/console-logs/recent - Sources:
GET /diagnostics/console-logs/sources - Live hub:
/elsa/hubs/diagnostics/console-logs - Permission:
read:diagnostics:console-logs
Recent, source, and hub access all require the same permission.
Custom storage providers should implement ConsoleLogStreaming.Core.IConsoleLogProvider and use the core models. Elsa-specific values such as workflow instance IDs are represented as metadata internally and projected onto shared ConsoleLogStreaming.Core.Models DTOs at the REST and SignalR boundaries.
Safety Boundaries
- Redaction runs before recent buffering, live streaming, endpoint responses, and provider storage.
- ANSI escape sequences are preserved by default; set
PreserveAnsi = falseto strip them server-side. - Partial writes are buffered until newline, max line length, or idle flush.
- Oversized lines are truncated to one event and marked as truncated.
- Core providers receive only redacted line text and redacted source metadata.