Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: restrict broker paths and improve style #33

Merged
merged 2 commits into from
Aug 2, 2023
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
17 changes: 4 additions & 13 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
{
"env": {
"es6": true,
"node": true
"node": true,
"jest": true
},
"extends": [
"google",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking"
"plugin:prettier/recommended"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"overrides": [
{
"extends": ["plugin:jest/recommended"],
Expand All @@ -26,16 +21,12 @@
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"project": "./tsconfig.eslint.json"
},
"plugins": [
"@typescript-eslint"
"@typescript-eslint/eslint-plugin"
],
"rules": {
"max-len": ["error", 120],
"valid-jsdoc": 0,
"indent": ["error", 2]
}
}
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": true,
"trailingComma": "all"
}
15 changes: 10 additions & 5 deletions e2e/approle.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
import {vault} from './vault';
import { vault } from './vault';
import nv from 'node-vault';

/* eslint @typescript-eslint/no-unsafe-assignment: "off", jest/no-disabled-tests: "off" */
describe.skip('Vault', () => {
let appVault: nv.client;

beforeAll(async () => {
const roleResult = await vault.getApproleRoleId({role_name: 'foo-bob'});
const secretResult = await vault.getApproleRoleSecret({role_name: 'foo-bob'});
const roleResult = await vault.getApproleRoleId({ role_name: 'foo-bob' });
const secretResult = await vault.getApproleRoleSecret({
role_name: 'foo-bob',
});
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- No typing avialable
const roleId = roleResult.data.role_id;
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- No typing avialable
const secretId = secretResult.data.secret_id;
const login = await vault.approleLogin({role_id: roleId, secret_id: secretId});
const login = await vault.approleLogin({
role_id: roleId,
secret_id: secretId,
});
// console.log(login);

appVault = nv({
Expand All @@ -31,7 +36,7 @@ describe.skip('Vault', () => {

test('Expect error writing new secret', async () => {
await expect(async () => {
await appVault.write('secret/data/foo/bob', {test: 'true'});
await appVault.write('secret/data/foo/bob', { test: 'true' });
}).rejects.toThrow();
});
});
2 changes: 1 addition & 1 deletion e2e/health.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {exec} from 'child_process';
import { exec } from 'child_process';

describe('Vault', () => {
test('Health command gets vault info', async () => {
Expand Down
2 changes: 1 addition & 1 deletion e2e/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ import nv from 'node-vault';
* @param key The unseal key
*/
export async function unseal(vault: nv.client, key: string): Promise<void> {
await vault.unseal({key});
await vault.unseal({ key });
}
1 change: 0 additions & 1 deletion e2e/vault.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import nv from 'node-vault';

export const vault = nv({
Expand Down
Loading