You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "jason810496 (via GitHub)" <gi...@apache.org> on 2026/07/09 01:22:43 UTC

Re: [PR] Validate Dag and task IDs in the ts-sdk task registry [airflow]

jason810496 commented on code in PR #69400:
URL: https://github.com/apache/airflow/pull/69400#discussion_r3548214849


##########
ts-sdk/src/sdk/registry.ts:
##########
@@ -39,11 +42,15 @@ export class TaskRegistry {
    */
   register<TReturn = unknown>(registration: TaskRegistration, handler: TaskHandler<TReturn>): void {
     const { dagId, taskId } = registration;
-    if (!dagId || typeof dagId !== "string") {
-      throw new Error("dagId must be a non-empty string");
+    if (typeof dagId !== "string" || !KEY_REGEX.test(dagId)) {
+      throw new Error(
+        "dagId must be made of alphanumeric characters, dashes, dots, and underscores",
+      );
     }
-    if (!taskId || typeof taskId !== "string") {
-      throw new Error("taskId must be a non-empty string");
+    if (typeof taskId !== "string" || !KEY_REGEX.test(taskId)) {
+      throw new Error(
+        "taskId must be made of alphanumeric characters, dashes, dots, and underscores",
+      );

Review Comment:
   How about validating the `task_id` len as well?
   
   https://github.com/apache/airflow/blob/dc5ddd26202f972f634a6ee9ce25f04f17669ad7/task-sdk/src/airflow/sdk/definitions/_internal/node.py#L37-L52



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org