Skip to content

Commit

Permalink
Ignore additional types during tar extraction (#853)
Browse files Browse the repository at this point in the history
* Ignore additional types during tar extraction

Signed-off-by: Prabhu Subramanian <[email protected]>

* Handle maven search timeout

Signed-off-by: Prabhu Subramanian <[email protected]>

---------

Signed-off-by: Prabhu Subramanian <[email protected]>
  • Loading branch information
prabhu authored Jan 29, 2024
1 parent 2cd1aeb commit 5704fb4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 11 additions & 1 deletion docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,17 @@ export const extractTar = async (fullImageName, dir) => {
path.includes("ssl/certs") ||
path.includes("etc/") ||
path.includes("logs/") ||
["CharacterDevice"].includes(entry.type)
path.includes("dev/") ||
[
"BlockDevice",
"CharacterDevice",
"FIFO",
"MultiVolume",
"TapeVolume",
"SymbolicLink",
"RenamedOrSymlinked",
"HardLink"
].includes(entry.type)
) {
return false;
}
Expand Down
18 changes: 14 additions & 4 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,14 @@ export const FETCH_LICENSE =
process.env.FETCH_LICENSE &&
["true", "1"].includes(process.env.FETCH_LICENSE);

// Wether search.maven.org will be used to identify jars without maven metadata; default, if unset shall be 'true'
// Whether search.maven.org will be used to identify jars without maven metadata; default, if unset shall be 'true'
export const SEARCH_MAVEN_ORG =
!process.env.SEARCH_MAVEN_ORG ||
["true", "1"].includes(process.env.SEARCH_MAVEN_ORG);

// circuit breaker for search maven.org
let search_maven_org_errors = 0;
const MAX_SEARCH_MAVEN_ORG_ERRORS = 5;
const MAX_SEARCH_MAVEN_ORG_ERRORS = 1;

// circuit breaker for get repo license
let get_repo_license_errors = 0;
Expand Down Expand Up @@ -7112,7 +7112,15 @@ export const extractJarArchive = async function (
sha +
"%22&rows=20&wt=json";
const res = await cdxgenAgent.get(searchurl, {
responseType: "json"
responseType: "json",
timeout: {
lookup: 200,
connect: 5000,
secureConnect: 5000,
socket: 1000,
send: 10000,
response: 1000
}
});
const data = res && res.body ? res.body["response"] : undefined;
if (data && data["numFound"] == 1) {
Expand All @@ -7124,7 +7132,9 @@ export const extractJarArchive = async function (
}
} catch (err) {
if (err && err.message && !err.message.includes("404")) {
console.log(err);
if (DEBUG_MODE) {
console.log(err);
}
search_maven_org_errors++;
}
}
Expand Down

0 comments on commit 5704fb4

Please sign in to comment.