Skip to content

Commit 30a8faf

Browse files
committed
Merge branch 'main' into multiple-passphrases-in-one-repo
# By James Murty (18) and others # Via GitHub (1) and James Murty (1) * main: (26 commits) Centralise load and save of password into functions #141 Fix date of 2.2.0 release Ensure tests use "main" as default branch name #143 Use OpenSSL for B64 encoding not `base64` which differs between Linux and Mac #140 Use core attributesFile from worktree (#137) Document `xxd` requirement, and make optional with OpenSSL < 3 (#138) Prepare for 2.2.0 release Fix when using OpenSSL 3 which no longer embeds salt in output (#135) Consolidate all git operation scripts into a single transcrypt script Fix handling of small files and files with null in first 8 bytes (#116) Improve command hint to fix secret files not encrypted in index (#120) (#130) Remove Ubuntu 16.04 LTS from test matrix (#123) Configure default Git branch name for macOS tests in GitHub Handle rename of primary branch from "master" to "main" Ensure Git index is up-to-date before dirty repo check #37 (#109) Fix incorrect salt when partially staged files are commited (#119) Use shorthand for grep options for broader compatibility (#121) Let user set a custom path to openssl #108 Install entire transcrypt script into repository Change version to indicate development "pre-release" status ... # Conflicts: # README.md # tests/_test_helper.bash # tests/test_cleanup.bats # tests/test_crypt.bats # tests/test_init.bats # tests/test_not_inited.bats # transcrypt
2 parents eaf594c + 93f9d4c commit 30a8faf

19 files changed

+955
-704
lines changed

.github/workflows/run-bats-core-tests.yml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: Tests
22

33
on:
4-
# Only run tests on push to master branch
4+
# Only run tests on push to main branch
55
push:
6-
branches: [master]
7-
# Run tests for all pull request changes targeting master
6+
branches: [main]
7+
# Run tests for all pull request changes targeting main
88
pull_request:
9-
branches: [master]
9+
branches: [main]
1010

1111
jobs:
1212

@@ -28,15 +28,25 @@ jobs:
2828
runs-on: ${{ matrix.os }}
2929
strategy:
3030
matrix:
31-
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest]
31+
os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04, macos-latest]
3232

3333
steps:
3434
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3535
- uses: actions/checkout@v2
3636

37+
- name: Print bash version
38+
run: bash --version
39+
3740
- name: Print OpenSSL version
3841
run: openssl version
3942

43+
- name: Print Git version
44+
run: git version
45+
46+
# Configure default Git branch name to suppress hint warnings
47+
- name: Configure default Git branch to "main"
48+
run: git config --global init.defaultBranch main
49+
4050
- name: Install and set up bats-core
4151
run: |
4252
git clone https://github.com/bats-core/bats-core.git /tmp/bats-core-repo

CHANGELOG.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,36 @@ The format is based on [Keep a Changelog][1], and this project adheres to
88
[1]: https://keepachangelog.com/en/1.0.0/
99
[2]: https://semver.org/spec/v2.0.0.html
1010

11-
## [Unreleased]
11+
## [2.2.0] - 2022-07-09
12+
13+
### Added
14+
15+
- Add `--set-openssl-path` option to configure transcrypt to use a specific
16+
openssl version instead of the default version found in `$PATH`. This will be
17+
most useful to macOS users who might want to use a newer version of OpenSSL.
18+
This option can be used on init, on upgrade, or by itself.
19+
- Add support for an optional `transcrypt.crypt-dir` setting for advanced users
20+
to override the path of the _.git/crypt/_ directory to permit things like
21+
installing transcrypt in a repository on a device without execute
22+
permissions (#104)
23+
24+
### Changed
25+
26+
- No longer need stand-alone scripts for git operations `clean`, `smudge`,
27+
`textconv`, and `merge` in the repository's _crypt/_ directory; the single
28+
consolidated `transcrypt` script is stored there instead.
29+
30+
### Fixed
31+
32+
- Remain compatible with OpenSSL versions 3 and above which changes the way
33+
explicit salt values are expressed in ciphertext, requires `xxd` command (#133)
34+
- Ensure Git index is up-to-date before checking for dirty repo, to avoid
35+
failures seen in CI systems where the repo seems dirty when it isn't. (#37)
36+
- Respect Git `core.hooksPath` setting when installing the pre-commit hook. (#104)
37+
- Zsh completion. (#107)
38+
- Fix salt generation for partial (patch) commits (#118)
39+
- Improve command hint to fix secret files not encrypted in index (#120)
40+
- Fix handling of files with null in first 8 bytes (#116)
1241

1342
## [2.1.0] - 2020-09-07
1443

@@ -208,7 +237,8 @@ Since the v0.9.7 release, these are the notable improvements made to transcrypt:
208237

209238
## [0.9.4] - 2014-03-03
210239

211-
[unreleased]: https://github.com/elasticdog/transcrypt/compare/v2.1.0...HEAD
240+
[unreleased]: https://github.com/elasticdog/transcrypt/compare/v2.2.0...HEAD
241+
[2.2.0]: https://github.com/elasticdog/transcrypt/compare/v2.1.0...v2.2.0
212242
[2.1.0]: https://github.com/elasticdog/transcrypt/compare/v2.0.0...v2.1.0
213243
[2.0.0]: https://github.com/elasticdog/transcrypt/compare/v1.1.0...v2.0.0
214244
[1.1.0]: https://github.com/elasticdog/transcrypt/compare/v1.0.3...v1.1.0

INSTALL.md

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1-
Install transcrypt
2-
==================
1+
# Install transcrypt
32

43
The requirements to run transcrypt are minimal:
54

6-
* Bash
7-
* Git
8-
* OpenSSL
5+
- Bash
6+
- Git
7+
- OpenSSL
8+
- `column` command (on Ubuntu/Debian install `bsdmainutils`)
9+
- `xxd` command if using OpenSSL version 3
10+
(on Ubuntu/Debian is included with `vim`)
11+
12+
...and optionally:
13+
14+
- GnuPG - for secure configuration import/export
915

1016
You also need access to the _transcrypt_ script itself...
1117

12-
Manual Installation
13-
-------------------
18+
## Manual Installation
1419

1520
You can add transcrypt directly to your repository, or just put it somewhere in
1621
your $PATH:
@@ -19,8 +24,7 @@ your $PATH:
1924
$ cd transcrypt/
2025
$ sudo ln -s ${PWD}/transcrypt /usr/local/bin/transcrypt
2126

22-
Installation via Packages
23-
-------------------------
27+
## Installation via Packages
2428

2529
A number of packages are available for installing transcrypt directly on your
2630
system via its native package manager. Some of these packages also include man
@@ -29,7 +33,7 @@ page documentation as well as shell auto-completion scripts.
2933
### Arch Linux
3034

3135
If you're on Arch Linux, you can build/install transcrypt using the
32-
[provided PKGBUILD](https://github.com/elasticdog/transcrypt/blob/master/contrib/packaging/pacman/PKGBUILD):
36+
[provided PKGBUILD](https://github.com/elasticdog/transcrypt/blob/main/contrib/packaging/pacman/PKGBUILD):
3337

3438
$ git clone https://github.com/elasticdog/transcrypt.git
3539
$ cd transcrypt/contrib/packaging/pacman/
@@ -50,7 +54,7 @@ If you're on NixOS, you can install transcrypt directly via
5054
$ nix-env -iA nixos.gitAndTools.transcrypt
5155

5256
> _**Note:**
53-
> The [transcrypt derivation](https://github.com/NixOS/nixpkgs/blob/master/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix)
57+
> The [transcrypt derivation](https://github.com/NixOS/nixpkgs/blob/main/pkgs/applications/version-management/git-and-tools/transcrypt/default.nix)
5458
> was added in Oct 2015, so it is not available on the 15.09 channel._
5559
5660
### OS X

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ The requirements to run transcrypt are minimal:
5656
- Git
5757
- OpenSSL
5858
- `column` command (on Ubuntu/Debian install `bsdmainutils`)
59+
- `xxd` command if using OpenSSL version 3
60+
(on Ubuntu/Debian is included with `vim`)
5961

6062
...and optionally:
6163

@@ -184,7 +186,7 @@ re-configure transcrypt with the new credentials.
184186

185187
$ transcrypt --flush-credentials
186188
$ git fetch origin
187-
$ git merge origin/master
189+
$ git merge origin/main
188190
$ transcrypt -c aes-256-cbc -p 'the-new-password'
189191

190192
### Command Line Options
@@ -202,6 +204,9 @@ directory.
202204
the password to derive the key from;
203205
defaults to 30 random base64 characters
204206

207+
--set-openssl-path=PATH_TO_OPENSSL
208+
use OpenSSL at this path; defaults to 'openssl' in $PATH
209+
205210
-y, --yes
206211
assume yes and accept defaults for non-specified options
207212

@@ -322,21 +327,8 @@ Please use:
322327
Tests are written using [bats-core](https://github.com/bats-core/bats-core)
323328
version of "Bash Automated Testing System" and stored in the _tests/_ directory.
324329

325-
To run the tests locally:
330+
To run the tests:
326331

327332
- [install bats-core](https://github.com/bats-core/bats-core#installation)
328333
- run all tests with: `bats tests/`
329-
- run an individual test with e.g: `./tests/test_help.bats`
330-
331-
To run the tests in Docker:
332-
333-
- install Docker
334-
- `cd tests/`
335-
- check available test targets (Docker services): `docker-compose ps`
336-
- build images for all test targets: `docker-compose build`
337-
- or for a specific test target: `docker-compose build ubuntu-20.04`
338-
- run tests on all targets (non-zero exit codes means fail): `docker-compose up`
339-
- or run tests on a specific target: `docker-compose run --rm ubuntu-20.04`
340-
- to manually run and debug tests:
341-
- run shell in a specfic target: `docker-compose run --rm ubuntu-20.04`
342-
- run tests selectively with something like: `bats tests/test_init.bats -t`
334+
- run an individual test with e.g: `bats tests/test_crypt.bats`

contrib/bash/transcrypt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ _transcrypt() {
2222
cur="${COMP_WORDS[COMP_CWORD]}"
2323
prev="${COMP_WORDS[COMP_CWORD-1]}"
2424
opts="-c -p -y -d -r -f -F -u -l -s -e -i -v -h \
25-
--cipher --password --yes --display --rekey --flush-credentials --force --uninstall --upgrade --list --show-raw --export-gpg --import-gpg --version --help"
25+
--cipher --password --set-openssl-path --yes --display --rekey --flush-credentials --force --uninstall --upgrade --list --show-raw --export-gpg --import-gpg --version --help"
2626

2727
case "${prev}" in
2828
-c | --cipher)

contrib/packaging/pacman/PKGBUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Maintainer: Aaron Bull Schaefer <[email protected]>
22
pkgname=transcrypt
3-
pkgver=2.1.0
3+
pkgver=2.2.0
44
pkgrel=1
55
pkgdesc='A script to configure transparent encryption of files within a Git repository'
66
arch=('any')

contrib/zsh/_transcrypt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ _transcrypt() {
1818
'(-f --flush-credentials -c --cipher -p --password -r --rekey -u --uninstall)'{-f,--flush-credentials}'[flush cached credentials]' \
1919
'(-F --force -d --display -u --uninstall)'{-F,--force}'[ignore repository clean state]' \
2020
'(-u --uninstall -c --cipher -d --display -f --flush-credentials -p --password -r --rekey)'{-u,--uninstall}'[uninstall transcrypt]' \
21-
'(--upgrade -c --cipher -d --display -f --flush-credentials -p --password -r --rekey)'{--upgrade}'[upgrade transcrypt]' \
21+
'(--set-openssl-path -c --cipher -d --display -f --flush-credentials -p --password -r --rekey)'{--set-openssl-path}'[use OpenSSL at this path]' \
22+
'(--upgrade -c --cipher -d --display -f --flush-credentials -p --password -r --rekey)--upgrade[upgrade transcrypt]' \
2223
'(-i --import-gpg -c --cipher -p --password -d --display -f --flush-credentials -u --uninstall)'{-i,--import-gpg=}'[import config from gpg file]:file:->file' \
2324
&& return 0
2425

man/transcrypt.1.ronn

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ The transcrypt source code and full documentation may be downloaded from
2525
the password to derive the key from;
2626
defaults to 30 random base64 characters
2727

28+
* `--set-openssl-path`=<path_to_openssl>:
29+
use OpenSSL at this path; defaults to 'openssl' in $PATH
30+
2831
* `-y`, `--yes`:
2932
assume yes and accept defaults for non-specified options
3033

tests/Dockerfile.ubuntu

Lines changed: 0 additions & 21 deletions
This file was deleted.

tests/_test_helper.bash

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
function init_git_repo {
22
# Warn and do nothing if test dir envvar is unset
3-
if [[ -z "$BATS_TMPDIR" ]]; then
4-
echo "WARNING: Required envvar \$BATS_TMPDIR is unset"
3+
if [[ -z "$BATS_TEST_DIRNAME" ]]; then
4+
echo "WARNING: Required envvar \$BATS_TEST_DIRNAME is unset"
55
# Warn and do nothing if test git repo path already exists
6-
elif [[ -e "$BATS_TMPDIR/.git" ]]; then
7-
echo "WARNING: Test repo already exists at $BATS_TMPDIR/.git"
6+
elif [[ -e "$BATS_TEST_DIRNAME/.git" ]]; then
7+
echo "WARNING: Test repo already exists at $BATS_TEST_DIRNAME/.git"
88
else
99
# Initialise test git repo at the same path as the test files
10-
git init "$BATS_TMPDIR"
10+
git init "$BATS_TEST_DIRNAME"
11+
git checkout -b main
1112
# Tests will fail if name and email aren't set
1213
git config user.name "John Doe"
1314
git config user.email [email protected]
1415
# Flag test git repo as 100% the test one, for safety before later removal
15-
touch "$BATS_TMPDIR"/.git/repo-for-transcrypt-bats-tests
16+
touch "$BATS_TEST_DIRNAME"/.git/repo-for-transcrypt-bats-tests
1617
fi
1718
}
1819

1920
function nuke_git_repo {
2021
# Warn and do nothing if test dir envvar is unset
21-
if [[ -z "$BATS_TMPDIR" ]]; then
22-
echo "WARNING: Required envvar \$BATS_TMPDIR is unset"
22+
if [[ -z "$BATS_TEST_DIRNAME" ]]; then
23+
echo "WARNING: Required envvar \$BATS_TEST_DIRNAME is unset"
2324
# Warn and do nothing if the test git repo is missing the flag file that
2425
# ensures it *really* is the test one, as set by the 'init_git_repo' function
25-
elif [[ ! -e "$BATS_TMPDIR/.git/repo-for-transcrypt-bats-tests" ]]; then
26-
echo "WARNING: Aborting delete of non-test Git repo at $BATS_TMPDIR/.git"
26+
elif [[ ! -e "$BATS_TEST_DIRNAME/.git/repo-for-transcrypt-bats-tests" ]]; then
27+
echo "WARNING: Aborting delete of non-test Git repo at $BATS_TEST_DIRNAME/.git"
2728
else
2829
# Forcibly delete the test git repo
29-
rm -fR "$BATS_TMPDIR"/.git
30+
rm -fR "$BATS_TEST_DIRNAME"/.git
3031
fi
3132
}
3233

3334
function cleanup_all {
3435
nuke_git_repo
35-
rm -f "$BATS_TMPDIR"/.gitattributes
36-
rm -f "$BATS_TMPDIR"/sensitive_file
36+
rm -f "$BATS_TEST_DIRNAME"/.gitattributes
37+
rm -f "$BATS_TEST_DIRNAME"/sensitive_file
3738
}
3839

3940
function init_transcrypt {
40-
"$BATS_TEST_DIRNAME"/../transcrypt --cipher=aes-256-cbc --password=abc123 --yes
41+
"$BATS_TEST_DIRNAME"/../transcrypt --cipher=aes-256-cbc --password='abc 123' --yes
4142
}
4243

4344
function encrypt_named_file {
@@ -57,7 +58,7 @@ function encrypt_named_file {
5758
}
5859

5960
function setup {
60-
pushd "$BATS_TMPDIR" || exit 1
61+
pushd "$BATS_TEST_DIRNAME" || exit 1
6162
init_git_repo
6263
if [[ ! "$SETUP_SKIP_INIT_TRANSCRYPT" ]]; then
6364
init_transcrypt

tests/docker-compose.yml

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)