Skip to content

Commit 823d17f

Browse files
torosentCopilot
andcommitted
Validate SpanContext in extractTraceContext
Add isValid() check after creating remote SpanContext to prevent malformed trace contexts from propagating silently. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 1622adc commit 823d17f

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

client/src/main/java/com/microsoft/durabletask/TracingHelper.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ static Context extractTraceContext(@Nullable TraceContext protoCtx) {
126126
SpanContext remoteContext = SpanContext.createFromRemoteParent(
127127
traceId, spanId, TraceFlags.fromByte(flags), traceState);
128128

129+
if (!remoteContext.isValid()) {
130+
return null;
131+
}
132+
129133
return Context.current().with(Span.wrap(remoteContext));
130134
}
131135

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
026329c53fe6363985655857b9ca848ec7238bd2
1+
1caadbd7ecfdf5f2309acbeac28a3e36d16aa156

internal/durabletask-protobuf/protos/orchestrator_service.proto

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,7 @@ message GetWorkItemsRequest {
822822
int32 maxConcurrentEntityWorkItems = 3;
823823

824824
repeated WorkerCapability capabilities = 10;
825+
WorkItemFilters workItemFilters = 11;
825826
}
826827

827828
enum WorkerCapability {
@@ -844,6 +845,26 @@ enum WorkerCapability {
844845
WORKER_CAPABILITY_LARGE_PAYLOADS = 3;
845846
}
846847

848+
message WorkItemFilters {
849+
repeated OrchestrationFilter orchestrations = 1;
850+
repeated ActivityFilter activities = 2;
851+
repeated EntityFilter entities = 3;
852+
}
853+
854+
message OrchestrationFilter {
855+
string name = 1;
856+
repeated string versions = 2;
857+
}
858+
859+
message ActivityFilter {
860+
string name = 1;
861+
repeated string versions = 2;
862+
}
863+
864+
message EntityFilter {
865+
string name = 1;
866+
}
867+
847868
message WorkItem {
848869
oneof request {
849870
OrchestratorRequest orchestratorRequest = 1;

0 commit comments

Comments
 (0)