Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1e493d9
fix(validation): reject reserved FQN characters in entity and column …
jaya6400 Apr 19, 2026
7544edc
fix(validation): also block control characters in entity name pattern
jaya6400 Apr 19, 2026
a0b7a4a
fix(validation): extend entity name validation to cover additional sc…
jaya6400 Apr 22, 2026
d2e375d
fix(validation): add < and | to columnName pattern in table.json
jaya6400 Apr 22, 2026
69bbdb6
fix(lint): disable no-control-regex for intentional control char rang…
jaya6400 Apr 22, 2026
d7e09e3
fix(tests): add integration tests for entity name validation with res…
jaya6400 Apr 25, 2026
bf06846
fix(validation): add minLength:1 to pipeline task name and apply spot…
jaya6400 Apr 25, 2026
ae93a76
Add validation tests for empty pipeline task names
jaya6400 Apr 28, 2026
e4cb111
chore: add missing license header to PipelineResourceIT
jaya6400 Apr 28, 2026
4229b00
chore: fix license headers and playwright linting
jaya6400 Apr 28, 2026
b043532
chore: fix license header URL and format
jaya6400 Apr 28, 2026
77ca90c
chore: fix playwright test formatting
jaya6400 Apr 28, 2026
419a2fa
chore: fix missing blank line in license headers
jaya6400 Apr 28, 2026
7686748
chore: align license headers with project 2026 standards
jaya6400 Apr 28, 2026
602b7a9
fix: remove incorrect license header, fix playwright spec, revert cop…
jaya6400 Apr 29, 2026
e02537b
fix: correct license headers and line endings across UI files
jaya6400 Apr 29, 2026
51a857e
fix: fix line endings in regex constants
jaya6400 Apr 29, 2026
cf2f659
fix: fix line endings and formatting in PipelineValidation spec
jaya6400 Apr 29, 2026
cde2888
fix: replace lookahead regex with character class to fix Python/Rust …
jaya6400 Apr 29, 2026
4f11e09
fix: use character class regex without lookahead for Python/Rust comp…
jaya6400 Apr 29, 2026
eee2391
fix: re-add double colon blocking in entity name patterns
jaya6400 Apr 30, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@
import jakarta.validation.Validator;
import java.io.IOException;
import java.lang.reflect.Field;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.time.Duration;
import java.util.Map;
import java.util.TimeZone;
import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.hc.client5.http.auth.AuthScope;
import org.apache.hc.client5.http.auth.UsernamePasswordCredentials;
Expand Down Expand Up @@ -162,6 +165,9 @@ public void launcherSessionOpened(LauncherSession session) {
cacheProvider = System.getProperty("cacheProvider", "none");

LOG.info("=== TestSuiteBootstrap: Starting test infrastructure ===");
System.setProperty("user.timezone", "UTC");
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
LOG.info("Test JVM timezone set to {}", TimeZone.getDefault().getID());
LOG.info("Database type: {}", databaseType);
LOG.info("Search type: {}", searchType);
LOG.info("RDF enabled: {}", rdfEnabled);
Expand Down Expand Up @@ -505,8 +511,10 @@ private void startApplication() throws Exception {
config.setDataSourceFactory(dataSourceFactory);

String projectRoot = System.getProperty("user.dir");
if (projectRoot.endsWith("openmetadata-integration-tests")) {
projectRoot = projectRoot.substring(0, projectRoot.lastIndexOf("/"));
Path projectRootPath = Paths.get(projectRoot);
if (projectRootPath.endsWith("openmetadata-integration-tests")
&& projectRootPath.getParent() != null) {
projectRoot = projectRootPath.getParent().toString();
}
String flyWayMigrationScriptsLocation =
projectRoot + "/bootstrap/sql/migrations/flyway/" + DATABASE_CONTAINER.getDriverClassName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,36 @@ void post_pipelineWithTasks_200_OK(TestNamespace ns) {
assertEquals(2, pipeline.getTasks().size());
}

@Test
void post_pipelineWithInvalidTaskName_4xx(TestNamespace ns) {
PipelineService service = PipelineServiceTestFactory.createAirflow(ns);

CreatePipeline request = new CreatePipeline();
request.setName(ns.prefix("pipeline_invalid_task"));
request.setService(service.getFullyQualifiedName());
request.setTasks(List.of(new Task().withName("task<invalid")));

assertThrows(
Exception.class,
() -> createEntity(request),
"Creating pipeline with invalid task name should fail");
}

@Test
void post_pipelineWithEmptyTaskName_4xx(TestNamespace ns) {
PipelineService service = PipelineServiceTestFactory.createAirflow(ns);

CreatePipeline request = new CreatePipeline();
request.setName(ns.prefix("pipeline_empty_task_name"));
request.setService(service.getFullyQualifiedName());
request.setTasks(List.of(new Task().withName("")));

assertThrows(
Exception.class,
() -> createEntity(request),
"Creating pipeline with empty task name should fail");
}

@Test
void post_pipelineWithSourceUrl_200_OK(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,25 @@ void post_searchIndexWithFields_200_OK(TestNamespace ns) {
assertEquals(2, searchIndex.getFields().size());
}

@Test
void post_searchIndexWithInvalidFieldName_4xx(TestNamespace ns) {
SearchService service = SearchServiceTestFactory.createElasticSearch(ns);

CreateSearchIndex request = new CreateSearchIndex();
request.setName(ns.prefix("searchindex_invalid_field"));
request.setService(service.getFullyQualifiedName());
request.setFields(
List.of(
new SearchIndexField()
.withName("title<invalid")
.withDataType(SearchIndexDataType.TEXT)));

assertThrows(
Exception.class,
() -> createEntity(request),
"Creating search index with invalid field name should fail");
}

@Test
void put_searchIndexFields_200_OK(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,38 @@ protected Table createEntity(CreateTable createRequest) {
return SdkClients.adminClient().tables().create(createRequest);
}

@Test
void post_tableWithInvalidConstraintOrPartitionColumnName_4xx(TestNamespace ns) {
CreateTable invalidConstraintRequest = createMinimalRequest(ns);
invalidConstraintRequest.setName(ns.prefix("table_invalid_constraint_column"));
invalidConstraintRequest.setTableConstraints(
List.of(
new TableConstraint()
.withConstraintType(TableConstraint.ConstraintType.UNIQUE)
.withColumns(List.of("name<invalid"))));

assertThrows(
Exception.class,
() -> createEntity(invalidConstraintRequest),
"Creating table with invalid constraint column name should fail");

CreateTable invalidPartitionRequest = createMinimalRequest(ns);
invalidPartitionRequest.setName(ns.prefix("table_invalid_partition_column"));
invalidPartitionRequest.setTablePartition(
new TablePartition()
.withColumns(
List.of(
new PartitionColumnDetails()
.withColumnName("name|invalid")
.withIntervalType(PartitionIntervalTypes.COLUMN_VALUE)
.withInterval("daily"))));

assertThrows(
Exception.class,
() -> createEntity(invalidPartitionRequest),
"Creating table with invalid partition column name should fail");
}

@Override
protected Table getEntity(String id) {
return SdkClients.adminClient().tables().get(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,28 @@ void post_topicWithMessageSchema_200_OK(TestNamespace ns) {
assertNotNull(topic.getMessageSchema().getSchemaFields());
}

@Test
void post_topicWithInvalidSchemaFieldName_4xx(TestNamespace ns) {
MessagingService service = MessagingServiceTestFactory.createKafka(ns);

MessageSchema schema =
new MessageSchema()
.withSchemaType(SchemaType.JSON)
.withSchemaFields(
List.of(new Field().withName("field|invalid").withDataType(FieldDataType.STRING)));

CreateTopic request = new CreateTopic();
request.setName(ns.prefix("topic_invalid_schema_field"));
request.setService(service.getFullyQualifiedName());
request.setPartitions(1);
request.setMessageSchema(schema);

assertThrows(
Exception.class,
() -> createEntity(request),
"Creating topic with invalid schema field name should fail");
}

@Test
void post_topicWithCleanupPolicies_200_OK(TestNamespace ns) {
OpenMetadataClient client = SdkClients.adminClient();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@
"properties": {
"name": {
"description": "Name that identifies this task instance uniquely.",
"type": "string"
"type": "string",
"minLength": 1,
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
Comment thread
gitar-bot[bot] marked this conversation as resolved.
"displayName": {
"description": "Display Name that identifies this Task. It could be title or label from the pipeline services.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^((?!::).)*$"
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"searchIndexField": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@
"description": "List of column names corresponding to the constraint.",
"type": "array",
"items": {
"type": "string"
"type": "string",
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
Comment thread
jaya6400 marked this conversation as resolved.
}
},
"referredColumns": {
Expand All @@ -235,7 +236,7 @@
"description": "Local name (not fully qualified name) of the column. ColumnName is `-` when the column is not named in struct dataType. For example, BigQuery supports struct with unnamed fields.",
"type": "string",
"minLength": 1,
"pattern": "^((?!::).)*$"
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"partitionIntervalTypes": {
"javaType": "org.openmetadata.schema.type.PartitionIntervalTypes",
Expand Down Expand Up @@ -273,7 +274,8 @@
"properties": {
"columnName": {
"description": "List of column names corresponding to the partition.",
"type": "string"
"type": "string",
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"intervalType": {
"$ref": "#/definitions/partitionIntervalTypes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,13 @@
"type": "string",
"minLength": 1,
"maxLength": 256,
"pattern": "^((?!::).)*$"
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"testCaseEntityName": {
"description": "Name that identifies a test definition and test case.",
"type": "string",
"minLength": 1,
"pattern": "^((?!::).)*$"
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"fullyQualifiedEntityName": {
"description": "A unique name that identifies an entity. Example for table 'DatabaseService.Database.Schema.Table'.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@
"description": "Local name (not fully qualified name) of the field. ",
"type": "string",
"minLength": 1,
"maxLength": 128
"maxLength": 128,
"pattern": "^((?!::)[^><\"|\\x00-\\x1f])*$"
},
"field": {
"type": "object",
Expand Down Expand Up @@ -139,4 +140,4 @@
"default": []
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/*
* Copyright 2026 Collate.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { expect, test, type APIRequestContext } from '@playwright/test';
import { getDefaultAdminAPIContext, uuid } from '../../utils/common';

test.use({ storageState: 'playwright/.auth/admin.json' });

test.describe('Pipeline entity name validation', () => {
let apiContext: APIRequestContext;
let afterAction: () => Promise<void>;
let serviceFqn = '';

test.beforeAll(async ({ browser }) => {
const response = await getDefaultAdminAPIContext(browser);
apiContext = response.apiContext;
afterAction = response.afterAction;

const serviceName = `pw-pipeline-validation-service-${uuid()}`;
const serviceResponse = await apiContext.post(
'/api/v1/services/pipelineServices',
{
data: {
name: serviceName,
serviceType: 'Dagster',
connection: {
config: {
type: 'Dagster',
host: 'admin',
token: 'admin',
timeout: '1000',
supportsMetadataExtraction: true,
},
},
},
}
);

expect(serviceResponse.status()).toBe(201);
const serviceData = await serviceResponse.json();
serviceFqn = serviceData.fullyQualifiedName;
});

test.afterAll(async () => {
if (serviceFqn) {
await apiContext.delete(
`/api/v1/services/pipelineServices/name/${encodeURIComponent(
serviceFqn
)}?recursive=true&hardDelete=true`
);
}
await afterAction();
});

test('should reject pipeline creation when task name is empty', async () => {
const response = await apiContext.post('/api/v1/pipelines', {
data: {
name: `pw-pipeline-empty-task-${uuid()}`,
service: serviceFqn,
tasks: [{ name: '' }],
},
});

expect(response.status()).toBe(400);
});

test('should reject pipeline creation when task name contains reserved FQN characters', async () => {
const response = await apiContext.post('/api/v1/pipelines', {
data: {
name: `pw-pipeline-invalid-task-${uuid()}`,
service: serviceFqn,
tasks: [{ name: 'task<invalid' }],
},
});

expect(response.status()).toBe(400);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -160,10 +160,24 @@ describe('Test Regex', () => {
});

it('EntityName regex should fail for the invalid entity name', () => {
// conatines :: in the name should fail
// contains reserved FQN characters - should fail
expect(ENTITY_NAME_REGEX.test('name>bad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name<bad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name"bad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name|bad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name\nbad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name\rbad')).toEqual(false);
expect(ENTITY_NAME_REGEX.test('name\x00bad')).toEqual(false);

// double colon is reserved FQN separator - should fail
expect(ENTITY_NAME_REGEX.test('Hello::World')).toEqual(false);
});

it('EntityName regex should pass for names with single colons', () => {
expect(ENTITY_NAME_REGEX.test('name:value')).toEqual(true);
expect(ENTITY_NAME_REGEX.test('a:b:c:d')).toEqual(true);
});

describe('TAG_NAME_REGEX', () => {
it('should match English letters', () => {
expect(TAG_NAME_REGEX.test('Hello')).toEqual(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export const UrlEntityCharRegEx = /[#.%;?/\\]/g;
export const EMAIL_REG_EX = /^\S+@\S+\.\S+$/;

/**
* strings that contain a combination of letters, alphanumeric characters, hyphens,
* spaces, periods, single quotes, ampersands, and parentheses, with support for Unicode characters.
* Validates entity names. Blocks reserved FQN separator characters (::, >, <, ", |)
* and ASCII control characters. Supports Unicode characters.
*/
export const ENTITY_NAME_REGEX = /^((?!::).)*$/;
// eslint-disable-next-line no-control-regex
export const ENTITY_NAME_REGEX = /^(?!.*::)[^><"|\u0000-\u001f]*$/;

/**
* Matches any string that does NOT contain the following:
Expand Down
Loading