Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-willis committed Aug 2, 2023
0 parents commit 7ef342f
Show file tree
Hide file tree
Showing 38 changed files with 8,630 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ACCESS_TOKEN=
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"root": true,
"extends": [
"./node_modules/@jupiterone/integration-sdk-dev-tools/config/eslint.json"
]
}
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Description

Thank you for contributing to a JupiterOne integration!

## Summary

<!-- Summary here! -->

## Type of change

Please leave any irrelevant options unchecked.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to
not work as expected)
- [ ] This change requires a documentation update
53 changes: 53 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build
on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Check out code repository source code
uses: actions/checkout@v3

- id: setup-node
name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn

- name: Install dependencies
run: yarn --frozen-lockfile

- name: Run tests
run: yarn test:ci

- name: Run build
run: yarn build

# Publishing is done in a separate job to allow
# for all matrix builds to complete.
BuildRelease:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
name: Checkout Code
steps:
- name: Check out repo
uses: actions/checkout@v3
with:
fetch-depth: 0
token: $
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: yarn
- name: Build and Release
uses: jupiterone/action-npm-build-release@v1
with:
npm_auth_token: $
gh_token: $
69 changes: 69 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: 'CodeQL'

on:
push:
branches: ['main']
pull_request:
# The branches below must be a subset of the branches above
branches: ['main']

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: $
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
queries: security-extended,security-and-quality

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
35 changes: 35 additions & 0 deletions .github/workflows/integration-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: J1 Integration deployment

on:
release:
types:
- published

jobs:
j1-integration-deployment:
runs-on: ubuntu-latest
steps:
- name: Get integration name
id: get-integration-name
uses: actions/github-script@0.9.0
with:
script: |
const repositoryName = context.payload.repository.name
const integrationName = repositoryName.replace("graph-", "")
core.setOutput('integrationName', integrationName)
- name: Get version number
id: get-version-number
uses: actions/github-script@0.9.0
with:
script: |
const tagName = context.payload.release.tag_name
const versionNumber = tagName.replace("v", "")
core.setOutput('versionNumber', versionNumber)
- name: Bump integration deployment version
uses: JupiterOne/integration-github-actions/create-integration-deployment@v1
with:
integrationName: $
releaseNotes: $
version: $
githubToken: $
npmAuthToken: $
90 changes: 90 additions & 0 deletions .github/workflows/peril.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: 'Peril'

on:
pull_request:

env:
TRANSPONDER_DOCKER_IMAGE: 081157560428.dkr.ecr.us-east-1.amazonaws.com/transponder:1
SECURITY_SCAN_IMAGE: ghcr.io/jupiterone/security-scan:latest

jobs:
Peril:
name: Peril
permissions:
id-token: write
contents: read
packages: read
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 18.x

- name: Run build
run: yarn install

- name: Get Variables
id: get-vars
run: |
if [[ "${GITHUB_REF}" == 'ref/head/main' && "${GITHUB_EVENT_NAME}" == 'push' ]];
then
echo ::set-output name=aws-oidc-role::arn:aws:iam::081157560428:role/github-main-role
else
echo ::set-output name=aws-oidc-role::arn:aws:iam::081157560428:role/github-pull-request-role
fi
- name: Configure aws credentials
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: $
role-session-name: pr-role-session
aws-region: us-east-1

- name: ECR login
uses: aws-actions/amazon-ecr-login@v1
id: amazon-ecr-login

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: $
password: $

- name: Pull security-scan
run: |
docker pull $SECURITY_SCAN_IMAGE
- name: Run security-scan
run: |
docker run \
--user root \
-v /var/run/docker.sock:/var/run/docker.sock \
-v `pwd`:`pwd` \
-e AWS_ACCESS_KEY_ID=$ \
-e AWS_SECRET_ACCESS_KEY=$ \
-e AWS_SESSION_TOKEN=$ \
-e GITHUB_REPOSITORY=$GITHUB_REPOSITORY \
-e GITHUB_REF_NAME=$GITHUB_REF_NAME \
-e GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER \
-e GITHUB_SERVER_URL=$GITHUB_SERVER_URL \
-e GITHUB_RUN_ID=$GITHUB_RUN_ID \
-e MODE=ci \
-w `pwd` $SECURITY_SCAN_IMAGE
- name: Pull transponder
run: |
docker pull $TRANSPONDER_DOCKER_IMAGE
- name: Run transponder
run: |
docker run --rm -v `pwd`:`pwd` -w `pwd` \
-e J1_API_KEY=$ \
-e J1_API_DOMAIN=$ \
-e J1_ACCOUNT_ID=$ \
$TRANSPONDER_DOCKER_IMAGE
38 changes: 38 additions & 0 deletions .github/workflows/questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Questions
on: [pull_request_target]

jobs:
validate:
runs-on: ubuntu-latest

steps:
- name: Check out `main` branch
uses: actions/checkout@v3
with:
path: source

- name: Check out target branch questions
uses: actions/checkout@v3
with:
ref: $
repository: $
path: target

- id: setup-node
name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install dependencies for `main` branch
run: yarn install --cwd source --frozen-lockfile

- name: Validate questions on target branch
env:
MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID: $
MANAGED_QUESTIONS_JUPITERONE_API_KEY: $
run:
yarn --cwd source j1-integration validate-question-file -a
--frozen-lockfile $MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k
$MANAGED_QUESTIONS_JUPITERONE_API_KEY -p
../target/jupiterone/questions/questions.yaml
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules/
dist/
.j1-integration/
.j1-integration-cache/
.env
.eslintcache
tsconfig.tsbuildinfo
.npmrc
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
dist
coverage/
.j1-integration
.j1-integration-cache
.gitleaks.yml
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
3 changes: 3 additions & 0 deletions CODEOWNERS.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
* @jupiterone/integrations

CODEOWNERS @jupiterone/security
25 changes: 25 additions & 0 deletions Dockerfile.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM node:18-bullseye-slim as builder

ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration

COPY package.json yarn.lock tsconfig.dist.json tsconfig.json LICENSE ${JUPITERONE_INTEGRATION_DIR}/
COPY src/ ${JUPITERONE_INTEGRATION_DIR}/src
WORKDIR ${JUPITERONE_INTEGRATION_DIR}
RUN apt-get update && apt-get install -y python3 make g++ && rm -rf /var/lib/api/lists/*
RUN yarn install
RUN yarn build:docker


FROM node:18-bullseye-slim
ENV JUPITERONE_INTEGRATION_DIR=/opt/jupiterone/integration
COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/dist ${JUPITERONE_INTEGRATION_DIR}
COPY --from=builder --chown=node:node ${JUPITERONE_INTEGRATION_DIR}/yarn.lock ${JUPITERONE_INTEGRATION_DIR}
COPY scripts/ ${JUPITERONE_INTEGRATION_DIR}/scripts
WORKDIR ${JUPITERONE_INTEGRATION_DIR}
RUN apt-get update && apt-get install -y python3
RUN yarn install --production --fronzen-lockfile --cache-folder ./ycache && yarn global add --cache-folder ./ycache @jupiterone/integration-sdk-cli && rm -rf ./ycache && chown -R node:node /opt/jupiterone
RUN export PATH="$(yarn global bin):$PATH"

USER node

CMD ["sh", "scripts/execute.sh"]
Loading

0 comments on commit 7ef342f

Please sign in to comment.