pawarprasad123 commented on code in PR #721:
URL: https://github.com/apache/atlas/pull/721#discussion_r3929935270
##########
3party-licenses/bootstrap-LICENSE:
##########
@@ -0,0 +1,22 @@
+The MIT License (MIT)
Review Comment:
webapp/ → mvn clean package -pl webapp -DskipTests -DskipEnunciate=true
Fail
War plugin expects target/api/v2/apidocs/ui — pre-existing when Enunciate is
skipped
run and check:
`mvn clean package -pl webapp -DskipTests
`
Then confirm zero CDN references:
`grep -r "bootstrapcdn.com\|code.jquery.com\|cdn.jsdelivr.net"
webapp/target/api/v2/`
##########
webapp/pom.xml:
##########
@@ -683,6 +683,84 @@
</tasks>
</configuration>
</execution>
+ <execution>
+ <id>fix-enunciate-csp-assets</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <skip>${skipEnunciate}</skip>
+ <tasks>
+ <!-- Copy CSS -->
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/ui/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+
+ <!-- Copy JS (Note: jQuery 1.12.2 is pinned
for compatibility with Bootstrap 3.4.1 in static Enunciate REST API
documentation) -->
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/ui/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+
+ <!-- Replace URLs -->
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.html"
token="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
value="css/bootstrap.min.css" />
Review Comment:
line 718-722
Relative paths (css/..., js/...) assume HTML and assets share the same
directory depth. Please confirm Enunciate never emits HTML in deeper subdirs,
or use path-relative replacements per output folder.
##########
docs/crypto-fallback.js:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+const crypto = require("crypto");
+const originalCreateHash = crypto.createHash;
+
+crypto.createHash = (algorithm, options) => {
+ if (algorithm === "md4") {
+ try {
+ return originalCreateHash("md4", options);
+ } catch (e) {
+ return originalCreateHash("sha256", options);
+ }
+ }
+ return originalCreateHash(algorithm, options);
+};
+
+process.on("uncaughtException", function (err) {
Review Comment:
Swallowing all ECONNRESET via global uncaughtException can mask unrelated
failures. Consider scoping to the Docz dev-server lifecycle or removing if no
longer needed after md4 fallback.
##########
webapp/src/main/enunciate-assets/js/prettify.css:
##########
@@ -0,0 +1,34 @@
+/* Pretty printing styles. Used with prettify.js. */
Review Comment:
Consider moving to css/prettify.css for clearer asset organization (update
run_prettify.js base path logic if needed).
##########
docs/crypto-fallback.js:
##########
@@ -0,0 +1,40 @@
+/**
+ * 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.
+ */
+
+const crypto = require("crypto");
+const originalCreateHash = crypto.createHash;
+
+crypto.createHash = (algorithm, options) => {
Review Comment:
Document why md4→sha256 fallback is safe for webpack content hashing (hash
values change but build output remains valid).
##########
webapp/pom.xml:
##########
@@ -683,6 +683,84 @@
</tasks>
</configuration>
</execution>
+ <execution>
+ <id>fix-enunciate-csp-assets</id>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <phase>prepare-package</phase>
+ <configuration>
+ <skip>${skipEnunciate}</skip>
+ <tasks>
+ <!-- Copy CSS -->
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/ui/css">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/css" />
+ </copy>
+
+ <!-- Copy JS (Note: jQuery 1.12.2 is pinned
for compatibility with Bootstrap 3.4.1 in static Enunciate REST API
documentation) -->
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+ <copy failonerror="true"
todir="${project.build.directory}/api/v2/apidocs/ui/js">
+ <fileset
dir="${project.basedir}/src/main/enunciate-assets/js" />
+ </copy>
+
+ <!-- Replace URLs -->
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.html"
token="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
value="css/bootstrap.min.css" />
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.html"
token="https://code.jquery.com/jquery-1.12.2.min.js"
value="js/jquery-1.12.2.min.js" />
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.html"
token="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"
value="js/bootstrap.min.js" />
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.html"
token="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"
value="js/run_prettify.js" />
+ <replace
dir="${project.build.directory}/api/v2" includes="**/*.js"
token="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/"
value="" />
+
+ <!-- Verify no CDN URLs remain -->
+ <fail message="Build failure: CDN references
to bootstrapcdn.com found in generated API docs!">
Review Comment:
line 725-758
Consider adding positive <available> checks after copy to assert bundled
assets exist, not only that CDN strings are absent.
##########
webapp/src/main/enunciate-assets/js/run_prettify.js:
##########
@@ -0,0 +1,64 @@
+!function(){/*
+
+ Copyright (C) 2013 Google Inc.
+
+ 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.
+
+ Copyright (C) 2006 Google Inc.
+
+ 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.
+*/
+(function(){function aa(g){function
r(){try{L.doScroll("left")}catch(ba){k.setTimeout(r,50);return}x("poll")}function
x(r){if("readystatechange"!=r.type||"complete"==z.readyState)("load"==r.type?k:z)[B](n+r.type,x,!1),!l&&(l=!0)&&g.call(k,r.type||r)}var
X=z.addEventListener,l=!1,E=!0,v=X?"addEventListener":"attachEvent",B=X?"removeEventListener":"detachEvent",n=X?"":"on";if("complete"==z.readyState)g.call(k,"lazy");else{if(z.createEventObject&&L.doScroll){try{E=!k.frameElement}catch(ba){}E&&r()}z[v](n+
+"DOMContentLoaded",x,!1);z[v](n+"readystatechange",x,!1);k[v](n+"load",x,!1)}}function
T(){U&&aa(function(){var g=M.length;ca(g?function(){for(var
r=0;r<g;++r)(function(g){k.setTimeout(function(){k.exports[M[g]].apply(k,arguments)},0)})(r)}:void
0)})}for(var
k=window,z=document,L=z.documentElement,N=z.head||z.getElementsByTagName("head")[0]||L,B="",W="",F=z.getElementsByTagName("script"),l=F.length;0<=--l;){var
O=F[l],Y=O.src.match(/^[^?#]*\/run_prettify\.js(\?[^#]*)?(?:#.*)?$/);if(Y){B=Y[1]||"";W=O.src.replace(/run_prettify\.js(\?[^#]*)?(?:#.*)?$/,"");O.parentNode.removeChild(O);
+break}}var
U=!0,H=[],P=[],M=[];B.replace(/[?&]([^&=]+)=([^&]+)/g,function(g,r,x){x=decodeURIComponent(x);r=decodeURIComponent(r);"autorun"==r?U=!/^[0fn]/i.test(x):"lang"==r?H.push(x):"skin"==r?P.push(x):"callback"==r&&M.push(x)});l=0;for(B=H.length;l<B;++l)(function(){var
g=z.createElement("script");g.onload=g.onerror=g.onreadystatechange=function(){!g||g.readyState&&!/loaded|complete/.test(g.readyState)||(g.onerror=g.onload=g.onreadystatechange=null,--S,S||k.setTimeout(T,0),g.parentNode&&g.parentNode.removeChild(g),
+g=null)};g.type="text/javascript";g.src=W+"lang-"+encodeURIComponent(H[l])+".js";N.insertBefore(g,N.firstChild)})(H[l]);for(var
S=H.length,F=[],l=0,B=P.length;l<B;++l)F.push(W+"skins/"+encodeURIComponent(P[l])+".css");F.push(W+"prettify.css");(function(g){function
r(l){if(l!==x){var k=z.createElement("link");k.rel="stylesheet";
+k.type="text/css";l+1<x&&(k.error=k.onerror=function(){r(l+1)});k.href=g[l];N.appendChild(k)}}var
x=g.length;r(0)})(F);var ca=function(){"undefined"!==typeof
window&&(window.PR_SHOULD_USE_CONTINUATION=!0);var g;(function(){function
r(a){function d(e){var a=e.charCodeAt(0);if(92!==a)return a;var
c=e.charAt(1);return(a=k[c])?a:"0"<=c&&"7">=c?parseInt(e.substring(1),8):"u"===c||"x"===c?parseInt(e.substring(2),16):e.charCodeAt(1)}function
f(e){if(32>e)return(16>e?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);
+return"\\"===e||"-"===e||"]"===e||"^"===e?"\\"+e:e}function c(e){var
c=e.substring(1,e.length-1).match(RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));e=[];var
a="^"===c[0],b=["["];a&&b.push("^");for(var a=a?1:0,h=c.length;a<h;++a){var
m=c[a];if(/\\[bdsw]/i.test(m))b.push(m);else{var
m=d(m),p;a+2<h&&"-"===c[a+1]?(p=d(c[a+2]),a+=2):p=m;e.push([m,p]);65>p||122<m||(65>p||90<m||e.push([Math.max(65,m)|32,Math.min(p,90)|32]),97>p||122<m||
+e.push([Math.max(97,m)&-33,Math.min(p,122)&-33]))}}e.sort(function(e,a){return
e[0]-a[0]||a[1]-e[1]});c=[];h=[];for(a=0;a<e.length;++a)m=e[a],m[0]<=h[1]+1?h[1]=Math.max(h[1],m[1]):c.push(h=m);for(a=0;a<c.length;++a)m=c[a],b.push(f(m[0])),m[1]>m[0]&&(m[1]+1>m[0]&&b.push("-"),b.push(f(m[1])));b.push("]");return
b.join("")}function g(e){for(var
a=e.source.match(RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)",
+"g")),b=a.length,d=[],h=0,m=0;h<b;++h){var
p=a[h];"("===p?++m:"\\"===p.charAt(0)&&(p=+p.substring(1))&&(p<=m?d[p]=-1:a[h]=f(p))}for(h=1;h<d.length;++h)-1===d[h]&&(d[h]=++r);for(m=h=0;h<b;++h)p=a[h],"("===p?(++m,d[m]||(a[h]="(?:")):"\\"===p.charAt(0)&&(p=+p.substring(1))&&p<=m&&(a[h]="\\"+d[p]);for(h=0;h<b;++h)"^"===a[h]&&"^"!==a[h+1]&&(a[h]="");if(e.ignoreCase&&A)for(h=0;h<b;++h)p=a[h],e=p.charAt(0),2<=p.length&&"["===e?a[h]=c(p):"\\"!==e&&(a[h]=p.replace(/[a-zA-Z]/g,function(a){a=a.charCodeAt(0);
+return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var
r=0,A=!1,q=!1,I=0,b=a.length;I<b;++I){var t=a[I];if(t.ignoreCase)q=!0;else
if(/[a-z]/i.test(t.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){A=!0;q=!1;break}}for(var
k={b:8,t:9,n:10,v:11,f:12,r:13},u=[],I=0,b=a.length;I<b;++I){t=a[I];if(t.global||t.multiline)throw
Error(""+t);u.push("(?:"+g(t)+")")}return new
RegExp(u.join("|"),q?"gi":"g")}function l(a,d){function f(a){var
b=a.nodeType;if(1==b){if(!c.test(a.className)){for(b=
+a.firstChild;b;b=b.nextSibling)f(b);b=a.nodeName.toLowerCase();if("br"===b||"li"===b)g[q]="\n",A[q<<1]=r++,A[q++<<1|1]=a}}else
if(3==b||4==b)b=a.nodeValue,b.length&&(b=d?b.replace(/\r\n?/g,"\n"):b.replace(/[
\t\r\n]+/g," "),g[q]=b,A[q<<1]=r,r+=b.length,A[q++<<1|1]=a)}var
c=/(?:^|\s)nocode(?:\s|$)/,g=[],r=0,A=[],q=0;f(a);return{a:g.join("").replace(/\n$/,""),c:A}}function
k(a,d,f,c,g){f&&(a={h:a,l:1,j:null,m:null,a:f,c:null,i:d,g:null},c(a),g.push.apply(g,a.g))}function
z(a){for(var d=void 0,f=a.firstChild;f;f=
Review Comment:
If Enunciate ever loads prettify with ?lang= or ?skin= query params,
lang-*.js and skins/*.css aren't bundled and will 404. Confirm default usage
doesn't need them, or bundle the full prettify distribution.
##########
docs/package.json:
##########
@@ -4,11 +4,11 @@
"description": "",
"main": "index.js",
"scripts": {
- "start": "NODE_OPTIONS=--openssl-legacy-provider node
./docz-lib/docz/bin/index.js dev",
+ "start": "NODE_OPTIONS=\"--require $PWD/crypto-fallback.js\" node
./docz-lib/docz/bin/index.js dev",
Review Comment:
$PWD in NODE_OPTIONS breaks on Windows. Document Unix-only requirement or
use path.join(__dirname, ...) via a small launcher script.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]