Skip to content

Commit e9e1e87

Browse files
authored
3.3.1 (develop -> master) (#478)
* Changes to travis config and docs for using develop (#462) * Fixes integration tests in travis to not run on PR's (they will now run on merges into `develop` and `master`) * Change README.rst and CONTRIBUTING.md to reflect the use of `develop` as the primary development branch * use golang 1.12 for building sops * pgp/keysource: Check size of key fingerprint Make sure the key fingerprint is longer than 16 characters before slicing it. Closes #463 * Allow set "json value" to be a string. (#468) * Allow set "json value" to be a string. Adds back support for string values in --set, while retaining support for yaml multidoc that caused this bug. Fixes #461 * Add functional test for --set'ing strings * Vendoring update (#472) It's been around 9 months since our last vendor update. This is also needed for some new features being worked on for sops workspace. Additionally, this PR regenerates the kms mocks. * Remove duplicate sentence from readme (#475) * 3.3.1 bump and release notes (#477)
1 parent 300927c commit e9e1e87

File tree

13,071 files changed

+4100933
-1460111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

13,071 files changed

+4100933
-1460111
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ jobs:
33
build:
44
working_directory: /go/src/go.mozilla.org/sops
55
docker:
6-
- image: circleci/golang:1.8
6+
- image: circleci/golang:1.12
77
steps:
88
- checkout
99
- setup_remote_docker

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
language: go
2-
go: 1.9
2+
go: 1.12
33
go_import_path: go.mozilla.org/sops/
44

55
addons:
@@ -15,8 +15,8 @@ before_install:
1515
- source ~/.cargo/env
1616

1717
script:
18-
- 'if [ "$TRAVIS_REPO_SLUG" != "mozilla/sops" ]; then make; fi'
19-
- 'if [ "$TRAVIS_REPO_SLUG" = "mozilla/sops" ]; then make origin-build; fi'
18+
- 'if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then make; fi'
19+
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then make origin-build; fi'
2020
- bash <(curl -s https://codecov.io/bash)
2121

2222
before_deploy:

CHANGELOG.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
Changelog
22
=========
33

4+
3.3.1
5+
-----
6+
7+
Bug fixes:
8+
9+
* Make sure the pgp key fingerprint is longer than 16 characters before
10+
slicing it. (#463)
11+
* Allow for `--set` value to be a string. (#461)
12+
13+
Project changes:
14+
15+
* Using `develop` as a staging branch to create releases off of. What
16+
is in `master` is now the current stable release.
17+
* Upgrade to using Go 1.12 to build sops
18+
* Updated all vendored packages
19+
420
3.3.0
521
-----
622

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@ Mozilla welcomes contributions from everyone. Here are a few guidelines and inst
44

55
# Getting started
66

7-
* Make sure you have Go 1.6 or greater installed. You can find information on how to install Go [here](https://golang.org/dl/)
7+
* Make sure you have Go 1.12 or greater installed. You can find information on how to install Go [here](https://golang.org/dl/)
88
* After following the [Go installation guide](https://golang.org/doc/install), run `go get go.mozilla.org/sops`. This will automatically clone this repository.
99
* Switch into sops's directory, which will be in `$GOPATH/src/go.mozilla.org/sops`.
1010
* Run the tests with `make test`. They should all pass.
1111
* Fork the project on GitHub.
1212
* Add your fork to git's remotes:
1313
* If you use SSH authentication: `git remote add <your username> [email protected]:<your username>/sops.git`.
1414
* Otherwise: `git remote add <your username> https://github.com/<your username>/sops.git`.
15+
* **Switch to the `develop` branch: `git checkout develop`**
1516
* Make any changes you want to sops, commit them, and push them to your fork.
16-
* Create a pull request, and a contributor will come by and review your code. They may ask for some changes, and hopefully your contribution will be merged to the `master` branch!
17+
* **Create a pull request against `develop`**, and a contributor will come by and review your code. They may ask for some changes, and hopefully your contribution will be merged to the `develop` branch!
1718

1819
# Guidelines
1920

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.11
1+
FROM golang:1.12
22

33
COPY . /go/src/go.mozilla.org/sops
44
WORKDIR /go/src/go.mozilla.org/sops

README.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@ Binaries and packages of the latest stable release are available at `https://git
2424

2525
Development branch
2626
~~~~~~~~~~~~~~~~~~
27-
For the adventurous, unstable features are available in the master branch, which you can install with:
27+
For the adventurous, unstable features are available in the `develop` branch, which you can install from source:
2828

2929
.. code:: bash
3030
3131
$ go get -u go.mozilla.org/sops/cmd/sops
32+
$ cd $GOPATH/src/go.mozilla.org/sops/
33+
$ git checkout develop
34+
$ make install
3235
33-
(requires Go >= 1.8)
36+
(requires Go >= 1.12)
3437

3538
If you don't have Go installed, set it up with:
3639

@@ -215,7 +218,7 @@ And decrypt it using::
215218
$ sops --decrypt test.enc.yaml
216219

217220
Encrypting using Azure Key Vault
218-
~~~~~~~~~~~~~~~~~~~~~~~~
221+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
219222
The Azure Key Vault integration uses service principals to access secrets in
220223
the vault. The following environment variables are used to authenticate:
221224

@@ -414,9 +417,6 @@ to refine the access control of a given KMS master key.
414417
When creating a new file, you can specify encryption context in the
415418
``--encryption-context`` flag by comma separated list of key-value pairs:
416419

417-
When creating a new file, you can specify encryption context in the
418-
``--encryption-context`` flag by comma separated list of key-value pairs:
419-
420420
.. code:: bash
421421
422422
$ sops --encryption-context Environment:production,Role:web-server test.dev.yaml
@@ -852,6 +852,7 @@ formats like ``JSON`` do not. ``sops`` is able to handle both. This means the
852852
following multi-document will be encrypted as expected:
853853
854854
.. code:: yaml
855+
855856
---
856857
data: foo
857858
---

cmd/sops/main.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,14 @@ func jsonValueToTreeInsertableValue(jsonValue string) (interface{}, error) {
864864
return nil, common.NewExitError("Invalid --set value format", codes.ErrorInvalidSetFormat)
865865
}
866866
}
867-
return valueToInsert.(sops.TreeBranches)[0], nil
867+
// Fix for #461
868+
// Attempt conversion to TreeBranches to handle yaml multidoc. If conversion fails it's
869+
// most likely a string value, so just return it as-is.
870+
values, ok := valueToInsert.(sops.TreeBranches)
871+
if !ok {
872+
return valueToInsert, nil
873+
}
874+
return values[0], nil
868875
}
869876

870877
func extractSetArguments(set string) (path []interface{}, valueToInsert interface{}, err error) {

functional-tests/src/lib.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,46 @@ b: ba"#
260260
}
261261
panic!("Output YAML does not have the expected structure");
262262
}
263+
264+
#[test]
265+
fn set_yaml_file_string() {
266+
let file_path = prepare_temp_file("test_set_string.yaml",
267+
r#"a: 2
268+
b: ba"#
269+
.as_bytes());
270+
Command::new(SOPS_BINARY_PATH)
271+
.arg("-e")
272+
.arg("-i")
273+
.arg(file_path.clone())
274+
.output()
275+
.expect("Error running sops");
276+
Command::new(SOPS_BINARY_PATH)
277+
.arg("-e")
278+
.arg("-i")
279+
.arg("--set")
280+
.arg(r#"["a"] "aaa""#)
281+
.arg(file_path.clone())
282+
.output()
283+
.expect("Error running sops");
284+
let output = Command::new(SOPS_BINARY_PATH)
285+
.arg("-d")
286+
.arg("-i")
287+
.arg(file_path.clone())
288+
.output()
289+
.expect("Error running sops");
290+
println!("stdout: {}, stderr: {}",
291+
String::from_utf8_lossy(&output.stdout),
292+
String::from_utf8_lossy(&output.stderr));
293+
let mut s = String::new();
294+
File::open(file_path).unwrap().read_to_string(&mut s).unwrap();
295+
let data: Value = serde_yaml::from_str(&s).expect("Error parsing sops's YAML output");
296+
if let Value::Mapping(data) = data {
297+
let a = data.get(&Value::String("a".to_owned())).unwrap();
298+
assert_eq!(a, &Value::String("aaa".to_owned()));
299+
} else {
300+
panic!("Output JSON does not have the expected structure");
301+
}
302+
}
263303

264304
#[test]
265305
fn decrypt_file_no_mac() {

0 commit comments

Comments
 (0)