Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
4390df7
Update doc for allowedHeaders
pranavbhole Sep 12, 2024
b699276
Update doc for allowedHeaders
pranavbhole Sep 12, 2024
14d764b
Reversing the behavior for setting druid.ingestion.http.allowedHeaders
pranavbhole Sep 13, 2024
683d034
Update processing/src/main/java/org/apache/druid/data/input/impl/Http…
pranavbhole Sep 13, 2024
46c4e3a
fix tests
pranavbhole Sep 17, 2024
f841a5d
Add support for selective loading of broadcast datasources in the tas…
abhishekrb19 Sep 12, 2024
7a14900
Provide `chmod` command for `-XX:OnOutOfMemoryError` from shell scrip…
abhishekrb19 Sep 13, 2024
a85c930
Add window function drill tests for array_concat_agg for empty over s…
Akshat-Jain Sep 13, 2024
0d68de4
Skip tombstone segment refresh in metadata cache (#17025)
findingrish Sep 13, 2024
01f1aa1
Bump up -Xmx2500m from 2GB and keep MaxDirectMemorySize as 2500m as w…
abhishekrb19 Sep 13, 2024
8d3c479
add CursorHolder.isPreAggregated method to allow cursors on pre-aggre…
clintropolis Sep 13, 2024
2ce2a4a
Add "includeAllCounters()" to WorkerContext. (#17047)
gianm Sep 13, 2024
6b38459
MSQ: Fix two issues with phase transitions. (#17053)
gianm Sep 13, 2024
66cb6e8
Add "targetPartitionsPerWorker" setting for MSQ. (#17048)
gianm Sep 13, 2024
f1d0879
Fix formatting of error message from validateNoIllegalRightyJoins. (#…
gianm Sep 14, 2024
ad62c1b
QueryResource: Don't close JSON content on error. (#17034)
gianm Sep 14, 2024
9d0d7c7
MSQ: Rework memory management. (#17057)
gianm Sep 14, 2024
d1fd1c6
Fix call to MemoryIntrospector in IndexerControllerContext. (#17066)
gianm Sep 15, 2024
8453b8a
MSQ: Improved worker cancellation. (#17046)
gianm Sep 15, 2024
d3c071c
BaseWorkerClientImpl: Don't attempt to recover from a closed channel.…
gianm Sep 15, 2024
e392d5c
Handle memory leaks from Mockito inline mocks (#17070)
Akshat-Jain Sep 15, 2024
7db3580
add DataSchema.Builder to tidy stuff up a bit (#17065)
clintropolis Sep 15, 2024
579b23d
abstract `IncrementalIndex` cursor stuff to prepare for using differe…
clintropolis Sep 15, 2024
7ac7d65
Speed up FrameFileTest, SuperSorterTest. (#17068)
gianm Sep 16, 2024
6b0d173
Remove some unnecessary JoinableFactoryWrappers. (#17051)
gianm Sep 16, 2024
b86649d
Move TerminalStageSpecFactory packages. (#17049)
gianm Sep 16, 2024
bdd3b76
Additional tests for ChannelStageOutputReader. (#17050)
gianm Sep 16, 2024
ed91daa
Fix low sonatype findings (#17017)
nozjkoitop Sep 16, 2024
5cb2156
MSQ: Wake up the main controller thread on workerError. (#17075)
gianm Sep 16, 2024
483f009
Remove unused WorkerManagerClient interface. (#17073)
gianm Sep 16, 2024
ad7f0be
Remove close method on MSQWarningReportPublisher. (#17071)
gianm Sep 16, 2024
fd055b2
docs: Refresh docs for SQL input source (#17031)
vtlim Sep 16, 2024
2a47b38
Support maxSubqueryBytes for window functions (#16800)
LakshSingla Sep 17, 2024
f6998a9
Add serde for ColumnBasedRowsAndColumns to fix window queries without…
sreemanamala Sep 17, 2024
6e9f6ae
MSQ: Include worker context maps in WorkOrders. (#17076)
gianm Sep 17, 2024
99dfb66
Remove workerId parameter from postWorkerError. (#17072)
gianm Sep 17, 2024
f513fbc
TableInputSpecSlicer changes to support running on Brokers. (#17074)
gianm Sep 17, 2024
0595e33
feat: json_merge expression and sql function (#17081)
lkm Sep 17, 2024
ab7e4fa
MSQ: Properly report errors that occur when starting up RunWorkOrder.…
gianm Sep 17, 2024
de0249a
FrameChannelMerger: Fix incorrect behavior of finished(). (#17088)
gianm Sep 17, 2024
e6a07be
Docs - update streaming ingestion terminology for Kafka and Kinesis (…
ektravel Sep 17, 2024
450b3ba
add VirtualColumns.findEquivalent and VirtualColumn.EquivalenceKey (#…
clintropolis Sep 17, 2024
629ba2a
MSQ: Add QueryKitSpec to encapsulate QueryKit params. (#17077)
gianm Sep 17, 2024
245cd64
[Docs] adding admonition for div (#17093)
edgar2020 Sep 17, 2024
fb02957
Create a FilterBundle.Builder class and use it to construct FilterBun…
cecemei Sep 17, 2024
350fc0e
Merge branch 'master' into updateDocForAllowedHeaders
pranavbhole Sep 17, 2024
5b86fe4
Fixing test
pranavbhole Sep 18, 2024
3008779
Merge branch 'master' into updateDocForAllowedHeaders
pranavbhole Sep 18, 2024
1e8335a
fixing test
pranavbhole Sep 18, 2024
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
7 changes: 4 additions & 3 deletions docs/configuration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,10 @@ the [HDFS input source](../ingestion/input-sources.md#hdfs-input-source).
You can set the following property to specify permissible protocols for
the [HTTP input source](../ingestion/input-sources.md#http-input-source).

|Property|Possible values|Description|Default|
|--------|---------------|-----------|-------|
|`druid.ingestion.http.allowedProtocols`|List of protocols|Allowed protocols for the HTTP input source.|`["http", "https"]`|
|Property| Possible values | Description |Default|
|--------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------|-------|
|`druid.ingestion.http.allowedProtocols`| List of protocols | Allowed protocols for the HTTP input source. |`["http", "https"]`|
|`druid.ingestion.http.allowedHeaders`| A list of permitted request headers for the HTTP input source. By default, the list is empty, which means no headers are allowed in the ingestion specification. |`[]`|

### External data access security configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,13 +100,11 @@ public static void throwIfInvalidProtocols(HttpInputSourceConfig config, List<UR

public static void throwIfForbiddenHeaders(HttpInputSourceConfig config, Map<String, String> requestHeaders)
{
if (config.getAllowedHeaders().size() > 0) {
for (Map.Entry<String, String> entry : requestHeaders.entrySet()) {
if (!config.getAllowedHeaders().contains(StringUtils.toLowerCase(entry.getKey()))) {
throw InvalidInput.exception("Got forbidden header %s, allowed headers are only %s ",
entry.getKey(), config.getAllowedHeaders()
);
}
for (Map.Entry<String, String> entry : requestHeaders.entrySet()) {
if (!config.getAllowedHeaders().contains(StringUtils.toLowerCase(entry.getKey()))) {
throw InvalidInput.exception("Got forbidden header [%s], allowed headers are only [%s]. You can control the allowed headers by updating druid.ingestion.http.allowedHeaders",
entry.getKey(), config.getAllowedHeaders()
);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.apache.druid.data.input.impl.systemfield.SystemField;
import org.apache.druid.data.input.impl.systemfield.SystemFields;
import org.apache.druid.error.DruidException;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.metadata.DefaultPasswordProvider;
import org.junit.Assert;
import org.junit.Rule;
Expand All @@ -41,8 +40,7 @@
import java.net.URI;
import java.util.Collections;
import java.util.EnumSet;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.HashSet;

public class HttpInputSourceTest
{
Expand Down Expand Up @@ -152,12 +150,17 @@ public void testSystemFields()
}

@Test
public void testAllowedHeaders()
public void testEmptyAllowedHeaders()
{
HttpInputSourceConfig httpInputSourceConfig = new HttpInputSourceConfig(
null,
Sets.newHashSet("R-cookie", "Content-type")
new HashSet<>()
);
expectedException.expect(DruidException.class);
expectedException.expectMessage(
"Got forbidden header [r-Cookie], allowed headers are only [[]]. "
+ "You can control the allowed headers by updating druid.ingestion.http.allowedHeaders");

final HttpInputSource inputSource = new HttpInputSource(
ImmutableList.of(URI.create("http://test.com/http-test")),
"myName",
Expand All @@ -166,12 +169,6 @@ public void testAllowedHeaders()
ImmutableMap.of("r-Cookie", "test", "Content-Type", "application/json"),
httpInputSourceConfig
);
Set<String> expectedSet = inputSource.getRequestHeaders()
.keySet()
.stream()
.map(StringUtils::toLowerCase)
.collect(Collectors.toSet());
Assert.assertEquals(expectedSet, httpInputSourceConfig.getAllowedHeaders());
}

@Test
Expand All @@ -183,7 +180,7 @@ public void shouldFailOnForbiddenHeaders()
);
expectedException.expect(DruidException.class);
expectedException.expectMessage(
"Got forbidden header G-Cookie, allowed headers are only [r-cookie, content-type]");
"Got forbidden header [G-Cookie], allowed headers are only [[r-cookie, content-type]]");
new HttpInputSource(
ImmutableList.of(URI.create("http://test.com/http-test")),
"myName",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@
package org.apache.druid.sql.calcite;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
import com.google.inject.Binder;
import org.apache.calcite.avatica.SqlType;
import org.apache.druid.catalog.model.Columns;
import org.apache.druid.data.input.impl.CsvInputFormat;
Expand All @@ -31,20 +36,28 @@
import org.apache.druid.data.input.impl.JsonInputFormat;
import org.apache.druid.data.input.impl.LocalInputSource;
import org.apache.druid.data.input.impl.systemfield.SystemFields;
import org.apache.druid.guice.DruidInjectorBuilder;
import org.apache.druid.initialization.DruidModule;
import org.apache.druid.java.util.common.ISE;
import org.apache.druid.java.util.common.StringUtils;
import org.apache.druid.java.util.common.UOE;
import org.apache.druid.metadata.DefaultPasswordProvider;
import org.apache.druid.metadata.input.InputSourceModule;
import org.apache.druid.segment.column.ColumnType;
import org.apache.druid.segment.column.RowSignature;
import org.apache.druid.server.security.Access;
import org.apache.druid.server.security.AuthConfig;
import org.apache.druid.server.security.ForbiddenException;
import org.apache.druid.sql.calcite.external.ExternalDataSource;
import org.apache.druid.sql.calcite.external.ExternalOperatorConversion;
import org.apache.druid.sql.calcite.external.Externals;
import org.apache.druid.sql.calcite.external.HttpOperatorConversion;
import org.apache.druid.sql.calcite.external.InlineOperatorConversion;
import org.apache.druid.sql.calcite.external.LocalOperatorConversion;
import org.apache.druid.sql.calcite.filtration.Filtration;
import org.apache.druid.sql.calcite.planner.Calcites;
import org.apache.druid.sql.calcite.util.CalciteTests;
import org.apache.druid.sql.guice.SqlBindings;
import org.apache.druid.sql.http.SqlParameter;
import org.hamcrest.CoreMatchers;
import org.junit.internal.matchers.ThrowableMessageMatcher;
Expand All @@ -53,8 +66,10 @@
import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.jupiter.api.Assertions.assertThrows;
Expand All @@ -69,6 +84,7 @@
* query ensure that the resulting MSQ task is identical regardless of the path
* taken.
*/
@SqlTestFrameworkConfig.ComponentSupplier(IngestTableFunctionTest.ExportComponentSupplier.class)
public class IngestTableFunctionTest extends CalciteIngestionDmlTest
{
protected static URI toURI(String uri)
Expand Down Expand Up @@ -97,6 +113,20 @@ protected static URI toURI(String uri)
.add("z", ColumnType.LONG)
.build()
);
protected final ExternalDataSource localDataSource = new ExternalDataSource(
new LocalInputSource(
null,
null,
Arrays.asList(new File("/tmp/foo.csv"), new File("/tmp/bar.csv")),
SystemFields.none()
),
new CsvInputFormat(ImmutableList.of("x", "y", "z"), null, false, false, 0),
RowSignature.builder()
.add("x", ColumnType.STRING)
.add("y", ColumnType.STRING)
.add("z", ColumnType.LONG)
.build()
);

/**
* Basic use of EXTERN
Expand Down Expand Up @@ -262,7 +292,7 @@ public void testHttpFn2()
new DefaultPasswordProvider("secret"),
SystemFields.none(),
ImmutableMap.of("Accept", "application/ndjson", "a", "b"),
new HttpInputSourceConfig(null, null)
new HttpInputSourceConfig(null, Sets.newHashSet("Accept", "a"))
),
new CsvInputFormat(ImmutableList.of("timestamp", "isRobot"), null, false, false, 0),
RowSignature.builder()
Expand Down Expand Up @@ -549,21 +579,6 @@ public void testInlineFn()
.verify();
}

protected final ExternalDataSource localDataSource = new ExternalDataSource(
new LocalInputSource(
null,
null,
Arrays.asList(new File("/tmp/foo.csv"), new File("/tmp/bar.csv")),
SystemFields.none()
),
new CsvInputFormat(ImmutableList.of("x", "y", "z"), null, false, false, 0),
RowSignature.builder()
.add("x", ColumnType.STRING)
.add("y", ColumnType.STRING)
.add("z", ColumnType.LONG)
.build()
);

/**
* Basic use of LOCALFILES
*/
Expand Down Expand Up @@ -702,4 +717,66 @@ public void testLocalFnNotNull()
.expectLogicalPlanFrom("localExtern")
.verify();
}

protected static class ExportComponentSupplier extends IngestionDmlComponentSupplier
{
public ExportComponentSupplier(TempDirProducer tempFolderProducer)
{
super(tempFolderProducer);
}

@Override
public void configureGuice(DruidInjectorBuilder builder)
{
builder.addModule(new DruidModule()
{

// Clone of MSQExternalDataSourceModule since it is not
// visible here.
@Override
public List<? extends Module> getJacksonModules()
{
return Collections.singletonList(
new SimpleModule(getClass().getSimpleName())
.registerSubtypes(ExternalDataSource.class)
);
}

@Override
public void configure(Binder binder)
{
// Adding the config to allow following 2 headers.
binder.bind(HttpInputSourceConfig.class)
.toInstance(new HttpInputSourceConfig(null, ImmutableSet.of("Accept", "a")));

}
});

builder.addModule(new DruidModule()
{

@Override
public List<? extends Module> getJacksonModules()
{
// We want this module to bring input sources along for the ride.
List<Module> modules = new ArrayList<>(new InputSourceModule().getJacksonModules());
modules.add(new SimpleModule("test-module").registerSubtypes(TestFileInputSource.class));
return modules;
}

@Override
public void configure(Binder binder)
{
// Set up the EXTERN macro.
SqlBindings.addOperatorConversion(binder, ExternalOperatorConversion.class);

// Enable the extended table functions for testing even though these
// are not enabled in production in Druid 26.
SqlBindings.addOperatorConversion(binder, HttpOperatorConversion.class);
SqlBindings.addOperatorConversion(binder, InlineOperatorConversion.class);
SqlBindings.addOperatorConversion(binder, LocalOperatorConversion.class);
}
});
}
}
}