Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document allowContextMapAll native mode limitations #1855

Merged
merged 1 commit into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/jolt.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Please refer to the above link for usage and configuration details.

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.

== Additional Camel Quarkus configuration

Beyond standard usages described above, a trick is needed when using jolt specs from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Please refer to the above link for usage and configuration details.

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.

== Additional Camel Quarkus configuration

Beyond standard usages described above, a trick is needed when using json-validator templates from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
Expand Down
5 changes: 5 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/mustache.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ Please refer to the above link for usage and configuration details.

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.

== Additional Camel Quarkus configuration

Beyond standard usages described above, a trick is needed when using mustache templates from classpath resources in native mode. In such a situation, one needs to explicitly embed the resources in the native executable by specifying the `include-patterns` option.
Expand Down
9 changes: 9 additions & 0 deletions docs/modules/ROOT/pages/reference/extensions/qute.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ Check the xref:user-guide/index.adoc[User guide] for more information about writ
Please refer to the https://quarkus.io/guides/qute[Quarkus Qute].


== Camel Quarkus limitations

== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.



== Additional Camel Quarkus configuration

By default, all files located in the src/main/resources/templates directory and its subdirectories
Expand Down
11 changes: 3 additions & 8 deletions docs/modules/ROOT/pages/reference/extensions/stringtemplate.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@ Please refer to the above link for usage and configuration details.

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== Camel Quarkus limitations

If property `allowContextMapAll` is set to `true` there is a limitation in native mode. Reflective calls to methods
of several classes in camel are not allowed (for example `org.apache.camel.support.DefaultExchange`). Therefore
some expressions won't work (for example `<exchange.properties.*>).

You can allow reflective calls to such classes (for example by using application.properties), but keep in mind that it brings
some security risks.
== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.
11 changes: 3 additions & 8 deletions docs/modules/ROOT/pages/reference/extensions/velocity.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,10 @@ Please refer to the above link for usage and configuration details.

Check the xref:user-guide/index.adoc[User guide] for more information about writing Camel Quarkus applications.

== Camel Quarkus limitations

If property `allowContextMapAll` is set to `true` there is a limitation in native mode. Reflective calls to methods
of several classes in camel are not allowed (for example `org.apache.camel.support.DefaultExchange`). Therefore
some expressions won't work (for example `${exchange.properties.*}).

You can allow reflective calls to such classes (for example by using application.properties), but keep in mind that it brings
some security risks.
== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.

== Additional Camel Quarkus configuration

Expand Down
5 changes: 5 additions & 0 deletions extensions/qute/runtime/src/main/doc/limitations.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.

This file was deleted.

6 changes: 0 additions & 6 deletions extensions/velocity/runtime/src/main/doc/limitations.adoc

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.camel.catalog.Kind;
import org.apache.camel.tooling.model.ArtifactModel;
import org.apache.camel.tooling.model.BaseModel;
import org.apache.camel.tooling.model.ComponentModel;
import org.apache.maven.model.Dependency;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
Expand Down Expand Up @@ -120,6 +121,8 @@ public void execute() throws MojoExecutionException, MojoFailureException {
model.put("limitations", loadSection(basePath, "limitations.adoc", charset, null));
model.put("activatesNativeSsl", ext.isNativeSupported() && detectNativeSsl(multiModuleProjectDirectory.toPath(),
basePath, ext.getRuntimeArtifactId(), ext.getDependencies(), nativeSslActivators));
model.put("activatesContextMapAll",
ext.isNativeSupported() && detectAllowContextMapAll(catalog, ext.getRuntimeArtifactIdBase()));
model.put("configOptions", listConfigOptions(basePath, multiModuleProjectDirectory.toPath()));
model.put("humanReadableKind", new TemplateMethodModelEx() {
@Override
Expand Down Expand Up @@ -316,6 +319,28 @@ static boolean detectNativeSsl(Path deploymentBasePath) {
}
}

static boolean detectAllowContextMapAll(CqCatalog catalog, String artifactId) {
final String allowContextMapAll = "allowContextMapAll";
return catalog.filterModels(artifactId)
.filter(m -> m instanceof ComponentModel)
.map(m -> (ComponentModel) m)
.anyMatch(componentModel -> {
for (ComponentModel.ComponentOptionModel model : componentModel.getOptions()) {
if (model.getName().equals(allowContextMapAll)) {
return true;
}
}

for (ComponentModel.EndpointOptionModel model : componentModel.getEndpointOptions()) {
if (model.getName().equals(allowContextMapAll)) {
return true;
}
}

return false;
});
}

private static String loadSection(Path basePath, String fileName, Charset charset, String default_) {
Path p = basePath.resolve("src/main/doc/" + fileName);
if (Files.exists(p)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ This extension auto-enables SSL support in native mode. Hence you do not need to
`quarkus.ssl.native=true` to your `application.properties` yourself. See also
https://quarkus.io/guides/native-and-ssl[Quarkus SSL guide].
[/#if]
[#if activatesContextMapAll ]

== allowContextMapAll option in native mode

The `allowContextMapAll` option is not supported in native mode as it requires reflective access to security sensitive camel core classes such as
`CamelContext` & `Exchange`. This is considered a security risk and thus access to the feature is not provided by default.
[/#if]
[#if configuration?? || configOptions?size != 0 ]

== Additional Camel Quarkus configuration
Expand Down