-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fill out half of remaining ruletypes in policy for level 1 (#282)
- Loading branch information
1 parent
15ff75b
commit cc5510f
Showing
7 changed files
with
213 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
tests: | ||
- name: repo exists and is public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mindersec | ||
name: minder | ||
expect: pass | ||
http: | ||
status: 200 | ||
body: '{"visibility": "public"}' | ||
- name: repo does not exist | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: findersec | ||
name: finder | ||
expect: fail | ||
http: | ||
status: 404 | ||
- name: not public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mind-control-lazers-inc | ||
name: watchtower | ||
expect: "fail" | ||
http: | ||
status: 200 | ||
body: '{"visibility": "private"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
version: v1 | ||
release_phase: alpha | ||
type: rule-type | ||
name: osps-ac-02 | ||
display_name: Default collaborators to lowest privileges | ||
short_failure_message: Collaborators default to privileged access | ||
severity: | ||
value: info | ||
context: | ||
provider: github | ||
description: Verifies that project collaborators default to the lowest access level. | ||
guidance: | | ||
Reduce the risk of unauthorized access to the project’s repository | ||
by limiting the permissions granted to collaborators. | ||
Most public version control systems (such as GitHub) are configured | ||
in this manner. | ||
def: | ||
in_entity: repository | ||
rule_schema: {} | ||
ingest: | ||
type: rest | ||
rest: | ||
endpoint: '/repos/{{.Entity.Owner}}/{{.Entity.Name}}' | ||
parse: json | ||
fallback: | ||
- http_code: 404 | ||
body: | | ||
{"http_status": 404, "message": "Repo not found"} | ||
eval: | ||
type: jq | ||
jq: | ||
# Public repositories on GitHub will already have minimum _default_ permissions. | ||
- ingested: | ||
def: ".visibility" | ||
constant: "public" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
tests: | ||
- name: repo exists and is public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mindersec | ||
name: minder | ||
expect: pass | ||
http: | ||
status: 200 | ||
body: '{"clone_url": "https://github.com/mindersec/minder.git"}' | ||
- name: repo does not exist | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: findersec | ||
name: finder | ||
expect: fail | ||
http: | ||
status: 404 | ||
- name: not public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mindersec | ||
name: minder | ||
expect: "fail" | ||
http: | ||
status: 200 | ||
body: '{"clone_url": "http://github.com/mindersec/minder.git"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
version: v1 | ||
release_phase: alpha | ||
type: rule-type | ||
name: osps-br-03 | ||
display_name: Development resources use secure channels | ||
short_failure_message: Insecure access to VCS | ||
severity: | ||
value: info | ||
context: | ||
provider: github | ||
description: Verifies that websites and version control systems for development use secure channels. | ||
guidance: | | ||
Any websites and version control systems involved in the project | ||
development MUST be delivered using SSH, HTTPS, or other encrypted | ||
channels. | ||
Protect the confidentiality and integrity of project source code during | ||
development, reducing the risk of eavesdropping or data tampering. | ||
GitHub does this by default. | ||
def: | ||
in_entity: repository | ||
rule_schema: {} | ||
ingest: | ||
type: rest | ||
rest: | ||
endpoint: '/repos/{{.Entity.Owner}}/{{.Entity.Name}}' | ||
parse: json | ||
fallback: | ||
- http_code: 404 | ||
body: | | ||
{"http_status": 404, "message": "Repo not found"} | ||
eval: | ||
type: rego | ||
rego: | ||
type: deny-by-default | ||
def: | | ||
package minder | ||
import rego.v1 | ||
default allow := false | ||
allow if startswith(input.ingested.clone_url, "https://") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
tests: | ||
- name: repo exists and is public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mindersec | ||
name: minder | ||
is_private: false | ||
expect: pass | ||
http: | ||
status: 200 | ||
body: '{"visibility": "public","clone_url": "https://github.com/mindersec/minder.git"}' | ||
- name: repo does not exist | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: findersec | ||
name: finder | ||
expect: fail | ||
http: | ||
status: 404 | ||
- name: not public | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: hidersec | ||
name: hider | ||
expect: fail | ||
http: | ||
status: 200 | ||
body: '{"visibility": "private","clone_url": "http://github.com/mindersec/minder.git"}' | ||
- name: no clone url | ||
def: {} | ||
params: {} | ||
entity: | ||
type: repository | ||
entity: | ||
owner: mindersec | ||
name: minder | ||
expect: fail | ||
http: | ||
status: 200 | ||
body: '{"visibility": "public"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters