diff --git a/compiler-restrictions.js b/compiler-restrictions.js new file mode 100644 index 0000000..faa9b05 --- /dev/null +++ b/compiler-restrictions.js @@ -0,0 +1,21 @@ + +const restricted_compiler_types = ['win32-vc', 'qnx', 'edg']; +const restricted_compiler_id_prefixes = ['icc']; + +function is_restricted_compiler(id, type) { + if (restricted_compiler_types.includes(type)) { + return true; + } else { + for (const prefix of restricted_compiler_id_prefixes) { + if (id.startsWith(prefix)) { + return true; + } + } + } + + return false; +} + +module.exports = { + is_restricted_compiler +}; diff --git a/html/libraries_cpp.html b/html/libraries_cpp.html index a55696a..15e83a4 100644 --- a/html/libraries_cpp.html +++ b/html/libraries_cpp.html @@ -137,6 +137,8 @@ tdCombinationYesNo.addClass("table-success"); tdCombinationYesNo.html(""); + if (compiler.is_restricted) continue; + tdCombinationYesNo.data('hash', compiler.hashes[idxHash]); const aMoreInfo = $(""); diff --git a/index.js b/index.js index cbd94b0..99f4dbd 100644 --- a/index.js +++ b/index.js @@ -4,6 +4,7 @@ const { BuildAnnotations, RemoteAnnotations } = require('./build-annotations'), { BuildLogging } = require('./build-logging'), { CppBuildResultsView } = require('./cpp-build-results'), + { is_restricted_compiler } = require('./compiler-restrictions'), path = require('path'), express = require('express'), { expressjwt } = require('express-jwt'), @@ -79,6 +80,7 @@ async function getConanBinaries(library, version) { setPerCompiler[compilerid] = { name: compilername, compilertype: compilertype, + is_restricted: is_restricted_compiler(compilerid, compilertype), combinations: [], hashes: [] }; @@ -480,6 +482,11 @@ function main() { // note: only works if there's only 1 binary for the given compiler if (id === req.params.compiler && compiler && compiler.hashes && compiler.hashes.length === 1) { + if (is_restricted_compiler(id, compiler.compilertype)) { + res.sendStatus(403); + return; + } + const hash = compiler.hashes[0]; const url = await getPackageUrl(req.params.libraryid, req.params.version, hash); if (url && url['conan_package.tgz']) { @@ -508,6 +515,10 @@ function main() { combo['compiler.libcxx'] === req.params.libcxx.trim()); if (combinationIdx !== -1 && compiler) { + if (is_restricted_compiler(req.params.compiler_version, compiler.compilertype)) { + res.sendStatus(403); + return; + } const hashIdx = compiler.combinations.indexOf(combinationIdx); if (hashIdx !== -1) {