You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@baremaps.apache.org by "bchapuis (via GitHub)" <gi...@apache.org> on 2024/02/27 23:18:42 UTC

[PR] Move most assets to baremaps site [incubator-baremaps]

bchapuis opened a new pull request, #837:
URL: https://github.com/apache/incubator-baremaps/pull/837

   (no comment)


-- 
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@baremaps.apache.org

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


Re: [PR] Move most assets to baremaps site [incubator-baremaps]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #837:
URL: https://github.com/apache/incubator-baremaps/pull/837#discussion_r1505135421


##########
baremaps-core/src/main/java/org/apache/baremaps/workflow/tasks/ExportVectorTiles.java:
##########
@@ -88,7 +95,35 @@
   public void execute(WorkflowContext context) throws Exception {
     var configReader = new ConfigReader();
     var objectMapper = objectMapper();
+
     var tileset = objectMapper.readValue(configReader.read(this.tileset), Tileset.class);
+    var style = objectMapper.readValue(configReader.read(this.style), Style.class);
+
+    // Write the static files
+    var directory = switch (format) {
+      case file -> repository;
+      case mbtiles -> repository.getParent();
+      case pmtiles -> repository.getParent();
+    };
+    Files.createDirectories(directory);
+    try (var html = this.getClass().getResourceAsStream("/static/server.html")) {

Review Comment:
   ## Unsafe use of getResource
   
   The idiom getClass().getResource() is unsafe for classes that may be extended.
   
   [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/955)



-- 
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@baremaps.apache.org

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


Re: [PR] Move most assets to baremaps site [incubator-baremaps]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #837:
URL: https://github.com/apache/incubator-baremaps/pull/837#issuecomment-1970036661

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_baremaps&pullRequest=837) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [6 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_baremaps&pullRequest=837&resolved=false&inNewCodePeriod=true)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_baremaps&pullRequest=837)
   
   


-- 
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@baremaps.apache.org

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


Re: [PR] Move most assets to baremaps site [incubator-baremaps]

Posted by "sonarcloud[bot] (via GitHub)" <gi...@apache.org>.
sonarcloud[bot] commented on PR #837:
URL: https://github.com/apache/incubator-baremaps/pull/837#issuecomment-1967894409

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_baremaps&pullRequest=837) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [6 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_baremaps&pullRequest=837&resolved=false&inNewCodePeriod=true)  
     
   [See analysis details on SonarCloud](https://sonarcloud.io/dashboard?id=apache_baremaps&pullRequest=837)
   
   


-- 
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@baremaps.apache.org

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


Re: [PR] Move most assets to baremaps site [incubator-baremaps]

Posted by "github-advanced-security[bot] (via GitHub)" <gi...@apache.org>.
github-advanced-security[bot] commented on code in PR #837:
URL: https://github.com/apache/incubator-baremaps/pull/837#discussion_r1506758813


##########
examples/_static/server.js:
##########
@@ -0,0 +1,61 @@
+/**
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to you 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.
+ **/
+
+/**
+ * This is a simple server to serve the static files
+ * generated with the baremaps export command.
+ */
+
+const http = require('http');
+const fs = require('fs');
+const path = require('path');
+
+const hostname = 'localhost';
+const port = 9000;
+
+http.createServer((req, res) => {
+    let file = '.' + req.url;
+    if (file === './') {
+        file = './index.html';
+    }
+
+    const extension = String(path.extname(file)).toLowerCase();
+    const mimeTypes = {
+        '.html': 'text/html',
+        '.js': 'text/javascript',
+        '.css': 'text/css',
+        '.mvt': 'application/vnd.mapbox-vector-tile',
+    };
+
+    const contentType = mimeTypes[extension] || 'application/octet-stream';
+
+    fs.readFile(file, (error, content) => {

Review Comment:
   ## Uncontrolled data used in path expression
   
   This path depends on a [user-provided value](1).
   
   [Show more details](https://github.com/apache/incubator-baremaps/security/code-scanning/956)



-- 
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@baremaps.apache.org

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


Re: [PR] Move most assets to baremaps site [incubator-baremaps]

Posted by "bchapuis (via GitHub)" <gi...@apache.org>.
bchapuis merged PR #837:
URL: https://github.com/apache/incubator-baremaps/pull/837


-- 
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@baremaps.apache.org

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