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

Commit

Permalink
Merge pull request #68 from JupiterOne/add-questions-to-graph
Browse files Browse the repository at this point in the history
 INT-3469 Add Questions, Workflows, Misc QoL updates #166
  • Loading branch information
zemberdotnet authored May 4, 2022
2 parents 4bb3696 + 05ab8e0 commit 0c20b40
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 12 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: 'CodeQL'

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
# NOTE: This is the template default.
# "At 04:41 on Tuesday."
- cron: '41 4 * * 2'

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

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

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

- name: Install dependencies
run: yarn

- name: Run build
run: yarn build

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
# `javascript` tests both JavaScript code and TypeScript code
languages: 'javascript'

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
40 changes: 40 additions & 0 deletions .github/workflows/questions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Questions
on: [pull_request_target]

jobs:
validate:
runs-on: ubuntu-latest

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

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

- name: Check out target branch questions
uses: actions/checkout@v2
with:
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
path: target

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

- name: Validate questions on target branch
env:
MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID:
${{ secrets.MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID }}
MANAGED_QUESTIONS_JUPITERONE_API_KEY:
${{ secrets.MANAGED_QUESTIONS_JUPITERONE_API_KEY }}
run:
yarn --cwd source j1-integration validate-question-file -a
$MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k
$MANAGED_QUESTIONS_JUPITERONE_API_KEY -p
../target/jupiterone/questions/questions.yaml
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
node_modules/
dist/
.j1-integration/
.j1-integration-cache/
.env
dist/

.eslintcache
tsconfig.tsbuildinfo
coverage/
yarn-error.log
tsconfig.tsbuildinfo
4 changes: 3 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
dist
coverage/
.j1-integration
coverage
.j1-integration-cache
.gitleaks.yml
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to

## [Unreleased]

## 4.0.4 - 2022-05-04

### Added

- `code-ql` and `questions` workflow

## 4.0.3 - 2022-03-31

### Changed
Expand Down
32 changes: 32 additions & 0 deletions jupiterone/questions/questions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
sourceId: managed:slack
integrationDefinitionId: "${integration_definition_id}"
questions:
- id: managed-question-workflow-slack-channel-users
title: How many users are in each of my Slack channels?
description: Returns a list of slack channels and the number of users they have.
queries:
- query: |
FIND slack_channel AS c
THAT HAS slack_user AS u
RETURN
c.name AS Channel,
COUNT(u) AS UsersCount
ORDER BY UsersCount DESC
tags:
- slack
- user
- workflow
- id: managed-question-workflow-slack-external-users
title: Who are the external users within Slack?
description: Returns a list of external Slack users and the corporate channels they're in.
queries:
- query: |
FIND slack_channel AS c
THAT HAS slack_user WITH email !~= "{{@yourEmailDomain.com}}" AS u
RETURN
c.name AS Channel,
u.email AS User
tags:
- slack
- user
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@jupiterone/graph-slack",
"version": "4.0.3",
"version": "4.0.4",
"description": "A graph conversion tool for https://slack.com",
"license": "MPL-2.0",
"main": "src/index.js",
"types": "src/index.d.ts",
"files": [
"src"
"src",
"jupiterone"
],
"publishConfig": {
"access": "public"
Expand All @@ -15,15 +16,18 @@
"start": "j1-integration collect",
"graph": "j1-integration visualize",
"graph:types": "j1-integration visualize-types",
"graph:spec": "j1-integration visualize-types --project-path docs/spec --output-file ./.j1-integration/types-graph/index.spec.html",
"lint": "eslint . --cache --fix --ext .ts,.tsx",
"format": "prettier --write '**/*.{ts,js,json,css,md,yml}'",
"format-check": "prettier --check '**/*.{ts,js,json,css,md,yml}'",
"format:check": "prettier --check '**/*.{ts,js,json,css,md,yml}'",
"type-check": "tsc",
"test": "jest",
"test:env": "LOAD_ENV=1 yarn test",
"test:ci": "yarn format-check && yarn lint && yarn type-check && yarn test",
"build": "tsc -p tsconfig.dist.json --declaration && cp README.md dist/README.md",
"prepush": "yarn format-check && yarn lint && yarn type-check && jest --changedSince main"
"test:ci": "yarn format:check && yarn lint && yarn type-check && yarn test",
"build": "tsc -p tsconfig.dist.json --declaration && cp README.md dist/README.md && cp -r jupiterone/ dist/jupiterone/",
"prepush": "yarn format:check && yarn lint && yarn type-check && jest --changedSince main",
"validate:questions": "j1-integration validate-question-file -a $MANAGED_QUESTIONS_JUPITERONE_ACCOUNT_ID -k $MANAGED_QUESTIONS_JUPITERONE_API_KEY",
"validate:questions:dry": "j1-integration validate-question-file --dry-run"
},
"dependencies": {
"@lifeomic/attempt": "^3.0.1",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.dist.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"**/*.test.js",
"**/*/__tests__/**/*.ts",
"**/*/__tests__/**/*.js",
"**/*/__tests__/**/*.ts",
"**/*/__tests__/**/*.js"
"**/*/__mocks__/**/*.ts",
"**/*/__mocks__/**/*.js"
]
}

0 comments on commit 0c20b40

Please sign in to comment.