Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SIGINT-119: Fixed HTTP request character limit violation and SIGINT-375: Detect Action produces a TypeError with latest version 8.2.0 #67

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ function createRapidScanReportString(policyViolations, policyCheckWillFail) {
}
exports.createRapidScanReportString = createRapidScanReportString;
function createComponentRow(component) {
const violatedPolicies = component.violatedPolicies.join('<br/>');
const violatedPolicies = component.violatedPolicies === undefined ? '' : component.violatedPolicies.join('<br/>');
const componentInViolation = (component === null || component === void 0 ? void 0 : component.href) ? `[${component.name}](${component.href})` : component.name;
const componentLicenses = component.licenses.map(license => `${license.violatesPolicy ? ':x: &nbsp; ' : ''}[${license.name}](${license.href})`).join('<br/>');
const vulnerabilities = component.vulnerabilities.map(vulnerability => `${vulnerability.violatesPolicy ? ':x: &nbsp; ' : ''}[${vulnerability.name}](${vulnerability.href})${vulnerability.cvssScore && vulnerability.severity ? ` ${vulnerability.severity}: CVSS ${vulnerability.cvssScore}` : ''}`).join('<br/>');
Expand Down Expand Up @@ -496,11 +496,13 @@ class GitHubCheck {
}
passCheck(summary, text) {
return __awaiter(this, void 0, void 0, function* () {
text = yield this.truncateIfCharacterLimitExceeds(text);
return this.finishCheck('success', summary, text);
});
}
failCheck(summary, text) {
return __awaiter(this, void 0, void 0, function* () {
text = yield this.truncateIfCharacterLimitExceeds(text);
return this.finishCheck('failure', summary, text);
});
}
Expand All @@ -514,6 +516,16 @@ class GitHubCheck {
return this.finishCheck('cancelled', `${this.checkName} Check could not be completed`, `Something went wrong and the ${this.checkName} could not be completed. Check your action logs for more details.`);
});
}
truncateIfCharacterLimitExceeds(text) {
return __awaiter(this, void 0, void 0, function* () {
const maxLength = 65535;
if (text.length > maxLength) {
(0, core_1.warning)(`Text size ${text.length} bytes exceeds maximum limit ${maxLength} bytes. Truncating the text within ${maxLength} bytes`);
return text.slice(0, maxLength);
}
return text;
});
}
finishCheck(conclusion, summary, text) {
return __awaiter(this, void 0, void 0, function* () {
const octokit = (0, github_1.getOctokit)(inputs_1.GITHUB_TOKEN);
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

Loading