Skip to content

Commit

Permalink
add latest spectral integration
Browse files Browse the repository at this point in the history
  • Loading branch information
cmpxchg16 committed Feb 7, 2021
1 parent 5d9112b commit c0941b4
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Spectral
on: [push]
env:
SPECTRAL_DSN: ${{ secrets.SPECTRAL_DSN }}
jobs:
build:
name: Spectral
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install
run: curl -L "https://get.spectralops.io/latest/sh?dsn=$SPECTRAL_DSN" | sudo sh
- name: Scan
run: spectral scan
4 changes: 4 additions & 0 deletions .spectral/ignores.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# ignores known and problematic files, per rule.
# "problematic" files can be test files, mock data files and so on.
AWS0001:
- .*create-react-context/.*
5 changes: 5 additions & 0 deletions .spectral/rules/merchants.speql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
RL001:
name: Merchant IDs
or:
- pattern: MERK_.*
- pattern: MAR_FINDER.*
17 changes: 17 additions & 0 deletions .spectral/rules/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
rules:
- id: AWS0001
name: No AWS secrets in python files.
finding: ".*/(.*).py" # python file name
subject: "(.*)[^/]*" # root folder
description: We should not have any AWS secrets in python files.
tags:
- python
applies_to:
- ".*\\.py$"
severity: info
pattern_group:
aggregate: or
scope: text
patterns:
- pattern: ".*A[KS]IA.*"
pattern_type: regex # This can also be 'dict', 'entropy'. For 'dict' see words.yaml
14 changes: 9 additions & 5 deletions .spectral/spectral.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
reporter:
outputs:
stylish: {} # nice looking CLI reports
log: # use a logger
json: true # enable JSON logging
file: out.json # put output in a file
log: # use a logger
json: true # enable JSON logging
file: out.json # put output in a file

match_ignores:
ignores:
- path: ".*/.spectral/"

projects:
sample:
project:
name: sample
input:
- local: src
- local: .
name: sources
rules:
roots:
- rules
- rules
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ In this example you'll see how to use a JSON output in addition to your regular

This is great for cases where you want to ship logs to your SIEM system or your log management service.

You need to use Spectral v1.9x series (vNext: `curl -L spectralops.io/next | sh`).

Look in [.spectral/spectral.yaml](.spectral/spectral.yaml):

reporter:
outputs:
stylish: {} # nice looking CLI reports
log: # use a logger
json: true # enable JSON logging
file: out.json # put output in a file
log: # use a logger
json: true # enable JSON logging
file: out.json # put output in a file

0 comments on commit c0941b4

Please sign in to comment.