@@ -3557,19 +3557,19 @@ var __copyProps = (to, from, except, desc) => {
3557
3557
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
3558
3558
3559
3559
// pkg/dist-src/index.js
3560
- var dist_src_exports = {};
3561
- __export(dist_src_exports , {
3560
+ var index_exports = {};
3561
+ __export(index_exports , {
3562
3562
Octokit: () => Octokit
3563
3563
});
3564
- module.exports = __toCommonJS(dist_src_exports );
3564
+ module.exports = __toCommonJS(index_exports );
3565
3565
var import_universal_user_agent = __nccwpck_require__(3843);
3566
3566
var import_before_after_hook = __nccwpck_require__(2732);
3567
3567
var import_request = __nccwpck_require__(8636);
3568
3568
var import_graphql = __nccwpck_require__(7);
3569
3569
var import_auth_token = __nccwpck_require__(7864);
3570
3570
3571
3571
// pkg/dist-src/version.js
3572
- var VERSION = "5.2.0 ";
3572
+ var VERSION = "5.2.1 ";
3573
3573
3574
3574
// pkg/dist-src/index.js
3575
3575
var noop = () => {
@@ -17139,7 +17139,7 @@ module.exports = {
17139
17139
17140
17140
17141
17141
const { parseSetCookie } = __nccwpck_require__(8915)
17142
- const { stringify, getHeadersList } = __nccwpck_require__(3834)
17142
+ const { stringify } = __nccwpck_require__(3834)
17143
17143
const { webidl } = __nccwpck_require__(4222)
17144
17144
const { Headers } = __nccwpck_require__(6349)
17145
17145
@@ -17215,14 +17215,13 @@ function getSetCookies (headers) {
17215
17215
17216
17216
webidl.brandCheck(headers, Headers, { strict: false })
17217
17217
17218
- const cookies = getHeadersList( headers).cookies
17218
+ const cookies = headers.getSetCookie()
17219
17219
17220
17220
if (!cookies) {
17221
17221
return []
17222
17222
}
17223
17223
17224
- // In older versions of undici, cookies is a list of name:value.
17225
- return cookies.map((pair) => parseSetCookie(Array.isArray(pair) ? pair[1] : pair))
17224
+ return cookies.map((pair) => parseSetCookie(pair))
17226
17225
}
17227
17226
17228
17227
/**
@@ -17650,14 +17649,15 @@ module.exports = {
17650
17649
/***/ }),
17651
17650
17652
17651
/***/ 3834:
17653
- /***/ ((module, __unused_webpack_exports, __nccwpck_require__ ) => {
17652
+ /***/ ((module) => {
17654
17653
17655
17654
"use strict";
17656
17655
17657
17656
17658
- const assert = __nccwpck_require__(2613)
17659
- const { kHeadersList } = __nccwpck_require__(6443)
17660
-
17657
+ /**
17658
+ * @param {string} value
17659
+ * @returns {boolean}
17660
+ */
17661
17661
function isCTLExcludingHtab (value) {
17662
17662
if (value.length === 0) {
17663
17663
return false
@@ -17918,31 +17918,13 @@ function stringify (cookie) {
17918
17918
return out.join('; ')
17919
17919
}
17920
17920
17921
- let kHeadersListNode
17922
-
17923
- function getHeadersList (headers) {
17924
- if (headers[kHeadersList]) {
17925
- return headers[kHeadersList]
17926
- }
17927
-
17928
- if (!kHeadersListNode) {
17929
- kHeadersListNode = Object.getOwnPropertySymbols(headers).find(
17930
- (symbol) => symbol.description === 'headers list'
17931
- )
17932
-
17933
- assert(kHeadersListNode, 'Headers cannot be parsed')
17934
- }
17935
-
17936
- const headersList = headers[kHeadersListNode]
17937
- assert(headersList)
17938
-
17939
- return headersList
17940
- }
17941
-
17942
17921
module.exports = {
17943
17922
isCTLExcludingHtab,
17944
- stringify,
17945
- getHeadersList
17923
+ validateCookieName,
17924
+ validateCookiePath,
17925
+ validateCookieValue,
17926
+ toIMFDate,
17927
+ stringify
17946
17928
}
17947
17929
17948
17930
@@ -21946,6 +21928,7 @@ const {
21946
21928
isValidHeaderName,
21947
21929
isValidHeaderValue
21948
21930
} = __nccwpck_require__(5523)
21931
+ const util = __nccwpck_require__(9023)
21949
21932
const { webidl } = __nccwpck_require__(4222)
21950
21933
const assert = __nccwpck_require__(2613)
21951
21934
@@ -22499,6 +22482,9 @@ Object.defineProperties(Headers.prototype, {
22499
22482
[Symbol.toStringTag]: {
22500
22483
value: 'Headers',
22501
22484
configurable: true
22485
+ },
22486
+ [util.inspect.custom]: {
22487
+ enumerable: false
22502
22488
}
22503
22489
})
22504
22490
@@ -31675,6 +31661,20 @@ class Pool extends PoolBase {
31675
31661
? { ...options.interceptors }
31676
31662
: undefined
31677
31663
this[kFactory] = factory
31664
+
31665
+ this.on('connectionError', (origin, targets, error) => {
31666
+ // If a connection error occurs, we remove the client from the pool,
31667
+ // and emit a connectionError event. They will not be re-used.
31668
+ // Fixes https://github.com/nodejs/undici/issues/3895
31669
+ for (const target of targets) {
31670
+ // Do not use kRemoveClient here, as it will close the client,
31671
+ // but the client cannot be closed in this state.
31672
+ const idx = this[kClients].indexOf(target)
31673
+ if (idx !== -1) {
31674
+ this[kClients].splice(idx, 1)
31675
+ }
31676
+ }
31677
+ })
31678
31678
}
31679
31679
31680
31680
[kGetDispatcher] () {
@@ -38808,16 +38808,16 @@ const github = __nccwpck_require__(847);
38808
38808
function getFilesInCommit(commit, token) {
38809
38809
return __awaiter(this, void 0, void 0, function* () {
38810
38810
const repo = github.context.payload.repository;
38811
- console.log(' repo : ' + repo);
38811
+ console.log(" repo : " + repo);
38812
38812
const owner = repo === null || repo === void 0 ? void 0 : repo.owner;
38813
- console.log(' owner : ' + owner);
38813
+ console.log(" owner : " + owner);
38814
38814
const allFiles = [];
38815
38815
const args = { owner: (owner === null || owner === void 0 ? void 0 : owner.name) || (owner === null || owner === void 0 ? void 0 : owner.login), repo: repo === null || repo === void 0 ? void 0 : repo.name };
38816
38816
args.ref = commit.id || commit.sha;
38817
38817
const octokit = github.getOctokit(token);
38818
- console.log(' octokit : ' + octokit);
38819
- const result = yield octokit.repos.getCommit(args);
38820
- console.log(' result : ' + result);
38818
+ console.log(" octokit : " + octokit);
38819
+ const result = yield octokit.rest. repos.getCommit(args);
38820
+ console.log(" result : " + result);
38821
38821
if (result && result.data && result.data.files) {
38822
38822
const files = result.data.files;
38823
38823
files
@@ -38894,19 +38894,19 @@ const core = __nccwpck_require__(7484);
38894
38894
class Action {
38895
38895
constructor(actionString) {
38896
38896
actionString = actionString.toLowerCase();
38897
- let as = actionString.split('/' );
38897
+ let as = actionString.split("/" );
38898
38898
this.author = as[0];
38899
- let action = as[1].split('@' );
38899
+ let action = as[1].split("@" );
38900
38900
this.name = action[0];
38901
- this.ref = ( action.length > 1) ? action[1] : "*";
38901
+ this.ref = action.length > 1 ? action[1] : "*";
38902
38902
}
38903
38903
toString() {
38904
38904
return `${this.author}/${this.name}@${this.ref}`;
38905
38905
}
38906
38906
}
38907
38907
exports.Action = Action;
38908
38908
function isPolicyResponse(obj) {
38909
- return typeof obj === ' object' && obj !== null && Array.isArray(obj.actions);
38909
+ return typeof obj === " object" && obj !== null && Array.isArray(obj.actions);
38910
38910
}
38911
38911
function run(context) {
38912
38912
return __awaiter(this, void 0, void 0, function* () {
@@ -38930,22 +38930,22 @@ function run(context) {
38930
38930
// Get the pull request number
38931
38931
const prNumber = (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.number;
38932
38932
if (prNumber) {
38933
- console.log(' prNumber : ' + prNumber);
38933
+ console.log(" prNumber : " + prNumber);
38934
38934
// Fetch the pull request details to get the commits_url
38935
- const prDetails = yield client.pulls.get({
38935
+ const prDetails = yield client.rest. pulls.get({
38936
38936
owner: github.context.repo.owner,
38937
38937
repo: github.context.repo.repo,
38938
38938
pull_number: prNumber,
38939
38939
});
38940
- console.log(' prDetails : ' + prDetails);
38940
+ console.log(" prDetails : " + prDetails);
38941
38941
// Use the commits_url to fetch commits related to the pull request
38942
38942
const url = prDetails.data.commits_url;
38943
- console.log(' url : ' + url);
38943
+ console.log(" url : " + url);
38944
38944
commits = yield client.paginate(`GET ${url}`, {
38945
38945
owner: github.context.repo.owner,
38946
38946
repo: github.context.repo.repo,
38947
38947
});
38948
- console.log(' commits : ' + commits);
38948
+ console.log(" commits : " + commits);
38949
38949
}
38950
38950
else {
38951
38951
console.error("Pull request number not found in payload.");
@@ -38956,22 +38956,22 @@ function run(context) {
38956
38956
// Get the pull request number
38957
38957
const prNumber2 = (_b = github.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.number;
38958
38958
if (prNumber2) {
38959
- console.log(' prNumber2 : ' + prNumber2);
38959
+ console.log(" prNumber2 : " + prNumber2);
38960
38960
// Fetch the pull request details to get the commits_url
38961
- const prDetails2 = yield client.pulls.get({
38961
+ const prDetails2 = yield client.rest. pulls.get({
38962
38962
owner: github.context.repo.owner,
38963
38963
repo: github.context.repo.repo,
38964
38964
pull_number: prNumber2,
38965
38965
});
38966
- console.log(' prDetails : ' + prDetails2);
38966
+ console.log(" prDetails : " + prDetails2);
38967
38967
// Use the commits_url to fetch commits related to the pull request
38968
38968
const url2 = prDetails2.data.commits_url;
38969
- console.log(' url2 : ' + url2);
38969
+ console.log(" url2 : " + url2);
38970
38970
commits = yield client.paginate(`GET ${url2}`, {
38971
38971
owner: github.context.repo.owner,
38972
38972
repo: github.context.repo.repo,
38973
38973
});
38974
- console.log(' commits : ' + commits);
38974
+ console.log(" commits : " + commits);
38975
38975
}
38976
38976
else {
38977
38977
console.error("Pull request number not found in payload.");
@@ -38983,7 +38983,7 @@ function run(context) {
38983
38983
}
38984
38984
for (let i = 0; i < commits.length; i++) {
38985
38985
var f = yield ghf.getFilesInCommit(commits[i], gitHubToken);
38986
- f.forEach(element => allFiles.add(element));
38986
+ f.forEach(( element) => allFiles.add(element));
38987
38987
}
38988
38988
let actionPolicyList = new Array();
38989
38989
let actionViolations = new Array();
@@ -38992,8 +38992,9 @@ function run(context) {
38992
38992
//look for any workflow file updates
38993
38993
allFiles.forEach((file) => {
38994
38994
let filePath = path_1.default.parse(file);
38995
- console.log('filePath : ' + filePath);
38996
- if ((filePath.ext.toLowerCase() == ".yaml" || filePath.ext.toLowerCase() == ".yml") &&
38995
+ console.log("filePath : " + filePath);
38996
+ if ((filePath.ext.toLowerCase() == ".yaml" ||
38997
+ filePath.ext.toLowerCase() == ".yml") &&
38997
38998
filePath.dir.toLowerCase() == ".github/workflows") {
38998
38999
workflowFilePaths.push(file);
38999
39000
}
@@ -39005,28 +39006,29 @@ function run(context) {
39005
39006
}
39006
39007
// Load up the remote policy list
39007
39008
yield (0, node_fetch_1.default)(policyUrl)
39008
- .then(response => response.json())
39009
+ .then(( response) => response.json())
39009
39010
.then((json) => {
39010
- json.actions.forEach(as => {
39011
+ // json is now correctly typed as PolicyResponse
39012
+ json.actions.forEach((as) => {
39011
39013
actionPolicyList.push(new Action(as));
39012
39014
});
39013
39015
})
39014
- .catch(error => {
39015
- console.error(' Error fetching or parsing policy:' , error);
39016
+ .catch(( error) => {
39017
+ console.error(" Error fetching or parsing policy:" , error);
39016
39018
// Handle the error appropriately (e.g., throw an error, set a default policy)
39017
39019
});
39018
39020
console.log("\nACTION POLICY LIST");
39019
39021
console.log(line);
39020
39022
actionPolicyList.forEach((item) => {
39021
39023
console.log(item.toString());
39022
39024
});
39023
- workflowFilePaths.forEach(wf => {
39025
+ workflowFilePaths.forEach((wf) => {
39024
39026
let workflow = { filePath: wf, actions: Array() };
39025
39027
workflowFiles.push(workflow);
39026
39028
try {
39027
39029
let yaml = js_yaml_1.default.load(fs_1.default.readFileSync(workflow.filePath, "utf-8"));
39028
39030
let actionStrings = getPropertyValues(yaml, "uses");
39029
- actionStrings.forEach(as => {
39031
+ actionStrings.forEach((as) => {
39030
39032
workflow.actions.push(new Action(as));
39031
39033
});
39032
39034
}
@@ -39047,12 +39049,15 @@ function run(context) {
39047
39049
workflowFiles.forEach((workflow) => {
39048
39050
console.log(`\nEvaluating '${workflow.filePath}'`);
39049
39051
console.log(line);
39050
- let violation = { filePath: workflow.filePath, actions: Array() };
39052
+ let violation = {
39053
+ filePath: workflow.filePath,
39054
+ actions: Array(),
39055
+ };
39051
39056
workflow.actions.forEach((action) => {
39052
39057
console.log(` - ${action.toString()}`);
39053
39058
if (action.author == ".")
39054
39059
return;
39055
- let match = actionPolicyList.find(policy => policy.author === action.author &&
39060
+ let match = actionPolicyList.find(( policy) => policy.author === action.author &&
39056
39061
(policy.name === "*" || action.name === policy.name) &&
39057
39062
(policy.ref === "*" || action.ref == policy.ref));
39058
39063
if (policyType == "allow") {
@@ -39077,9 +39082,9 @@ function run(context) {
39077
39082
core.setOutput("violations", actionViolations);
39078
39083
console.log("\n!!! ACTION POLICY VIOLATIONS DETECTED !!!");
39079
39084
console.log(line);
39080
- actionViolations.forEach(workflow => {
39085
+ actionViolations.forEach(( workflow) => {
39081
39086
console.log(`Workflow: ${workflow.filePath}`);
39082
- workflow.actions.forEach(action => {
39087
+ workflow.actions.forEach(( action) => {
39083
39088
console.log(` - ${action.toString()}`);
39084
39089
});
39085
39090
console.log();
0 commit comments