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

Add allowed-endpoints validation #329

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

h0x0er
Copy link
Member

@h0x0er h0x0er commented Jul 27, 2023

No description provided.

Copy link
Contributor

@step-security-bot step-security-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please find StepSecurity AI-CodeWise code comments inline or below.

dist/pre/index.js

Please refer to 1 inline comments.

src/arc-runner.test.ts

Please refer to 2 inline comments.

Feedback

We appreciate your feedback in helping us improve the service! To provide feedback, please use emojis on this comment. If you find a comment helpful, give it a 👍. If they aren't useful, kindly express that with a 👎. If you have questions or detailed feedback, please create n GitHub issue in StepSecurity/AI-CodeWise.

@@ -69321,6 +69327,16 @@ function removeStepPolicyFiles() {
function arcCleanUp() {
cp.execSync(`echo "cleanup" > "${getRunnerTempDir()}/step_policy_cleanup"`);
}
function validateEndpoints(endpoints) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[High]Input Validation

There is no input validation in the validateEndpoints function. Implement input validation in the validateEndpoints function to ensure that the endpoints are in the correct format.

});

it("should write endpoint files", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium]Consider including this refactored function into your pull request

Added a new test function should write endpoint files.

it("should write endpoint files", () => {
  process.env["isTest"] = "1";

  const allowed_endpoints = [
    "github.com:443",
    "*.google.com:443",
    "youtube.com:443",
  ].join(" ");
  sendAllowedEndpoints(allowed_endpoints);
});


})
it("should validate endpoints", () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Medium]Consider including this refactored function into your pull request

Added a new test function should validate endpoints.

it("should validate endpoints", () => {
  let allowedEndpoints = [
    "github.com:443",
    "*.google.com:443",
    "youtube.com:443",
  ].join(" ");
  let areValid = validateEndpoints(allowedEndpoints);
  expect(areValid).toBe(true);

  // presence of invalid endpoint
  allowedEndpoints = [
    "github.com:443",
    "*.google.com",
    "youtube.com",
  ].join(" ");
  areValid = validateEndpoints(allowedEndpoints);
  expect(areValid).toBe(false);
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants