Skip to content

Instantly share code, notes, and snippets.

View AndrienkoAleksandr's full-sized avatar

Oleksandr Andriienko AndrienkoAleksandr

View GitHub Profile
#!/bin/bash
backstageVersion=$(jq -r '.version' backstage.json)
createAppVersion=$(curl "https://raw.githubusercontent.com/backstage/backstage/refs/tags/v${backstageVersion}/packages/create-app/package.json" -s | jq -r '.version')
echo "Backstage version is: ${backstageVersion}, corresponding create-app version is: ${createAppVersion}"
echo "example" | npx "@backstage/create-app@${createAppVersion}"
appconfig=app-config.yaml
appProductionConfig=app-config.production.yaml
g, group:default/onions_16, role:default/onions_16
p, role:default/onions_16, catalog-entity, read, deny
p, role:default/onions_16, catalog-entity, update, allow
p, role:default/onions_16, catalog.entity.create, create, allow
p, role:default/onions_16, scaffolder.template.step.read, read, allow
g, group:default/turnips_17, role:default/turnips_17
p, role:default/turnips_17, catalog-entity, read, allow
p, role:default/turnips_17, catalog-entity, update, allow
p, role:default/turnips_17, catalog.entity.create, create, deny
http cli - is python application httpie, nicely prints good formatted response.
# Role operations
curl -X GET "http://localhost:7007/api/permission/roles" -H "Content-Type: application/json" -H "Authorization: Bearer $token" -v
http GET http://localhost:7007/api/permission/roles Authorization:"Bearer $token"
curl -X GET "http://localhost:7007/api/permission/roles/role/default/test" -H "Content-Type: application/json" -H "Authorization: Bearer $token" -v
http GET http://localhost:7007/api/permission/roles/role/default/test Authorization:"Bearer $token"
{
"apiVersion": "1.0.0",
"swaggerVersion": "1.2",
"basePath": "",
"resourcePath": "/pets",
"apis": [
{
"path": "/pets",
"operations": [
{
import React, { createContext, useContext, useMemo } from 'react';
import useAsyncFn from 'react-use/lib/useAsyncFn';
import useDebounce from 'react-use/lib/useDebounce';
import { useApi } from '@backstage/core-plugin-api';
import { ErrorResponseBody } from '@backstage/errors';
import { useEntity } from '@backstage/plugin-catalog-react';
import {
ANNOTATION_PROVIDER_ID,
@AndrienkoAleksandr
AndrienkoAleksandr / gist:74110b818d8f67786d42667baab6152b
Created February 13, 2024 13:55
@janus-idp/backstage-plugin-rbac-backend conditions
#!/bin/bash
# RBAC conditions determine which part of the resource content should be visible to the user.
curl -X POST "http://localhost:7007/api/permission/roles" -d '{ "memberReferences": [ "user:default/andrienkoaleksandr" ], "name": "role:default/test" }' -H "Content-Type: application/json" -H "Authorization: Bearer $token" -v
# Let's provide read catalog entity permission
curl -X POST "http://localhost:7007/api/permission/policies" -d '{"entityReference": "role:default/test", "permission": "catalog-entity", "policy": "read", "effect":"allow"}' -H "Content-Type: application/json" -H "Authorization: Bearer $token" -v
# Condition without criteria
{
"Golang errors": {},
"Issues": [
{
"severity": "HIGH",
"confidence": "HIGH",
"cwe": {
"id": "295",
"url": "https://cwe.mitre.org/data/definitions/295.html"
},
@AndrienkoAleksandr
AndrienkoAleksandr / gist:7c3ff756bd0e35860f8b390109b8a6d9
Created April 4, 2023 06:56
openshift-pipelines/tektoncd-results branch downstream-0.5.0-01 gosec scan result
{
"Golang errors": {
"/Users/oandriie/projects/tektoncd-results/tools/tkn-results/cmd/list.go": [
{
"line": 9,
"column": 2,
"error": "could not import github.com/tektoncd/results/tools/tkn-results/internal/flags (invalid package name: \"\")"
},
{
"line": 10,
@AndrienkoAleksandr
AndrienkoAleksandr / gist:7b4c08ccd2fb1710df132049dea46c1a
Last active April 4, 2023 06:55
pipelines-as-code 0.16.0 gosec scan result
{
"Golang errors": {},
"Issues": [
{
"severity": "HIGH",
"confidence": "LOW",
"cwe": {
"id": "798",
"url": "https://cwe.mitre.org/data/definitions/798.html"
},
@AndrienkoAleksandr
AndrienkoAleksandr / gist:5805966dfd13b65393c434de365b4beb
Created March 27, 2023 01:30
"${QUERY_CMD[@]}" | jq '.records[].data.value'
eyJraW5kIjogIlRhc2tSdW4iLCAic3BlYyI6IHsicGFyYW1zIjogW3sibmFtZSI6ICJhIiwgInZhbHVlIjogIjEwMCJ9LCB7Im5hbWUiOiAiYiIsICJ2YWx1ZSI6ICI1MDAifV0sICJ0YXNrUmVmIjogeyJraW5kIjogIlRhc2siLCAibmFtZSI6ICJ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