Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 7 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ updates:
schedule:
interval: daily
labels:
- "dependencies"
- "e2e"
- "github_actions"
- 'dependencies'
- 'e2e'
- 'github_actions'

- package-ecosystem: npm
directory: /
Expand All @@ -19,8 +19,8 @@ updates:
groups:
typescript-eslint:
patterns:
- "@typescript-eslint/*"
- '@typescript-eslint/*'
labels:
- "dependencies"
- "e2e"
- "javascript"
- 'dependencies'
- 'e2e'
- 'javascript'
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

<!--
Describe your changes briefly here.
-->
-->
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ jobs:

- name: Install Stackrox
env:
MAIN_IMAGE_TAG: "latest"
SENSOR_HELM_DEPLOY: "true"
ROX_SCANNER_V4: "false"
MAIN_IMAGE_TAG: 'latest'
SENSOR_HELM_DEPLOY: 'true'
ROX_SCANNER_V4: 'false'
run: |
stackrox/deploy/k8s/deploy-local.sh
ROX_PASSWORD=$(cat stackrox/deploy/k8s/central-deploy/password)
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
run: |
npm install

- name: Format
run: |
npm run format-check

- name: Lint
run: |
npm run lint
npm run lint
2 changes: 1 addition & 1 deletion .github/workflows/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
contents: write
env:
# Output logs to file in case we need to inspect errors.
GITSIGN_LOG: "/tmp/gitsign.log"
GITSIGN_LOG: '/tmp/gitsign.log'
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
59 changes: 30 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ other actions to use.
This is as simple as adding the following step to your workflow:

```yaml
- name: Central Login
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443
- name: Central Login
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443
```

## Parameters

| Parameter name | Required? | Description |
|-------------------|----------------|----------------------------------------------------------------------|
| Parameter name | Required? | Description |
| ----------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `audience` | (optional) | Custom audience for the GitHub OIDC identity token request. Must match the expected audience configured in the Central machine-to-machine authentication integration. When left empty, the default GitHub audience is used. |
| `endpoint` | **(required)** | API endpoint of the ACS Central instance. |
| `skip-tls-verify` | (optional) | Skip TLS certificat verification for ACS Central's API endpoint. |
| `endpoint` | **(required)** | API endpoint of the ACS Central instance. |
| `skip-tls-verify` | (optional) | Skip TLS certificat verification for ACS Central's API endpoint. |

## Overview

Expand All @@ -52,6 +52,7 @@ originating from GitHub Action workflow runs.
For more information on how to configure this, follow the [RHACS documentation](https://docs.openshift.com/acs/4.4/operating/manage-user-access/configure-short-lived-access.html).

Below is a sample configuration via API you can use:

```bash
curl \
https://<central-endpoint>/v1/auth/m2m \
Expand Down Expand Up @@ -87,11 +88,11 @@ After the ACS Central instance has been configured to allow exchanging tokens fr
add the following step to your workflow:

```yaml
- name: Central Login
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443
- name: Central Login
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443
```

After the central login step has succeeded, the following environment variables are configured for other steps to use:
Expand All @@ -102,21 +103,21 @@ After the central login step has succeeded, the following environment variables
For verifying everything works correctly, the example below can be used:

```yaml
- name: Login to Central
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443

- name: Install roxctl from Central
uses: stackrox/roxctl-installer-action@v1
with:
central-endpoint: https://${{ env.ROX_ENDPOINT }}
central-token: ${{ env.ROX_API_TOKEN }}

- name: roxctl central whoami
run: |
roxctl central whoami
- name: Login to Central
uses: stackrox/central-login@v1
with:
audience: central.stackrox.io
endpoint: https://<central-endpoint>:443

- name: Install roxctl from Central
uses: stackrox/roxctl-installer-action@v1
with:
central-endpoint: https://${{ env.ROX_ENDPOINT }}
central-token: ${{ env.ROX_API_TOKEN }}

- name: roxctl central whoami
run: |
roxctl central whoami
```

This will output the specifics about the access token (i.e. it's associated permissions and roles) as well as the
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ inputs:
required: true
description: 'Central API endpoint in the format of https://<host>:<port>'
skip-tls-verify:
default: "false"
default: 'false'
required: false
description: "Skip TLS certificate verification for Central's API Endpoint"
runs:
Expand Down
152 changes: 77 additions & 75 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,88 +1,90 @@
import jest from "eslint-plugin-jest";
import stylistic from "@stylistic/eslint-plugin";
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import jest from 'eslint-plugin-jest'
import stylistic from '@stylistic/eslint-plugin'
import typescriptEslint from '@typescript-eslint/eslint-plugin'
import globals from 'globals'
import tsParser from '@typescript-eslint/parser'

export default [
{
ignores: [
"dist/",
"lib/",
"node_modules/",
],
{
ignores: ['dist/', 'lib/', 'node_modules/']
},
{
plugins: {
jest,
'@stylistic': stylistic,
'@typescript-eslint': typescriptEslint
},
{
plugins: {
jest,
"@stylistic": stylistic,
"@typescript-eslint": typescriptEslint,
},

languageOptions: {
globals: {
...globals.node,
...jest.environments.globals.globals,
},
languageOptions: {
globals: {
...globals.node,
...jest.environments.globals.globals
},

parser: tsParser,
ecmaVersion: 9,
sourceType: "module",
parser: tsParser,
ecmaVersion: 9,
sourceType: 'module',

parserOptions: {
project: "./tsconfig.json",
},
},
parserOptions: {
project: './tsconfig.json'
}
},

files: [ "**/*.ts" ],
files: ['**/*.ts'],

rules: {
"i18n-text/no-en": "off",
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
rules: {
'i18n-text/no-en': 'off',
'eslint-comments/no-use': 'off',
'import/no-namespace': 'off',
'no-unused-vars': 'off',
'@typescript-eslint/no-unused-vars': 'error',

"@typescript-eslint/explicit-member-accessibility": ["error", {
accessibility: "no-public",
}],
'@typescript-eslint/explicit-member-accessibility': [
'error',
{
accessibility: 'no-public'
}
],

"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
camelcase: "off",
"@typescript-eslint/consistent-type-assertions": "error",
'@typescript-eslint/no-require-imports': 'error',
'@typescript-eslint/array-type': 'error',
'@typescript-eslint/await-thenable': 'error',
'@typescript-eslint/ban-ts-comment': 'error',
camelcase: 'off',
'@typescript-eslint/consistent-type-assertions': 'error',

"@typescript-eslint/explicit-function-return-type": ["error", {
allowExpressions: true,
}],
'@typescript-eslint/explicit-function-return-type': [
'error',
{
allowExpressions: true
}
],

"@stylistic/function-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
semi: "off",
"@stylistic/semi": ["error", "never"],
"@stylistic/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error",
},
'@stylistic/function-call-spacing': ['error', 'never'],
'@typescript-eslint/no-array-constructor': 'error',
'@typescript-eslint/no-empty-interface': 'error',
'@typescript-eslint/no-explicit-any': 'error',
'@typescript-eslint/no-extraneous-class': 'error',
'@typescript-eslint/no-for-in-array': 'error',
'@typescript-eslint/no-inferrable-types': 'error',
'@typescript-eslint/no-misused-new': 'error',
'@typescript-eslint/no-namespace': 'error',
'@typescript-eslint/no-non-null-assertion': 'warn',
'@typescript-eslint/no-unnecessary-qualifier': 'error',
'@typescript-eslint/no-unnecessary-type-assertion': 'error',
'@typescript-eslint/no-useless-constructor': 'error',
'@typescript-eslint/no-var-requires': 'error',
'@typescript-eslint/prefer-for-of': 'warn',
'@typescript-eslint/prefer-function-type': 'warn',
'@typescript-eslint/prefer-includes': 'error',
'@typescript-eslint/prefer-string-starts-ends-with': 'error',
'@typescript-eslint/promise-function-async': 'error',
'@typescript-eslint/require-array-sort-compare': 'error',
'@typescript-eslint/restrict-plus-operands': 'error',
semi: 'off',
'@stylistic/semi': ['error', 'never'],
'@stylistic/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
}
];
}
]
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"main": "src/main.ts",
"scripts": {
"build": "tsc",
"format": "prettier --write '**/*.ts'",
"format-check": "prettier --check '**/*.ts'",
"format": "prettier --write '**/*.ts' '**/*.yml'",
"format-check": "prettier --check '**/*.ts' '**/*.yml'",
"lint": "eslint src/**/*.ts --fix",
"package": "esbuild src/main.ts --bundle --platform=node --target=node20 --outfile=dist/index.js --sourcemap",
"all": "npm run build && npm run format && npm run lint && npm run package"
Expand Down
Loading
Loading