Repository navigation
fix/update api - #2
Merged
Merged
Conversation
other minor changes and improvements
derevnjuk
added a commit
that referenced
this pull request
Jul 26, 2019
…g api changes (#2) * audit and fix vulnerabilities * fix config loading * Commands: improve logs * bump version * other minor changes and improvements
aborovsky
added a commit
that referenced
this pull request
Nov 9, 2026
…rovider options (#816) ## What Configuration for PKCS#11 (smart card / token) client certificates on `bright-cli repeater`, for HTTPS targets. This PR only parses, validates and registers the options; the TLS integration comes in a follow-up PR. **`--pkcs11-cert <json>`** (repeatable). Also accepted: - `REPEATER_PKCS11_CERT`: one JSON object, or a JSON array of them; - `pkcs11Cert` in `.brightrc*`: an object, or an array of objects. | Field | Required | Default | |---|---|---| | `hostname` | yes | – | | `module` | yes, unless `--pkcs11-module` is set | `--pkcs11-module` | | `pinFile` or `pinEnv` | exactly one | – | | `port`, `token`, `object`, `id` (hex `CKA_ID`) | no | – | | `cert` | no | `"token"` (or a PEM file path) | | `maxConcurrency` | no | `1` | **`--pkcs11-module <path>`** is the default vendor library for entries without `module`. **`--pkcs11-provider <path>`** overrides the OpenSSL provider plugin location. ## Validation All of it runs before the repeater starts, and each error names the entry, e.g. `Option --pkcs11-cert #2 (hostname "b.example.com"): specify "module" …`. - Missing hostname, module or PIN source, or two PIN sources. - A literal `pin`, which would land in argv, `ps` and the daemon service definition. - Unknown or misspelled fields. - `pinEnv`: - must be a variable name; the value is never echoed, in case someone types the PIN there; - must not start with `REPEATER_`, because yargs reads those names as options; - must be set. - `module`, `pinFile`, `cert`, `--pkcs11-module` and `--pkcs11-provider` must be existing files. `pinFile` must also be readable. All paths are resolved to absolute ones. - An invalid `port`, `id` or `maxConcurrency`. - `--daemon` rejects `pinEnv`, because the service doesn't inherit the shell environment. `--remove-daemon` skips the checks. ## Also fixed `--cert` entries from the config file arrive as objects, or as a single object, and used to crash in `JSON.parse`. Both options now accept strings, objects and arrays. ## Checks - `lint`, `format`, `build` and `test:unit` (29 suites, 402 tests) pass. `tsc` reports no new errors. - New specs: - `Pkcs11CertParser.spec.ts`: `parse` and `resolveFile`; - `RunRepeater.spec.ts`: registration, defaults, provider, the real `pinEnv`, `REPEATER_PKCS11_CERT` arrays, config-file objects and arrays, `--cert` on the command line, daemon install and remove, and rejection. - Manual: `repeater --help` lists the options, and an invalid entry exits with code 1 and the entry-specific message, the same way the existing `--id` validation fails. - An automated review (`semantic_reviewer`) of the first revision found 12 issues; all are addressed in the second commit.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.