Skip to content

Commit

Permalink
Don't write to file without a parameter set
Browse files Browse the repository at this point in the history
Signed-off-by: John Kjell <john@testifysec.com>
  • Loading branch information
jkjell committed Apr 13, 2024
1 parent 3f3cb2a commit 9bb3541
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
16 changes: 5 additions & 11 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2325,7 +2325,7 @@ class HttpClient {
if (this._keepAlive && useProxy) {
agent = this._proxyAgent;
}
if (this._keepAlive && !useProxy) {
if (!useProxy) {
agent = this._agent;
}
// if agent is already assigned use that agent.
Expand Down Expand Up @@ -2357,16 +2357,12 @@ class HttpClient {
agent = tunnelAgent(agentOptions);
this._proxyAgent = agent;
}
// if reusing agent across request and tunneling agent isn't assigned create a new agent
if (this._keepAlive && !agent) {
// if tunneling agent isn't assigned create a new agent
if (!agent) {
const options = { keepAlive: this._keepAlive, maxSockets };
agent = usingSsl ? new https.Agent(options) : new http.Agent(options);
this._agent = agent;
}
// if not using private agent and tunnel agent isn't setup then use global agent
if (!agent) {
agent = usingSsl ? https.globalAgent : http.globalAgent;
}
if (usingSsl && this._ignoreSslError) {
// we don't want to set NODE_TLS_REJECT_UNAUTHORIZED=0 since that will affect request for entire process
// http.RequestOptions doesn't expose a way to modify RequestOptions.agent.options
Expand Down Expand Up @@ -30527,9 +30523,6 @@ async function run() {
const intermediates = core.getInput("intermediates").split(" ");
const key = core.getInput("key");
let outfile = core.getInput("outfile");
outfile = outfile
? outfile
: path.join(os.tmpdir(), step + "-attestation.json");
const productExcludeGlob = core.getInput("product-exclude-glob");
const productIncludeGlob = core.getInput("product-include-glob");
const spiffeSocket = core.getInput("spiffe-socket");
Expand Down Expand Up @@ -30595,7 +30588,8 @@ async function run() {
}

if (trace) cmd.push(`--trace=${trace}`);
cmd.push(`--outfile=${outfile}`);
if (outfile)
cmd.push(`--outfile=${outfile}`);
core.info("Running in directory " + process.env.GITHUB_WORKSPACE);

process.env.PATH = `${__dirname}:${process.env.PATH}`;
Expand Down
6 changes: 2 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ async function run() {
const intermediates = core.getInput("intermediates").split(" ");
const key = core.getInput("key");
let outfile = core.getInput("outfile");
outfile = outfile
? outfile
: path.join(os.tmpdir(), step + "-attestation.json");
const productExcludeGlob = core.getInput("product-exclude-glob");
const productIncludeGlob = core.getInput("product-include-glob");
const spiffeSocket = core.getInput("spiffe-socket");
Expand Down Expand Up @@ -118,7 +115,8 @@ async function run() {
}

if (trace) cmd.push(`--trace=${trace}`);
cmd.push(`--outfile=${outfile}`);
if (outfile)
cmd.push(`--outfile=${outfile}`);
core.info("Running in directory " + process.env.GITHUB_WORKSPACE);

process.env.PATH = `${__dirname}:${process.env.PATH}`;
Expand Down

0 comments on commit 9bb3541

Please sign in to comment.