Skip to content

Commit

Permalink
take restrictions into account
Browse files Browse the repository at this point in the history
  • Loading branch information
partouf committed Dec 20, 2024
1 parent 730e90f commit 114ea60
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
21 changes: 21 additions & 0 deletions compiler-restrictions.js
Original file line number Diff line number Diff line change
@@ -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
};
2 changes: 2 additions & 0 deletions html/libraries_cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@
tdCombinationYesNo.addClass("table-success");
tdCombinationYesNo.html("");

if (compiler.is_restricted) continue;

tdCombinationYesNo.data('hash', compiler.hashes[idxHash]);

const aMoreInfo = $("<button>More info</button>");
Expand Down
11 changes: 11 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -79,6 +80,7 @@ async function getConanBinaries(library, version) {
setPerCompiler[compilerid] = {
name: compilername,
compilertype: compilertype,
is_restricted: is_restricted_compiler(compilerid, compilertype),
combinations: [],
hashes: []
};
Expand Down Expand Up @@ -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']) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 114ea60

Please sign in to comment.