Skip to content

Commit 32d1d8c

Browse files
kaxilTyrellHaywood
authored andcommitted
Remove dagReports API endpoint (apache#56609)
The `/api/v2/dagReports` endpoint loaded user DAG files directly in the API server process via DagBag, violating Airflow's core architectural principle that the API server must never execute user code. The endpoint was not used by the UI and had no known consumers. Users needing DAG loading reports should use the `airflow dags report` CLI command instead, which runs in an isolated process designed to safely execute user code.
1 parent abf9b47 commit 32d1d8c

File tree

13 files changed

+20
-415
lines changed

13 files changed

+20
-415
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Remove insecure dagReports API endpoint that executed user code in API server
2+
3+
The ``/api/v2/dagReports`` endpoint has been removed because it loaded user DAG files directly in the API server process, violating Airflow's security architecture. This endpoint was not used in the UI and had no known consumers. Use the ``airflow dags report`` CLI command instead for DAG loading reports.
4+
5+
* Types of change
6+
7+
* [ ] Dag changes
8+
* [ ] Config changes
9+
* [x] API changes
10+
* [ ] CLI changes
11+
* [ ] Behaviour changes
12+
* [ ] Plugin changes
13+
* [ ] Dependency changes
14+
* [ ] Code interface changes

airflow-core/src/airflow/api_fastapi/core_api/datamodels/dag_report.py

Lines changed: 0 additions & 40 deletions
This file was deleted.

airflow-core/src/airflow/api_fastapi/core_api/openapi/v2-rest-api-generated.yaml

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2704,53 +2704,6 @@ paths:
27042704
application/json:
27052705
schema:
27062706
$ref: '#/components/schemas/HTTPValidationError'
2707-
/api/v2/dagReports:
2708-
get:
2709-
tags:
2710-
- DagReport
2711-
summary: Get Dag Reports
2712-
description: Get DAG report.
2713-
operationId: get_dag_reports
2714-
security:
2715-
- OAuth2PasswordBearer: []
2716-
- HTTPBearer: []
2717-
parameters:
2718-
- name: subdir
2719-
in: query
2720-
required: true
2721-
schema:
2722-
type: string
2723-
title: Subdir
2724-
responses:
2725-
'200':
2726-
description: Successful Response
2727-
content:
2728-
application/json:
2729-
schema: {}
2730-
'401':
2731-
content:
2732-
application/json:
2733-
schema:
2734-
$ref: '#/components/schemas/HTTPExceptionResponse'
2735-
description: Unauthorized
2736-
'403':
2737-
content:
2738-
application/json:
2739-
schema:
2740-
$ref: '#/components/schemas/HTTPExceptionResponse'
2741-
description: Forbidden
2742-
'400':
2743-
content:
2744-
application/json:
2745-
schema:
2746-
$ref: '#/components/schemas/HTTPExceptionResponse'
2747-
description: Bad Request
2748-
'422':
2749-
description: Validation Error
2750-
content:
2751-
application/json:
2752-
schema:
2753-
$ref: '#/components/schemas/HTTPValidationError'
27542707
/api/v2/config:
27552708
get:
27562709
tags:

airflow-core/src/airflow/api_fastapi/core_api/routes/public/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from airflow.api_fastapi.core_api.routes.public.config import config_router
2828
from airflow.api_fastapi.core_api.routes.public.connections import connections_router
2929
from airflow.api_fastapi.core_api.routes.public.dag_parsing import dag_parsing_router
30-
from airflow.api_fastapi.core_api.routes.public.dag_report import dag_report_router
3130
from airflow.api_fastapi.core_api.routes.public.dag_run import dag_run_router
3231
from airflow.api_fastapi.core_api.routes.public.dag_sources import dag_sources_router
3332
from airflow.api_fastapi.core_api.routes.public.dag_stats import dag_stats_router
@@ -65,7 +64,6 @@
6564
authenticated_router.include_router(dag_run_router)
6665
authenticated_router.include_router(dag_sources_router)
6766
authenticated_router.include_router(dag_stats_router)
68-
authenticated_router.include_router(dag_report_router)
6967
authenticated_router.include_router(config_router)
7068
authenticated_router.include_router(dag_warning_router)
7169
authenticated_router.include_router(dags_router)

airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_report.py

Lines changed: 0 additions & 75 deletions
This file was deleted.

airflow-core/src/airflow/ui/openapi-gen/queries/common.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// generated with @7nohe/[email protected]
22

33
import { UseQueryResult } from "@tanstack/react-query";
4-
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagReportService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
4+
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
55
import { DagRunState, DagWarningType } from "../requests/types.gen";
66
export type AssetServiceGetAssetsDefaultResponse = Awaited<ReturnType<typeof AssetService.getAssets>>;
77
export type AssetServiceGetAssetsQueryResult<TData = AssetServiceGetAssetsDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
@@ -212,12 +212,6 @@ export const useDagStatsServiceGetDagStatsKey = "DagStatsServiceGetDagStats";
212212
export const UseDagStatsServiceGetDagStatsKeyFn = ({ dagIds }: {
213213
dagIds?: string[];
214214
} = {}, queryKey?: Array<unknown>) => [useDagStatsServiceGetDagStatsKey, ...(queryKey ?? [{ dagIds }])];
215-
export type DagReportServiceGetDagReportsDefaultResponse = Awaited<ReturnType<typeof DagReportService.getDagReports>>;
216-
export type DagReportServiceGetDagReportsQueryResult<TData = DagReportServiceGetDagReportsDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
217-
export const useDagReportServiceGetDagReportsKey = "DagReportServiceGetDagReports";
218-
export const UseDagReportServiceGetDagReportsKeyFn = ({ subdir }: {
219-
subdir: string;
220-
}, queryKey?: Array<unknown>) => [useDagReportServiceGetDagReportsKey, ...(queryKey ?? [{ subdir }])];
221215
export type ConfigServiceGetConfigDefaultResponse = Awaited<ReturnType<typeof ConfigService.getConfig>>;
222216
export type ConfigServiceGetConfigQueryResult<TData = ConfigServiceGetConfigDefaultResponse, TError = unknown> = UseQueryResult<TData, TError>;
223217
export const useConfigServiceGetConfigKey = "ConfigServiceGetConfig";

airflow-core/src/airflow/ui/openapi-gen/queries/ensureQueryData.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// generated with @7nohe/[email protected]
22

33
import { type QueryClient } from "@tanstack/react-query";
4-
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagReportService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
4+
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
55
import { DagRunState, DagWarningType } from "../requests/types.gen";
66
import * as Common from "./common";
77
/**
@@ -398,17 +398,6 @@ export const ensureUseDagStatsServiceGetDagStatsData = (queryClient: QueryClient
398398
dagIds?: string[];
399399
} = {}) => queryClient.ensureQueryData({ queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }), queryFn: () => DagStatsService.getDagStats({ dagIds }) });
400400
/**
401-
* Get Dag Reports
402-
* Get DAG report.
403-
* @param data The data for the request.
404-
* @param data.subdir
405-
* @returns unknown Successful Response
406-
* @throws ApiError
407-
*/
408-
export const ensureUseDagReportServiceGetDagReportsData = (queryClient: QueryClient, { subdir }: {
409-
subdir: string;
410-
}) => queryClient.ensureQueryData({ queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }), queryFn: () => DagReportService.getDagReports({ subdir }) });
411-
/**
412401
* Get Config
413402
* @param data The data for the request.
414403
* @param data.section

airflow-core/src/airflow/ui/openapi-gen/queries/prefetch.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// generated with @7nohe/[email protected]
22

33
import { type QueryClient } from "@tanstack/react-query";
4-
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagReportService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
4+
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
55
import { DagRunState, DagWarningType } from "../requests/types.gen";
66
import * as Common from "./common";
77
/**
@@ -398,17 +398,6 @@ export const prefetchUseDagStatsServiceGetDagStats = (queryClient: QueryClient,
398398
dagIds?: string[];
399399
} = {}) => queryClient.prefetchQuery({ queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }), queryFn: () => DagStatsService.getDagStats({ dagIds }) });
400400
/**
401-
* Get Dag Reports
402-
* Get DAG report.
403-
* @param data The data for the request.
404-
* @param data.subdir
405-
* @returns unknown Successful Response
406-
* @throws ApiError
407-
*/
408-
export const prefetchUseDagReportServiceGetDagReports = (queryClient: QueryClient, { subdir }: {
409-
subdir: string;
410-
}) => queryClient.prefetchQuery({ queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }), queryFn: () => DagReportService.getDagReports({ subdir }) });
411-
/**
412401
* Get Config
413402
* @param data The data for the request.
414403
* @param data.section

airflow-core/src/airflow/ui/openapi-gen/queries/queries.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// generated with @7nohe/[email protected]
22

33
import { UseMutationOptions, UseQueryOptions, useMutation, useQuery } from "@tanstack/react-query";
4-
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagReportService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
4+
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagParsingService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
55
import { BackfillPostBody, BulkBody_BulkTaskInstanceBody_, BulkBody_ConnectionBody_, BulkBody_PoolBody_, BulkBody_VariableBody_, ClearTaskInstancesBody, ConnectionBody, CreateAssetEventsBody, DAGPatchBody, DAGRunClearBody, DAGRunPatchBody, DAGRunsBatchBody, DagRunState, DagWarningType, PatchTaskInstanceBody, PoolBody, PoolPatchBody, TaskInstancesBatchBody, TriggerDAGRunPostBody, UpdateHITLDetailPayload, VariableBody, XComCreateBody, XComUpdateBody } from "../requests/types.gen";
66
import * as Common from "./common";
77
/**
@@ -398,17 +398,6 @@ export const useDagStatsServiceGetDagStats = <TData = Common.DagStatsServiceGetD
398398
dagIds?: string[];
399399
} = {}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }, queryKey), queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, ...options });
400400
/**
401-
* Get Dag Reports
402-
* Get DAG report.
403-
* @param data The data for the request.
404-
* @param data.subdir
405-
* @returns unknown Successful Response
406-
* @throws ApiError
407-
*/
408-
export const useDagReportServiceGetDagReports = <TData = Common.DagReportServiceGetDagReportsDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ subdir }: {
409-
subdir: string;
410-
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useQuery<TData, TError>({ queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }, queryKey), queryFn: () => DagReportService.getDagReports({ subdir }) as TData, ...options });
411-
/**
412401
* Get Config
413402
* @param data The data for the request.
414403
* @param data.section

airflow-core/src/airflow/ui/openapi-gen/queries/suspense.ts

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// generated with @7nohe/[email protected]
22

33
import { UseQueryOptions, useSuspenseQuery } from "@tanstack/react-query";
4-
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagReportService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
4+
import { AssetService, AuthLinksService, BackfillService, CalendarService, ConfigService, ConnectionService, DagRunService, DagService, DagSourceService, DagStatsService, DagVersionService, DagWarningService, DashboardService, DependenciesService, EventLogService, ExperimentalService, ExtraLinksService, GridService, ImportErrorService, JobService, LoginService, MonitorService, PluginService, PoolService, ProviderService, StructureService, TaskInstanceService, TaskService, VariableService, VersionService, XcomService } from "../requests/services.gen";
55
import { DagRunState, DagWarningType } from "../requests/types.gen";
66
import * as Common from "./common";
77
/**
@@ -398,17 +398,6 @@ export const useDagStatsServiceGetDagStatsSuspense = <TData = Common.DagStatsSer
398398
dagIds?: string[];
399399
} = {}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseDagStatsServiceGetDagStatsKeyFn({ dagIds }, queryKey), queryFn: () => DagStatsService.getDagStats({ dagIds }) as TData, ...options });
400400
/**
401-
* Get Dag Reports
402-
* Get DAG report.
403-
* @param data The data for the request.
404-
* @param data.subdir
405-
* @returns unknown Successful Response
406-
* @throws ApiError
407-
*/
408-
export const useDagReportServiceGetDagReportsSuspense = <TData = Common.DagReportServiceGetDagReportsDefaultResponse, TError = unknown, TQueryKey extends Array<unknown> = unknown[]>({ subdir }: {
409-
subdir: string;
410-
}, queryKey?: TQueryKey, options?: Omit<UseQueryOptions<TData, TError>, "queryKey" | "queryFn">) => useSuspenseQuery<TData, TError>({ queryKey: Common.UseDagReportServiceGetDagReportsKeyFn({ subdir }, queryKey), queryFn: () => DagReportService.getDagReports({ subdir }) as TData, ...options });
411-
/**
412401
* Get Config
413402
* @param data The data for the request.
414403
* @param data.section

0 commit comments

Comments
 (0)