Skip to content

Commit

Permalink
Merge pull request #14 from dcodx/feature/banner
Browse files Browse the repository at this point in the history
added banner
  • Loading branch information
theztefan committed May 2, 2024
2 parents 29dac53 + 85913b7 commit cea81f3
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 95 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @theztefan @dcodx
* @theztefan @david3107
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ For any issues or suggestions for improvement, please create an issue on the pro

## 🤝 Code of Conduct

This project adheres to a [Code of Conduct](.github/CODE_OF_CONDUCT.md). Participation in the GitArmor project means you agree to respect the code of conduct and treat all members of the community with kindness and respect. 💖
This project adheres to a [Code of Conduct](CODE_OF_CONDUCT.md). Participation in the GitArmor project means you agree to respect the code of conduct and treat all members of the community with kindness and respect. 💖

Thank you for your contribution and involvement in making this project better! 🙏
55 changes: 0 additions & 55 deletions .github/workflows/codeql.yml

This file was deleted.

4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# GitArmor

<img src="./imgs/gitarmor-text-blue.png" alt="gitarmor logo"/>
<div style="background-color: white; padding: 10px;">
<img src="./imgs/gitarmor-text-blue.png" alt="gitarmor logo"/>
</div>

GitArmor is a handy tool that makes it easy to assess the secure setup of your developer platform.

Expand Down
1 change: 0 additions & 1 deletion dist/evaluators/repository/WebHooksChecks.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class WebHooksChecks {
// check whether the repository has self hosted runners enabled
async checkWebHooks() {
const webhooks = await (0, WebHooks_1.getWebHooks)(this.repository.owner, this.repository.name);
console.log(webhooks);
// for each webhook in webhooks extract the domain and check if it is in the allowed list in the policy, if not return false
const allowedDomains = this.policy.webhooks.allowed_domains;
const notAllowedDomains = [];
Expand Down
15 changes: 0 additions & 15 deletions dist/github/Utils.js

This file was deleted.

8 changes: 6 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48856,7 +48856,6 @@ class WebHooksChecks {
// check whether the repository has self hosted runners enabled
async checkWebHooks() {
const webhooks = await (0, WebHooks_1.getWebHooks)(this.repository.owner, this.repository.name);
console.log(webhooks);
// for each webhook in webhooks extract the domain and check if it is in the allowed list in the policy, if not return false
const allowedDomains = this.policy.webhooks.allowed_domains;
const notAllowedDomains = [];
Expand Down Expand Up @@ -49506,6 +49505,12 @@ const Report_1 = __nccwpck_require__(9382);
const policies_1 = __nccwpck_require__(7700);
const core = __importStar(__nccwpck_require__(2186));
const run = async () => {
Logger_1.logger.info(`

GitArmor
by dcodx.com - version 1.0

`);
try {
const startTime = process.hrtime();
const inputs = (0, Input_1.parseInputs)();
Expand All @@ -49514,7 +49519,6 @@ const run = async () => {
let report = new Report_1.Report();
report.addInput(inputs);
report.addPolicy(policies);
const policyEvaluator = null;
// depending on which input.level is provided, run the appropriate checks
if (inputs.level === "organization") {
Logger_1.logger.info("Running org level checks");
Expand Down
7 changes: 6 additions & 1 deletion dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ const Report_1 = require("./reporting/Report");
const policies_1 = require("./utils/policies");
const core = __importStar(require("@actions/core"));
const run = async () => {
Logger_1.logger.info(`
GitArmor
by dcodx.com - version 1.0
`);
try {
const startTime = process.hrtime();
const inputs = (0, Input_1.parseInputs)();
Expand All @@ -40,7 +46,6 @@ const run = async () => {
let report = new Report_1.Report();
report.addInput(inputs);
report.addPolicy(policies);
const policyEvaluator = null;
// depending on which input.level is provided, run the appropriate checks
if (inputs.level === "organization") {
Logger_1.logger.info("Running org level checks");
Expand Down
1 change: 1 addition & 0 deletions policies/organization.threats.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ In this section we define the threats that could affect the organization securit
An unauthorized actor could gain access to the organization repositories and exfiltrate sensitive data or inject malicious code.



1 change: 0 additions & 1 deletion src/evaluators/OrgPolicyEvaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { OrgGHASChecks } from "./organization/OrgGHASChecks";
import { OrgAuthenticationChecks } from "./organization/OrgAuthenticationChecks";
import { OrgCustomRolesChecks } from "./organization/OrgCustomRolesChecks";
import { getOrganization } from "../github/Organization";
import { FilesExistChecks } from "./multipurpose/FilesExistChecks";
import { PrivilegesChecks } from "./organization/PrivilegesChecks";

export class OrgPolicyEvaluator {
Expand Down
1 change: 0 additions & 1 deletion src/evaluators/organization/OrgCustomRolesChecks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Organization, CheckResult } from "../../types/common/main";
import { getCustomRolesForOrg } from "../../github/Organization";
import { logger } from "../../utils/Logger";

export class OrgCustomRolesChecks {
private policy: any;
Expand Down
1 change: 0 additions & 1 deletion src/evaluators/organization/OrgGHASChecks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Organization, CheckResult } from "../../types/common/main";
import { getSecurityTeamsForOrg } from "../../github/Organization";
import { logger } from "../../utils/Logger";

export class OrgGHASChecks {
private policy: any;
Expand Down
2 changes: 0 additions & 2 deletions src/evaluators/repository/ActionsChecks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { CheckResult, Repository } from "../../types/common/main";
import {
getRepoActionsPermissions,
getRepoSelectedActions,
getRepoWorkflows,
getRepoWorkflowActions,
} from "../../github/Actions";
import { logger } from "../../utils/Logger";

Expand Down
2 changes: 0 additions & 2 deletions src/evaluators/repository/WebHooksChecks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { CheckResult, Repository } from "../../types/common/main";
import { getWebHooks, getWebHookConfig } from "../../github/WebHooks";
import { logger } from "../../utils/Logger";

export class WebHooksChecks {
private policy: any;
Expand All @@ -18,7 +17,6 @@ export class WebHooksChecks {
this.repository.name,
);

console.log(webhooks);
// for each webhook in webhooks extract the domain and check if it is in the allowed list in the policy, if not return false

const allowedDomains = this.policy.webhooks.allowed_domains;
Expand Down
1 change: 0 additions & 1 deletion src/github/Actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Endpoints } from "@octokit/types";
import { GitArmorKit } from "./GitArmorKit";
import { logger } from "../utils/Logger";
import { getRepoFile } from "./Utils";

//Get GitHub Actions permissions for a repository
export const getRepoActionsPermissions = async (
Expand Down
1 change: 0 additions & 1 deletion src/github/Issues.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Issue } from "../types/common/main";
import { GitArmorKit } from "./GitArmorKit";

// export class to Issues class
Expand Down
5 changes: 2 additions & 3 deletions src/github/Repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,14 @@ export const getRepository = async (
repo: string,
): Promise<Endpoints["GET /repos/{owner}/{repo}"]["response"]["data"]> => {
const octokit = new GitArmorKit();

const response: Endpoints["GET /repos/{owner}/{repo}"]["response"] =
await octokit.rest.repos.get({
owner: owner,
repo: repo,
});

return response.data;

return response.data;
};

export const getRepoPullRequests = async (
Expand Down
1 change: 0 additions & 1 deletion src/github/Utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Endpoints } from "@octokit/types";
import { GitArmorKit } from "./GitArmorKit";
import { logger } from "../utils/Logger";

//Given a certain path in a repository, get the contents of the file
export const getRepoFile = async (
Expand Down
11 changes: 8 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,15 @@ import { Report } from "./reporting/Report";
import { RepoPolicy, OrgPolicy, Repository } from "./types/common/main";
import { loadPolicy } from "./utils/policies";
import * as core from "@actions/core";
import { summary } from "@actions/core/lib/summary";

const run = async (): Promise<void> => {
logger.info(`
GitArmor
by dcodx.com - version 1.0
`);

try {
const startTime = process.hrtime();
const inputs = parseInputs();
Expand All @@ -19,7 +25,6 @@ const run = async (): Promise<void> => {
let report = new Report();
report.addInput(inputs);
report.addPolicy(policies);
const policyEvaluator = null;
// depending on which input.level is provided, run the appropriate checks
if (inputs.level === "organization") {
logger.info("Running org level checks");
Expand Down Expand Up @@ -64,7 +69,7 @@ const run = async (): Promise<void> => {
repository,
policies.repo as RepoPolicy,
);

await policyEvaluator.evaluatePolicy();
policyEvaluator.printCheckResults();
report.addOneRepoEvaluator(policyEvaluator);
Expand Down
3 changes: 1 addition & 2 deletions src/reporting/Report.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { CheckResult, Policy, Inputs } from "../types/common/main";
import { Policy, Inputs } from "../types/common/main";
import { OrgPolicyEvaluator } from "../evaluators/OrgPolicyEvaluator";
import { RepoPolicyEvaluator } from "../evaluators/RepoPolicyEvaluator";
import { logger } from "./../utils/Logger";
import fs from "fs";
import { json } from "stream/consumers";

export class Report {
private orgEvaluators: Map<OrgPolicyEvaluator, RepoPolicyEvaluator[]>;
Expand Down

0 comments on commit cea81f3

Please sign in to comment.