Skip to content

Commit

Permalink
Merge pull request #661 from snyk/feat/add-apprisk-opt-in-rules
Browse files Browse the repository at this point in the history
feat: add apprisk rules opt-in injection
  • Loading branch information
aarlaud authored Nov 22, 2023
2 parents 885d186 + acec6d6 commit 8c17ee7
Show file tree
Hide file tree
Showing 22 changed files with 7,628 additions and 35 deletions.
2 changes: 2 additions & 0 deletions client-templates/artifactory/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
BROKER_DOWNSTREAM_TYPE_ARTIFACTORY=true

# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/azure-repos/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_AZURE_REPOS=true
# Guide how to get/create the token https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=preview-page
# Scopes: Ensure Custom defined is selected and under Code select Read & write
AZURE_REPOS_TOKEN=<token>
Expand Down
1 change: 1 addition & 0 deletions client-templates/bitbucket-server/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_BITBUCKET_SERVER=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/container-registry-agent/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_CONTAINER_REGISTRY_AGENT=true
# Your unique broker identifier, copied from snyk.io org settings page
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/github-com/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_GITHUB=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/github-enterprise/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_GITHUB_ENTERPRISE=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/gitlab/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_GITLAB=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/jira-bearer-auth/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_JIRA_BEARER_AUTH=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/jira/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_JIRA=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/nexus/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_NEXUS=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
1 change: 1 addition & 0 deletions client-templates/nexus2/.env.sample
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
BROKER_DOWNSTREAM_TYPE_NEXUS2=true
# your unique broker identifier
BROKER_TOKEN=<broker-token>

Expand Down
17 changes: 15 additions & 2 deletions config.default.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
{
"BROKER_SERVER_UNIVERSAL_CONFIG_ENABLED": false
}
"BROKER_SERVER_UNIVERSAL_CONFIG_ENABLED": false,
"SUPPORTED_BROKER_TYPES": [
"artifactory",
"azure-repos",
"bitbucket-server",
"container-registry-agent",
"github-enterprise",
"github",
"gitlab",
"jira-bearer-auth",
"jira",
"nexus",
"nexus2"
]
}
182 changes: 182 additions & 0 deletions defaultFilters/apprisk/azure-repos.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
[
{
"//": "get core api's location for sanity check",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/_apis/Location",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get resource access for sanity check",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/ResourceAreas",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get specific repository for given organisation",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/git/repositories/:repo",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list of refs",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/git/repositories/:repo/refs",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "pull teams",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/teams",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "pull users via graph api",
"method": "GET",
"path": "/:owner/_apis/graph/users",
"origin": "https://vssps.dev.azure.com/",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get api's connection status",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/connectionData",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get core",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/_apis/core",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get git",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/_apis/git",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list of repositories for given organisation",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/:project/_apis/git/repositories",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list of projects for given organisation",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/projects",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "pull teams",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/projects/:repo/teams",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list of commits for given repository",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/:project/_apis/git/repositories/:repo/commits",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list of team's members",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/projects/:project/teams/:team/members",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "get list project's languages",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/_apis/projectanalysis",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "pull project's languages metrics",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/:project/_apis/projectanalysis/languagemetrics",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
},
{
"//": "expend team",
"method": "GET",
"path": "/${AZURE_REPOS_ORG}/_apis/projects/:project/teams/:team",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
}, {
"//": "get releases",
"method": "OPTIONS",
"path": "/${AZURE_REPOS_ORG}/_apis/Release",
"origin": "https://${AZURE_REPOS_HOST}",
"auth": {
"scheme": "basic",
"token": "${BROKER_CLIENT_VALIDATION_BASIC_AUTH}"
}
}

]
90 changes: 90 additions & 0 deletions defaultFilters/apprisk/bitbucket-server.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
[
{
"//": "used to get repo's commits",
"method": "GET",
"path": "/projects/:projectKey/repos/:repo/commits",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "used to get specific commit",
"method": "GET",
"path": "/projects/:projectKey/repos/:repo/commits/:commit/diff",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "list commit for a given repo",
"method": "GET",
"path": "/:workspace/:repo/commits",
"origin": "https://${BITBUCKET}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "get a specific commit diff stats identified by the commit hash or name of a branch",
"method": "GET",
"path": "/:workspace/:repo/diffstat/commits/:sha",
"origin": "https://${BITBUCKET}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "list the user's workspaces - AppRisk connector",
"method": "GET",
"path": "/workspaces",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "list the user's workspaces - AppRisk connector",
"method": "GET",
"path": "/projects",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "used to get groups",
"method": "GET",
"path": "/admin/groups",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
},
{
"//": "used to get group's members",
"method": "GET",
"path": "/admin/groups/more-members",
"origin": "https://${BITBUCKET_API}",
"auth": {
"scheme": "basic",
"username": "${BITBUCKET_USERNAME}",
"password": "${BITBUCKET_PASSWORD}"
}
}
]
Loading

0 comments on commit 8c17ee7

Please sign in to comment.