Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
23ff4e3
Add example entities
minkimcello Feb 24, 2025
d9d8c8c
Added Policy kind with processor
taras Feb 25, 2025
31762d6
Create header for security polices card
minkimcello Feb 25, 2025
d432f77
Update example entities
minkimcello Feb 25, 2025
4d4b1d7
Styled policies page
taras Feb 25, 2025
5e50915
Merge branch 'policy-plugin' of github.com:guidanti/developer-portal …
taras Feb 25, 2025
eed3e64
Added policy icon
taras Feb 25, 2025
dad9b95
Add policy rows in card for components
minkimcello Feb 25, 2025
2e20135
Make rating configurable and add policy card to systems page
minkimcello Feb 25, 2025
65ea44e
Create second variation of policy card for systems
minkimcello Feb 25, 2025
873e02e
Enable catalog in side nav
minkimcello Feb 25, 2025
4ff5640
Merge branch 'policy-plugin' of github.com:guidanti/developer-portal …
taras Feb 26, 2025
3912dd3
Explicitly add policies card for systems and components overview pages
minkimcello Feb 26, 2025
085bc97
Add example alerts entity and processor
minkimcello Feb 26, 2025
68e451e
Specify default filters to exclude alerts entities
minkimcello Feb 26, 2025
52711ed
Match up policy names in alerts
minkimcello Feb 26, 2025
4c41c3c
Create table in alerts tab for components
minkimcello Feb 26, 2025
a296771
Update name for one of the alerts
minkimcello Feb 26, 2025
ba790c1
Added compliance and scope data
taras Feb 26, 2025
d98d0e9
Add table for systems alerts with more columns
minkimcello Feb 26, 2025
44718b4
Add header with rating to systems alerts tab
minkimcello Feb 26, 2025
74b5a5b
Generated data for visualizations
taras Feb 26, 2025
e0295de
Added statistics to policy entities
taras Feb 26, 2025
f6dcefd
Merge branch 'policy-plugin' of github.com:guidanti/developer-portal …
taras Feb 26, 2025
9583a39
Add colours to severity and use real entity names
minkimcello Feb 26, 2025
685a161
Merge branch 'policy-plugin' of github.com:guidanti/developer-portal …
taras Feb 26, 2025
7223657
Create a policy entity page
minkimcello Feb 26, 2025
3edf8f3
Add tools and compliant cards to policy entity page
minkimcello Feb 26, 2025
d3a00f4
Remove ecosystem columns from tools card
minkimcello Feb 26, 2025
e90b507
Added chart
taras Feb 26, 2025
7de9a68
Merge branch 'policy-plugin' of github.com:guidanti/developer-portal …
taras Feb 26, 2025
01cbc65
Added the scope card
taras Feb 26, 2025
1b47276
Rearrange and rename alert columns
minkimcello Feb 26, 2025
4ceb02b
Match green/red color in policies card with graph
minkimcello Feb 26, 2025
d814a33
Add entity kind and rename policy level to Remediation
minkimcello Mar 5, 2025
acfc30b
Add static examples for component and group for alert ingestion
minkimcello Mar 4, 2025
a935346
Enable all kinds of entities to be filtered in the catalog
minkimcello Mar 4, 2025
ebb93a2
Create placeholder incremental entity provider for github alerts
minkimcello Mar 5, 2025
883101a
Use octokit to fetch alerts for every repository accessible to app
minkimcello Mar 5, 2025
5f684be
Log out open alert count
minkimcello Mar 5, 2025
46c64dc
Form alerts into Alert entities
minkimcello Mar 5, 2025
7507424
Omit example static alert entities
minkimcello Mar 5, 2025
57ea894
Add custom columns for alert entities
minkimcello Mar 5, 2025
592ed36
Set default ref for alerts fetching to mk/reports
minkimcello Mar 5, 2025
eafdcd5
Update alerts columns to use built-in name
minkimcello Mar 10, 2025
f3f3558
Create alerts processor that uses example opa policy agent
minkimcello Mar 10, 2025
719e0fb
Read policy from a directory and dynamically create processor for each
minkimcello Mar 11, 2025
d2af69c
Parse url from alert for owner and repo name
minkimcello Mar 11, 2025
a942896
Get the policy entity provider hooked up
minkimcello Mar 11, 2025
56af6b8
WIP relationship processor
minkimcello Mar 11, 2025
8c41c7e
Fix relations refs by using object instead of string
minkimcello Mar 11, 2025
c7b1f0f
Remove alerts tab from default entity page
minkimcello Mar 12, 2025
23b039f
Update columns to match alerts payload
minkimcello Mar 12, 2025
d193553
Create a web library plugin
minkimcello Mar 12, 2025
36c67f7
Move all UI components to web library plugin
minkimcello Mar 12, 2025
ae96e60
Remove columns for policy catalog and update columns for alerts
minkimcello Mar 12, 2025
db5a44f
Specify relations for graph card to exclude alert relationships
minkimcello Mar 13, 2025
61ab695
Creating multiple policies
taras Mar 12, 2025
ce3d7cd
Added policies.bundle
taras Mar 12, 2025
455da2f
Got example policies setup
taras Mar 13, 2025
1a6a67f
Some output
taras Mar 13, 2025
5a6cf95
Reorganized to simplify the structure
taras Mar 15, 2025
40e405b
Latest version after recovery
taras Mar 16, 2025
569da9f
Empty directory again
taras Mar 16, 2025
896a0c0
Updated policy.yaml
taras Mar 16, 2025
4948c2f
Remediations and categories are being added to alerts
taras Mar 16, 2025
6238087
Removed uncategories
taras Mar 16, 2025
b7bc374
Wrote the first component test
taras Mar 16, 2025
4f257bb
Fixed lint error
taras Mar 16, 2025
e2592ad
Added updated generated policy
taras Mar 16, 2025
ad70bfd
Fixed schema nesting
taras Mar 16, 2025
b31b864
Added component policy
taras Mar 16, 2025
fdc8582
Read remediation and policy for alerts columns from spec
minkimcello Mar 16, 2025
efeca38
Have security policies card read from spec.compliance
minkimcello Mar 16, 2025
700f2fc
Adding queries
taras Mar 16, 2025
c136a00
Added query for component
taras Mar 16, 2025
e702fad
Evaluating query for components
taras Mar 16, 2025
7f3bda6
Merge branch 'alert-ingestion' of github.com:guidanti/developer-porta…
taras Mar 16, 2025
0a0b3a7
Added default value to namespace
taras Mar 16, 2025
649f4dc
Lower casing the name
taras Mar 16, 2025
32a3a01
Hook up auth to connect to the catalog
taras Mar 16, 2025
0b2c2bd
Added system query
taras Mar 16, 2025
eb2257a
Add failure and success count to compliance card for components
minkimcello Mar 16, 2025
6b46e16
Merge branch 'alert-ingestion' of github.com:guidanti/developer-porta…
taras Mar 16, 2025
d62af9f
Have policy entity use default entity page
minkimcello Mar 16, 2025
4d2ddeb
Added codetour and code comments
taras Mar 28, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ e2e-test-report/
.vscode/*
.swc/

# policies
bundle.tar.gz
bundle
105 changes: 105 additions & 0 deletions .tours/opa-policy-pipeline.tour
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
"$schema": "https://aka.ms/codetour-schema",
"title": "OPA Policy Pipeline",
"steps": [
{
"title": "Policies Pacakge",
"description": "All of the policies are stored in the `policies` directory."
},
{
"file": "policies/deno.json",
"description": "You can run `deno task build` from policies directory to generate a policies bundle. This bundle will include everything in policies directory.",
"line": 5
},
{
"file": "policies.bundle/.manifest",
"description": "The generated bundle has a `.manifest` file which shows all of the entrypoints of the `policy.wasm` file. Entrypoints are used by the processing pipeline to processes entities.",
"line": 6
},
{
"file": "policies.bundle/.manifest",
"description": "\"alert\", \"component\" and \"system\" entrypoints correspond to Backstage entity kinds. To allow applying policies to a new kind, you need to create a new entrypoint. An entrypoint is a policy file with `.rego` extension.",
"line": 8
},
{
"file": "policies/alert/alert.rego",
"description": "These two lines are required by OPA to tell policy compiler to treat this file as entrypoint.",
"line": 1
},
{
"file": "policies/alert/alert.rego",
"description": "package name should be unique and match the name of the directory",
"line": 3
},
{
"file": "policies/alert/alert.rego",
"description": "`remediation` is the name of the property that will be added to the backstage entity. The way to read this is `remediation will contain policy, level, help, description if it matches the alert properties`",
"line": 7
},
{
"file": "policies/alert/alert.rego",
"description": "All of the `remediation` rules will be evaluated but only those matching the `if` block will be included in the `remediation` property. The remediation property will be an array. ",
"line": 18
},
{
"file": "policies/alert/alert.rego",
"description": "policy property refers to entity in alert.yaml file. that file will be contatinated to produce entities file in the policy.bundle. This property create a soft link to the policy entity. ",
"line": 8
},
{
"file": "policies/alert/alert.test.ts",
"description": "You can run this test with `deno test alert/alert.test.ts` from policies directory or `deno test` to run all tests. These tests are used to confirm result of policy execution.",
"line": 4
},
{
"file": "policies/component/component.rego",
"description": "compliance rules on components behave similar to alert remediation except they evaluate using alert remediations as input. ",
"line": 20
},
{
"file": "policies/component/component.rego",
"description": "Backstage processing pipeline processes one entity at a time, which means that a component won't know what alerts belong to it. We need to query the catalog to get alerts that belong to component. We could have hard coded this in the processor, but it would require making TypeScript changes everytime we want to add a new entity kind. Instead, we have `query` rule which receives the entity and returns a filter parameters that can be sent to Backstage Catalog's entities endpoint. The resulting entities will be passed to the compliance query. ",
"line": 10
},
{
"file": "policies/system/system.rego",
"description": "System compliance follows similar pattern to Component compliance but it operates on component compliance results. ",
"line": 18
},
{
"file": "policies/system/system.rego",
"description": "system/query entry point rule returns filters for components. we could query more data by adding another property along side components. ",
"line": 11
},
{
"file": "policies.bundle/policy.yaml",
"description": "This file will contain all policies from .yaml files from directories in policies. This file is included in app-config.yaml",
"line": 1
},
{
"file": "plugins/catalog-backend-module-alerts-policy-processor/src/PolicyProcessor.ts",
"description": "This is the main PolicyProcessor.",
"line": 1
},
{
"file": "plugins/catalog-backend-module-alerts-policy-processor/src/PolicyProcessor.ts",
"description": "It evaluates policy wasm file for each entity kind that has an entrypoint in the entity. Here it checks that the entity kind has an entrypoint in the wasm file. If it doesn't, it just returns the entity which sends it throught the pipeline.",
"line": 47
},
{
"file": "plugins/catalog-backend-module-alerts-policy-processor/src/PolicyProcessor.ts",
"selection": {
"start": {
"line": 61,
"character": 1
},
"end": {
"line": 62,
"character": 1
}
},
"description": "It'll attempt to fetch additional entities the policy for this kind has a `${kind}/query` entrypoint. The result will be added to the `input` variable above."
}
],
"ref": "alert-ingestion"
}
4 changes: 4 additions & 0 deletions app-config.local.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,7 @@ catalog:
target: https://github.com/bcgov/developer-experience-team/blob/main/developer-portal/catalog/templates-seed-dev.yml
rules:
- allow: [Template]
- type: file
target: ../../policies.bundle/policy.yaml
- type: file
target: ../../catalog-info.yaml
25 changes: 25 additions & 0 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ permission:
enabled: true

integrations:
github:
- host: github.com
# token: ${GITHUB_TOKEN}
apps:
- $include: github-app-guidanti-github-app-credentials.yaml

# github:
# - host: github.com
# This is a Personal Access Token or PAT from GitHub. You can find out how to generate this token, and more information
Expand Down Expand Up @@ -114,3 +120,22 @@ catalog:
schedule:
frequency: { minutes: 60 }
timeout: { minutes: 15 }
rules:
- allow:
[
Component,
API,
Location,
Template,
Resource,
System,
Group,
Domain,
Policy,
Alert,
]
locations:
- type: file
target: ../../catalog-info.yaml
- type: file
target: ../../policies.bundle/policy.yaml
209 changes: 202 additions & 7 deletions catalog-info.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,208 @@
apiVersion: backstage.io/v1alpha1
kind: Group
metadata:
name: digital-office
title: Digital Office
description: OCIO Digital Office
spec:
type: division
children: []
---
apiVersion: backstage.io/v1alpha1
kind: Domain
metadata:
name: ecosystem
title: Digital Ecosystem
description: BC Government Digital Ecosystem
spec:
owner: group:digital-office
---
apiVersion: backstage.io/v1alpha1
kind: Domain
metadata:
name: ecosystem-enablers
title: Ecosystem Enablers
description: Internal services developed or governed by the BC Government for the benefit of the BC Government Digital Ecosystem
spec:
owner: group:digital-office
subdomainOf: ecosystem
---
apiVersion: backstage.io/v1alpha1
kind: Domain
metadata:
name: digital-services
title: Digital Services
description: External Digital Services developed by the BC Government
spec:
owner: group:digital-office
subdomainOf: ecosystem
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: silver
description: BC Gov silver-tier shared OpenShift/Kubernetes cluster.
spec:
type: kubernetes-cluster
owner: group:bcgov/platform-services-team
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: gold
description: BC Gov gold-tier shared OpenShift/Kubernetes cluster.
spec:
type: kubernetes-cluster
owner: group:bcgov/platform-services-team
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: gold-dr
description: BC Gov gold-tier shared disaster recovery OpenShift/Kubernetes cluster.
spec:
type: kubernetes-cluster
owner: group:bcgov/platform-services-team
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: emerald
description: BC Gov emerald-tier shared OpenShift/Kubernetes cluster.
spec:
type: kubernetes-cluster
owner: group:bcgov/platform-services-team
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: xyz123-tools
description: For deployment of tools and utilities related to live apps.
spec:
type: kubernetes-namespace
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: xyz123-dev
description: For deployment of development application artifacts.
spec:
type: kubernetes-namespace
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: xyz123-test
description: For deployment of test application artifacts.
spec:
type: kubernetes-namespace
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: xyz123-prod
description: For deployment of production application artifacts.
spec:
type: kubernetes-namespace
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: System
metadata:
name: bcparks-reservation
description: BC Parks reservation system.
spec:
owner: group:bcgov/developer-experience
lifecycle: production
domain: digital-services
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: developer-portal
description: A portal for the BC Government developer community.
name: reserve-rec-public
description: For the Parks and Recreation Digital Transformation project.
annotations:
github.com/project-slug: bcgov/developer-portal
github.com/team-slug: bcgov/teams/exchange-lab-developer-portal-team
# backstage.io/techdocs-ref: dir:.
github.com/project-slug: bcgov/reserve-rec-public
spec:
system: bcparks-reservation
type: website
owner: group:bcgov/exchange-lab-developer-portal-team
lifecycle: experimental
owner: group:bcgov/bc-parks-reservation
lifecycle: production
dependsOn:
- component:reserve-rec-api
- resource:devhub-techdocs-bucket
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: reserve-rec-api
description: For the Parks and Recreation Digital Transformation project.
annotations:
github.com/project-slug: bcgov/reserve-rec-api
spec:
system: bcparks-reservation
type: service
owner: group:bcgov/bc-parks-reservation
lifecycle: production
dependsOn:
- resource:reserve-rec-db
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: reserve-rec-admin
description: For the Parks and Recreation Digital Transformation project.
annotations:
github.com/project-slug: bcgov/reserve-rec-admin
spec:
system: bcparks-reservation
type: website
owner: group:bcgov/bc-parks-reservation
lifecycle: production
dependsOn:
- component:reserve-rec-api
- resource:devhub-techdocs-bucket
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: reserve-rec-db
description: Data store for BC Parks reservation system.
spec:
type: database
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: Resource
metadata:
name: reserve-rec-bucket
description: Stores documents and other related assets related to support the BC Parks Reservation system.
spec:
type: s3-bucket
owner: group:bcgov/bc-parks-reservation
system: bcparks-reservation
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: github-fetchers
spec:
type: service
lifecycle: production
owner: guidanti
---
apiVersion: backstage.io/v1alpha1
kind: Group
metadata:
name: guidanti
spec:
type: team
children: []
Loading