From f5c85a5e9050fc3e20b815527ed0e81df482957f Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Tue, 15 Nov 2022 08:43:23 +0100 Subject: [PATCH 01/11] updated golang to 1.19 and all other deps --- Makefile | 38 +++++++++++++++++++++++++++++++------- go.mod | 16 ++++++++-------- go.sum | 28 ++++++++++++++-------------- 3 files changed, 53 insertions(+), 29 deletions(-) diff --git a/Makefile b/Makefile index 50ca2e9..9b9bb17 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,14 @@ COVERAGE_FILE := coverage.out REPOSITORY := mvisonneau/$(NAME) .DEFAULT_GOAL := help +.PHONY: setup +setup: ## Install required libraries/tools for build tasks + @command -v gofumpt 2>&1 >/dev/null || go install mvdan.cc/gofumpt@v0.2.1 + @command -v gosec 2>&1 >/dev/null || go install github.com/securego/gosec/v2/cmd/gosec@v2.9.6 + @command -v ineffassign 2>&1 >/dev/null || go install github.com/gordonklaus/ineffassign@v0.0.0-20210914165742-4cc7213b9bc8 + @command -v misspell 2>&1 >/dev/null || go install github.com/client9/misspell/cmd/misspell@v0.3.4 + @command -v revive 2>&1 >/dev/null || go install github.com/mgechev/revive@v1.1.3 + .PHONY: fmt fmt: ## Format source code go run mvdan.cc/gofumpt@v0.6.0 -w $(shell git ls-files **/*.go) @@ -14,13 +22,7 @@ lint: ## Run all lint related tests upon the codebase .PHONY: test test: ## Run the tests against the codebase - @rm -rf $(COVERAGE_FILE) - go test -v -count=1 -race ./... -coverprofile=$(COVERAGE_FILE) - @go tool cover -func $(COVERAGE_FILE) | awk '/^total/ {print "coverage: " $$3}' - -.PHONY: coverage -coverage: ## Prints coverage report - go tool cover -func $(COVERAGE_FILE) + go test -v -count=1 -race ./... .PHONY: install install: ## Build and install locally the binary (dev purpose) @@ -47,6 +49,28 @@ prerelease: ## Build & prerelease the binaries (edge) clean: ## Remove binary if it exists rm -f $(NAME) +.PHONY: coverage +coverage: ## Generates coverage report + rm -rf *.out + go test -count=1 -race -v ./... -coverpkg=./... -coverprofile=coverage.out + +.PHONY: coverage-html +coverage-html: ## Generates coverage report and displays it in the browser + go tool cover -html=coverage.out + +.PHONY: dev-env +dev-env: ## Build a local development environment using Docker + @docker run -it --rm \ + -v $(shell pwd):/go/src/github.com/mvisonneau/$(NAME) \ + -w /go/src/github.com/mvisonneau/$(NAME) \ + golang:1.17 \ + /bin/bash -c 'make setup; make install; bash' + +.PHONY: is-git-dirty +is-git-dirty: ## Tests if git is in a dirty state + @git status --porcelain + @test $(shell git status --porcelain | grep -c .) -eq 0 + .PHONY: all all: lint test build coverage ## Test, builds and ship package for all supported platforms diff --git a/go.mod b/go.mod index 2533958..e9c5208 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/mvisonneau/vac -go 1.23 +go 1.23.0 require ( github.com/gofrs/flock v0.12.1 github.com/hashicorp/go-secure-stdlib/mlock v0.1.3 - github.com/hashicorp/vault/api v1.16.0 + github.com/hashicorp/vault/api v1.20.0 github.com/ktr0731/go-fuzzyfinder v0.8.0 github.com/mitchellh/go-homedir v1.1.0 github.com/mvisonneau/go-helpers v0.0.1 @@ -34,7 +34,7 @@ require ( github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.6 // indirect - github.com/hashicorp/hcl v1.0.1-vault-5 // indirect + github.com/hashicorp/hcl v1.0.1-vault-7 // indirect github.com/kr/text v0.2.0 // indirect github.com/ktr0731/go-ansisgr v0.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -47,11 +47,11 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/crypto v0.32.0 // indirect - golang.org/x/net v0.34.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/term v0.30.0 // indirect + golang.org/x/text v0.23.0 // indirect golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5f1258b..0bc80c3 100644 --- a/go.sum +++ b/go.sum @@ -46,10 +46,10 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= -github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= -github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/vault/api v1.16.0 h1:nbEYGJiAPGzT9U4oWgaaB0g+Rj8E59QuHKyA5LhwQN4= -github.com/hashicorp/vault/api v1.16.0/go.mod h1:KhuUhzOD8lDSk29AtzNjgAu2kxRA9jL9NAbkFlqvkBA= +github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= +github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= +github.com/hashicorp/vault/api v1.20.0 h1:KQMHElgudOsr+IbJgmbjHnCTxEpKs9LnozA1D3nozU4= +github.com/hashicorp/vault/api v1.20.0/go.mod h1:GZ4pcjfzoOWpkJ3ijHNpEoAxKEsBJnVljyTe3jM2Sms= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -114,16 +114,16 @@ github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBi github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -137,21 +137,21 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 3b20077a6e4df00d16654499a4e98ab7021abd63 Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Tue, 15 Nov 2022 08:44:51 +0100 Subject: [PATCH 02/11] Upgraded base docker images From 12acc66d58f9183e2b95a67cc5cbae91e328fc39 Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Tue, 15 Nov 2022 08:46:21 +0100 Subject: [PATCH 03/11] go.mod: upgrade & tidy --- go.mod | 16 ++++++++-------- go.sum | 28 ++++++++++++++-------------- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/go.mod b/go.mod index e9c5208..2533958 100644 --- a/go.mod +++ b/go.mod @@ -1,11 +1,11 @@ module github.com/mvisonneau/vac -go 1.23.0 +go 1.23 require ( github.com/gofrs/flock v0.12.1 github.com/hashicorp/go-secure-stdlib/mlock v0.1.3 - github.com/hashicorp/vault/api v1.20.0 + github.com/hashicorp/vault/api v1.16.0 github.com/ktr0731/go-fuzzyfinder v0.8.0 github.com/mitchellh/go-homedir v1.1.0 github.com/mvisonneau/go-helpers v0.0.1 @@ -34,7 +34,7 @@ require ( github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.6 // indirect - github.com/hashicorp/hcl v1.0.1-vault-7 // indirect + github.com/hashicorp/hcl v1.0.1-vault-5 // indirect github.com/kr/text v0.2.0 // indirect github.com/ktr0731/go-ansisgr v0.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -47,11 +47,11 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/crypto v0.36.0 // indirect - golang.org/x/net v0.37.0 // indirect - golang.org/x/sys v0.31.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/term v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 0bc80c3..5f1258b 100644 --- a/go.sum +++ b/go.sum @@ -46,10 +46,10 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= -github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= -github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/vault/api v1.20.0 h1:KQMHElgudOsr+IbJgmbjHnCTxEpKs9LnozA1D3nozU4= -github.com/hashicorp/vault/api v1.20.0/go.mod h1:GZ4pcjfzoOWpkJ3ijHNpEoAxKEsBJnVljyTe3jM2Sms= +github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= +github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= +github.com/hashicorp/vault/api v1.16.0 h1:nbEYGJiAPGzT9U4oWgaaB0g+Rj8E59QuHKyA5LhwQN4= +github.com/hashicorp/vault/api v1.16.0/go.mod h1:KhuUhzOD8lDSk29AtzNjgAu2kxRA9jL9NAbkFlqvkBA= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -114,16 +114,16 @@ github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBi github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -137,21 +137,21 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= -golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= +golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From ffd9e8795e4a03e21c52456dfc894a976a068ad7 Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Tue, 15 Nov 2022 08:48:02 +0100 Subject: [PATCH 04/11] Released v0.0.8 From 2b642c4b144c9b90729c009c80dafd56e279e0fc Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Thu, 23 Feb 2023 19:29:18 +0100 Subject: [PATCH 05/11] go: bumped to v1.20 & upgraded all deps --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9b9bb17..849589f 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,13 @@ lint: ## Run all lint related tests upon the codebase .PHONY: test test: ## Run the tests against the codebase - go test -v -count=1 -race ./... + @rm -rf $(COVERAGE_FILE) + go test -v -count=1 -race ./... -coverprofile=$(COVERAGE_FILE) + @go tool cover -func $(COVERAGE_FILE) | awk '/^total/ {print "coverage: " $$3}' + +.PHONY: coverage +coverage: ## Prints coverage report + go tool cover -func $(COVERAGE_FILE) .PHONY: install install: ## Build and install locally the binary (dev purpose) From 38260c50ac1fe677d23a8ff8df5f8f4f29a495a9 Mon Sep 17 00:00:00 2001 From: Maxime VISONNEAU Date: Thu, 23 Feb 2023 19:32:27 +0100 Subject: [PATCH 06/11] github-actions: fixed go version --- .idea/workspace.xml | 51 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..93b975b --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + true + + \ No newline at end of file From f159c8cea1484b31020d6bada2bd281ca2eebef9 Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Mon, 10 Apr 2023 12:37:56 +0700 Subject: [PATCH 07/11] Added support for authentication methods --- .github/workflows/test.yml | 2 +- CHANGELOG.md | 3 +-- Makefile | 40 +++++++++++++++++------------ README.md | 3 +++ go.mod | 21 +++++++-------- go.sum | 38 ++++++++++++++------------- internal/cli/cli.go | 2 ++ internal/cli/flags/flags.go | 13 ++++++++++ internal/cmd/get.go | 5 ++++ internal/cmd/status.go | 5 ++++ internal/cmd/switch.go | 5 ++++ internal/cmd/utils.go | 8 ++++++ pkg/client/vault.go | 51 +++++++++++++++++++++++++++---------- 13 files changed, 136 insertions(+), 60 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bbef688..9025893 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,7 +32,7 @@ jobs: go-version: '1.22' - name: Lint - if: ${{ matrix.os == 'ubuntu-22.04' }} + if: ${{ matrix.os == 'ubuntu-20.04' }} run: make lint - name: Test diff --git a/CHANGELOG.md b/CHANGELOG.md index ecc02c8..307ff3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,8 +103,7 @@ and this project adheres to [0ver](https://0ver.org) (more or less). - LICENSE - README -[Unreleased]: https://github.com/mvisonneau/vac/compare/v0.0.8...HEAD -[v0.0.8]: https://github.com/mvisonneau/vac/tree/v0.0.8 +[Unreleased]: https://github.com/mvisonneau/vac/compare/v0.0.7...HEAD [v0.0.7]: https://github.com/mvisonneau/vac/tree/v0.0.7 [v0.0.6]: https://github.com/mvisonneau/vac/tree/v0.0.6 [v0.0.5]: https://github.com/mvisonneau/vac/tree/v0.0.5 diff --git a/Makefile b/Makefile index 849589f..65bce67 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,8 @@ NAME := vac -COVERAGE_FILE := coverage.out +FILES := $(shell git ls-files */*.go) REPOSITORY := mvisonneau/$(NAME) .DEFAULT_GOAL := help -.PHONY: setup -setup: ## Install required libraries/tools for build tasks - @command -v gofumpt 2>&1 >/dev/null || go install mvdan.cc/gofumpt@v0.2.1 - @command -v gosec 2>&1 >/dev/null || go install github.com/securego/gosec/v2/cmd/gosec@v2.9.6 - @command -v ineffassign 2>&1 >/dev/null || go install github.com/gordonklaus/ineffassign@v0.0.0-20210914165742-4cc7213b9bc8 - @command -v misspell 2>&1 >/dev/null || go install github.com/client9/misspell/cmd/misspell@v0.3.4 - @command -v revive 2>&1 >/dev/null || go install github.com/mgechev/revive@v1.1.3 - .PHONY: fmt fmt: ## Format source code go run mvdan.cc/gofumpt@v0.6.0 -w $(shell git ls-files **/*.go) @@ -22,13 +14,7 @@ lint: ## Run all lint related tests upon the codebase .PHONY: test test: ## Run the tests against the codebase - @rm -rf $(COVERAGE_FILE) - go test -v -count=1 -race ./... -coverprofile=$(COVERAGE_FILE) - @go tool cover -func $(COVERAGE_FILE) | awk '/^total/ {print "coverage: " $$3}' - -.PHONY: coverage -coverage: ## Prints coverage report - go tool cover -func $(COVERAGE_FILE) + go test -v -count=1 -race ./... .PHONY: install install: ## Build and install locally the binary (dev purpose) @@ -77,6 +63,28 @@ is-git-dirty: ## Tests if git is in a dirty state @git status --porcelain @test $(shell git status --porcelain | grep -c .) -eq 0 +.PHONY: coverage +coverage: ## Generates coverage report + rm -rf *.out + go test -count=1 -race -v ./... -coverpkg=./... -coverprofile=coverage.out + +.PHONY: coverage-html +coverage-html: ## Generates coverage report and displays it in the browser + go tool cover -html=coverage.out + +.PHONY: dev-env +dev-env: ## Build a local development environment using Docker + @docker run -it --rm \ + -v $(shell pwd):/go/src/github.com/mvisonneau/$(NAME) \ + -w /go/src/github.com/mvisonneau/$(NAME) \ + golang:1.17 \ + /bin/bash -c 'make setup; make install; bash' + +.PHONY: is-git-dirty +is-git-dirty: ## Tests if git is in a dirty state + @git status --porcelain + @test $(shell git status --porcelain | grep -c .) -eq 0 + .PHONY: all all: lint test build coverage ## Test, builds and ship package for all supported platforms diff --git a/README.md b/README.md index c414184..d3349f0 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ Checksums are signed with the [following GPG key](https://keybase.io/mvisonneau/ ```bash ~$ go install github.com/mvisonneau/vac/cmd/vac@latest +~$ sudo setcap cap_ipc_lock=ep ${GOPATH:-~/go}/bin/vac ``` ### Homebrew @@ -127,6 +128,8 @@ GLOBAL OPTIONS: --state path, -s path state path (default: "~/.vac_state") [$VAC_STATE_PATH] --log-level level log level (debug,info,warn,fatal,panic) (default: "info") [$VAC_LOG_LEVEL] --log-format format log format (json,text) (default: "text") [$VAC_LOG_FORMAT] + --auth value auth method (token, kubernetes) (default: "token") [$VAC_AUTH] + --auth-k8s-role value Kubernetes role to authenticate to (for --auth kubernetes) [$VAC_AUTH_K8S_ROLE] --help, -h show help ``` diff --git a/go.mod b/go.mod index 2533958..6a78b40 100644 --- a/go.mod +++ b/go.mod @@ -1,18 +1,19 @@ module github.com/mvisonneau/vac -go 1.23 +go 1.24.0 require ( - github.com/gofrs/flock v0.12.1 + github.com/gofrs/flock v0.13.0 github.com/hashicorp/go-secure-stdlib/mlock v0.1.3 - github.com/hashicorp/vault/api v1.16.0 + github.com/hashicorp/vault/api v1.20.0 + github.com/hashicorp/vault/api/auth/kubernetes v0.10.0 github.com/ktr0731/go-fuzzyfinder v0.8.0 github.com/mitchellh/go-homedir v1.1.0 github.com/mvisonneau/go-helpers v0.0.1 github.com/olekukonko/tablewriter v0.0.5 github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.9.3 - github.com/stretchr/testify v1.10.0 + github.com/stretchr/testify v1.11.1 github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 github.com/urfave/cli/v2 v2.27.6 github.com/xeonx/timeago v1.0.0-rc5 @@ -34,7 +35,7 @@ require ( github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect github.com/hashicorp/go-sockaddr v1.0.6 // indirect - github.com/hashicorp/hcl v1.0.1-vault-5 // indirect + github.com/hashicorp/hcl v1.0.1-vault-7 // indirect github.com/kr/text v0.2.0 // indirect github.com/ktr0731/go-ansisgr v0.1.0 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect @@ -47,11 +48,11 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/crypto v0.32.0 // indirect - golang.org/x/net v0.34.0 // indirect - golang.org/x/sys v0.29.0 // indirect - golang.org/x/term v0.28.0 // indirect - golang.org/x/text v0.21.0 // indirect + golang.org/x/crypto v0.36.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.37.0 // indirect + golang.org/x/term v0.30.0 // indirect + golang.org/x/text v0.23.0 // indirect golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 5f1258b..9dc6e39 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,8 @@ github.com/go-jose/go-jose/v4 v4.0.5 h1:M6T8+mKZl/+fNNuFHvGIzDz7BTLQPIounk/b9dw3 github.com/go-jose/go-jose/v4 v4.0.5/go.mod h1:s3P1lRrkT8igV8D9OjyL4WRyHvjB6a4JSllnOrmmBOA= github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg= github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= -github.com/gofrs/flock v0.12.1 h1:MTLVXXHf8ekldpJk3AKicLij9MdwOWkZ+a/jHHZby9E= -github.com/gofrs/flock v0.12.1/go.mod h1:9zxTsyu5xtJ9DK+1tFZyibEV7y3uwDxPPfbxeeHCoD0= +github.com/gofrs/flock v0.13.0 h1:95JolYOvGMqeH31+FC7D2+uULf6mG61mEZ/A8dRYMzw= +github.com/gofrs/flock v0.13.0/go.mod h1:jxeyy9R1auM5S6JYDBhDt+E2TCo7DkratH4Pgi8P+Z0= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= @@ -46,10 +46,12 @@ github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 h1:kes8mmyCpxJsI7FTwtzRqEy9 github.com/hashicorp/go-secure-stdlib/strutil v0.1.2/go.mod h1:Gou2R9+il93BqX25LAKCLuM+y9U2T4hlwvT1yprcna4= github.com/hashicorp/go-sockaddr v1.0.6 h1:RSG8rKU28VTUTvEKghe5gIhIQpv8evvNpnDEyqO4u9I= github.com/hashicorp/go-sockaddr v1.0.6/go.mod h1:uoUUmtwU7n9Dv3O4SNLeFvg0SxQ3lyjsj6+CCykpaxI= -github.com/hashicorp/hcl v1.0.1-vault-5 h1:kI3hhbbyzr4dldA8UdTb7ZlVVlI2DACdCfz31RPDgJM= -github.com/hashicorp/hcl v1.0.1-vault-5/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= -github.com/hashicorp/vault/api v1.16.0 h1:nbEYGJiAPGzT9U4oWgaaB0g+Rj8E59QuHKyA5LhwQN4= -github.com/hashicorp/vault/api v1.16.0/go.mod h1:KhuUhzOD8lDSk29AtzNjgAu2kxRA9jL9NAbkFlqvkBA= +github.com/hashicorp/hcl v1.0.1-vault-7 h1:ag5OxFVy3QYTFTJODRzTKVZ6xvdfLLCA1cy/Y6xGI0I= +github.com/hashicorp/hcl v1.0.1-vault-7/go.mod h1:XYhtn6ijBSAj6n4YqAaf7RBPS4I06AItNorpy+MoQNM= +github.com/hashicorp/vault/api v1.20.0 h1:KQMHElgudOsr+IbJgmbjHnCTxEpKs9LnozA1D3nozU4= +github.com/hashicorp/vault/api v1.20.0/go.mod h1:GZ4pcjfzoOWpkJ3ijHNpEoAxKEsBJnVljyTe3jM2Sms= +github.com/hashicorp/vault/api/auth/kubernetes v0.10.0 h1:5rqWmUFxnu3S7XYq9dafURwBgabYDFzo2Wv+AMopPHs= +github.com/hashicorp/vault/api/auth/kubernetes v0.10.0/go.mod h1:cZZmhF6xboMDmDbMY52oj2DKW6gS0cQ9g0pJ5XIXQ5U= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -101,8 +103,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= -github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtseVEc4yCz2qF8ZrQvIDBJLl4S1c3GCXmoI= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/urfave/cli/v2 v2.27.6 h1:VdRdS98FNhKZ8/Az8B7MTyGQmpIr36O1EHybx/LaZ4g= @@ -114,16 +116,16 @@ github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBi github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= -golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= -golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -137,21 +139,21 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= -golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= +golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= -golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= -golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 5183f3f..326bbb2 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -34,6 +34,8 @@ func NewApp(version string, start time.Time) (app *cli.App) { flags.LogLevel, flags.Role, flags.State, + flags.Auth, + flags.AuthK8sRole, } app.Action = cmd.ExecWrapper(cmd.Switch) diff --git a/internal/cli/flags/flags.go b/internal/cli/flags/flags.go index 0ceedaf..156316a 100644 --- a/internal/cli/flags/flags.go +++ b/internal/cli/flags/flags.go @@ -60,4 +60,17 @@ var ( Usage: "ttl `duration`", Value: 0, } + + Auth = &cli.StringFlag{ + Name: "auth", + EnvVars: []string{"VAC_AUTH"}, + Usage: "auth method (token, kubernetes)", + Value: "token", + } + + AuthK8sRole = &cli.StringFlag{ + Name: "auth-k8s-role", + EnvVars: []string{"VAC_AUTH_K8S_ROLE"}, + Usage: "Kubernetes role to authenticate to (for --auth kubernetes)", + } ) diff --git a/internal/cmd/get.go b/internal/cmd/get.go index 076c231..99bb42f 100644 --- a/internal/cmd/get.go +++ b/internal/cmd/get.go @@ -61,6 +61,11 @@ func Get(ctx *cli.Context) (int, error) { defer unlock() } + err = vac.Authenticate(cfg.AuthInfo) + if err != nil { + return 1, err + } + s, err := state.Read(cfg.StatePath) if err != nil { return 1, err diff --git a/internal/cmd/status.go b/internal/cmd/status.go index 32904ec..7485a01 100644 --- a/internal/cmd/status.go +++ b/internal/cmd/status.go @@ -33,6 +33,11 @@ func Status(ctx *cli.Context) (int, error) { defer unlock() } + err = vac.Authenticate(cfg.AuthInfo) + if err != nil { + return 1, err + } + s, err := state.Read(cfg.StatePath) if err != nil { return 1, err diff --git a/internal/cmd/switch.go b/internal/cmd/switch.go index 6f02fff..473cae8 100644 --- a/internal/cmd/switch.go +++ b/internal/cmd/switch.go @@ -29,6 +29,11 @@ func Switch(ctx *cli.Context) (int, error) { defer unlock() } + err = vac.Authenticate(cfg.AuthInfo) + if err != nil { + return 1, err + } + s, err := state.Read(cfg.StatePath) if err != nil { return 1, err diff --git a/internal/cmd/utils.go b/internal/cmd/utils.go index 7d0bf76..490a86c 100644 --- a/internal/cmd/utils.go +++ b/internal/cmd/utils.go @@ -13,6 +13,7 @@ import ( "github.com/mvisonneau/go-helpers/logger" "github.com/mvisonneau/vac/internal/cli/flags" + "github.com/mvisonneau/vac/pkg/client" ) var start time.Time @@ -23,6 +24,8 @@ type Config struct { Role string StatePath string LockPath string + + AuthInfo client.AuthInfo } func configure(ctx *cli.Context) (*Config, error) { @@ -45,6 +48,11 @@ func configure(ctx *cli.Context) (*Config, error) { Role: flags.Role.Get(ctx), StatePath: statePath, LockPath: fmt.Sprintf("%s.lock", statePath), + + AuthInfo: client.AuthInfo{ + Method: ctx.String("auth"), + RoleName: ctx.String("auth-k8s-role"), + }, }, nil } diff --git a/pkg/client/vault.go b/pkg/client/vault.go index 430c168..668550f 100644 --- a/pkg/client/vault.go +++ b/pkg/client/vault.go @@ -1,14 +1,15 @@ package client import ( + "context" "fmt" - "io/ioutil" "os" "path/filepath" "strings" "time" vault "github.com/hashicorp/vault/api" + k8sauth "github.com/hashicorp/vault/api/auth/kubernetes" "github.com/mitchellh/go-homedir" ) @@ -38,22 +39,46 @@ func getVaultClient() (*vault.Client, error) { return nil, fmt.Errorf("error settings vault client addr: %w", err) } - token := os.Getenv("VAULT_TOKEN") - if len(token) == 0 { - home, _ := homedir.Dir() - f, err := ioutil.ReadFile(filepath.Clean(home + "/.vault-token")) + return c, nil +} + +type AuthInfo struct { + Method string + + RoleName string +} + +func (c *Client) Authenticate(info AuthInfo) error { + switch info.Method { + case "kubernetes": + authMethod, err := k8sauth.NewKubernetesAuth(info.RoleName) if err != nil { - return nil, fmt.Errorf("Vault token is not defined (VAULT_TOKEN or ~/.vault-token)") + return err } + _, err = c.Auth().Login(context.Background(), authMethod) + if err != nil { + return err + } + return nil + case "token", "": + // Vault SDK automatically handle the envars + if c.Token() == "" { + home, _ := homedir.Dir() + f, err := os.ReadFile(filepath.Clean(home + "/.vault-token")) + if err != nil { + return fmt.Errorf("Vault token is not defined (%s or ~/.vault-token)", vault.EnvVaultToken) + } - // The vault client does not handle a trailing newline, so we ensure it - // has been removed - token = strings.TrimSuffix(string(f), "\n") - } - - c.SetToken(token) + // The vault client does not handle a trailing newline, so we ensure it + // has been removed + token := strings.TrimSuffix(string(f), "\n") + c.SetToken(token) + } - return c, nil + return nil + default: + return fmt.Errorf("unknown Vault authentication method '%s'", info.Method) + } } // ListAWSSecretEngines .. From 9169e7455188fd7d79b00fe4542c05978031bc90 Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Tue, 11 Apr 2023 17:09:08 +0700 Subject: [PATCH 08/11] Added --auth-k8s-mount --- Makefile | 30 ++++++++---------------------- README.md | 1 + internal/cli/cli.go | 1 + internal/cli/flags/flags.go | 7 +++++++ internal/cmd/utils.go | 5 +++-- pkg/client/vault.go | 5 +++-- 6 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 65bce67..a69b5c3 100644 --- a/Makefile +++ b/Makefile @@ -3,6 +3,14 @@ FILES := $(shell git ls-files */*.go) REPOSITORY := mvisonneau/$(NAME) .DEFAULT_GOAL := help +.PHONY: setup +setup: ## Install required libraries/tools for build tasks + @command -v gofumpt 2>&1 >/dev/null || go install mvdan.cc/gofumpt@v0.2.1 + @command -v gosec 2>&1 >/dev/null || go install github.com/securego/gosec/v2/cmd/gosec@v2.9.6 + @command -v ineffassign 2>&1 >/dev/null || go install github.com/gordonklaus/ineffassign@v0.0.0-20210914165742-4cc7213b9bc8 + @command -v misspell 2>&1 >/dev/null || go install github.com/client9/misspell/cmd/misspell@v0.3.4 + @command -v revive 2>&1 >/dev/null || go install github.com/mgechev/revive@v1.1.3 + .PHONY: fmt fmt: ## Format source code go run mvdan.cc/gofumpt@v0.6.0 -w $(shell git ls-files **/*.go) @@ -63,28 +71,6 @@ is-git-dirty: ## Tests if git is in a dirty state @git status --porcelain @test $(shell git status --porcelain | grep -c .) -eq 0 -.PHONY: coverage -coverage: ## Generates coverage report - rm -rf *.out - go test -count=1 -race -v ./... -coverpkg=./... -coverprofile=coverage.out - -.PHONY: coverage-html -coverage-html: ## Generates coverage report and displays it in the browser - go tool cover -html=coverage.out - -.PHONY: dev-env -dev-env: ## Build a local development environment using Docker - @docker run -it --rm \ - -v $(shell pwd):/go/src/github.com/mvisonneau/$(NAME) \ - -w /go/src/github.com/mvisonneau/$(NAME) \ - golang:1.17 \ - /bin/bash -c 'make setup; make install; bash' - -.PHONY: is-git-dirty -is-git-dirty: ## Tests if git is in a dirty state - @git status --porcelain - @test $(shell git status --porcelain | grep -c .) -eq 0 - .PHONY: all all: lint test build coverage ## Test, builds and ship package for all supported platforms diff --git a/README.md b/README.md index d3349f0..4cba983 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,7 @@ GLOBAL OPTIONS: --log-format format log format (json,text) (default: "text") [$VAC_LOG_FORMAT] --auth value auth method (token, kubernetes) (default: "token") [$VAC_AUTH] --auth-k8s-role value Kubernetes role to authenticate to (for --auth kubernetes) [$VAC_AUTH_K8S_ROLE] + --auth-k8s-mount value Kubernetes auth mount path (for --auth kubernetes) (default: "kubernetes") [$VAC_AUTH_K8S_MOUNT] --help, -h show help ``` diff --git a/internal/cli/cli.go b/internal/cli/cli.go index 326bbb2..c8c6af2 100644 --- a/internal/cli/cli.go +++ b/internal/cli/cli.go @@ -36,6 +36,7 @@ func NewApp(version string, start time.Time) (app *cli.App) { flags.State, flags.Auth, flags.AuthK8sRole, + flags.AuthK8sMount, } app.Action = cmd.ExecWrapper(cmd.Switch) diff --git a/internal/cli/flags/flags.go b/internal/cli/flags/flags.go index 156316a..aced7b6 100644 --- a/internal/cli/flags/flags.go +++ b/internal/cli/flags/flags.go @@ -73,4 +73,11 @@ var ( EnvVars: []string{"VAC_AUTH_K8S_ROLE"}, Usage: "Kubernetes role to authenticate to (for --auth kubernetes)", } + + AuthK8sMount = &cli.StringFlag{ + Name: "auth-k8s-mount", + EnvVars: []string{"VAC_AUTH_K8S_MOUNT"}, + Usage: "Kubernetes auth mount path (for --auth kubernetes)", + Value: "kubernetes", + } ) diff --git a/internal/cmd/utils.go b/internal/cmd/utils.go index 490a86c..926aa4c 100644 --- a/internal/cmd/utils.go +++ b/internal/cmd/utils.go @@ -50,8 +50,9 @@ func configure(ctx *cli.Context) (*Config, error) { LockPath: fmt.Sprintf("%s.lock", statePath), AuthInfo: client.AuthInfo{ - Method: ctx.String("auth"), - RoleName: ctx.String("auth-k8s-role"), + Method: ctx.String("auth"), + MountPath: ctx.String("auth-k8s-mount"), + RoleName: ctx.String("auth-k8s-role"), }, }, nil } diff --git a/pkg/client/vault.go b/pkg/client/vault.go index 668550f..f33b3ca 100644 --- a/pkg/client/vault.go +++ b/pkg/client/vault.go @@ -45,13 +45,14 @@ func getVaultClient() (*vault.Client, error) { type AuthInfo struct { Method string - RoleName string + MountPath string + RoleName string } func (c *Client) Authenticate(info AuthInfo) error { switch info.Method { case "kubernetes": - authMethod, err := k8sauth.NewKubernetesAuth(info.RoleName) + authMethod, err := k8sauth.NewKubernetesAuth(info.RoleName, k8sauth.WithMountPath(info.MountPath)) if err != nil { return err } From dc4f876a4809d5088e39dd38697d7b86760ddf4e Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Fri, 31 Oct 2025 15:55:35 +0700 Subject: [PATCH 09/11] Fix all the broken merges --- CHANGELOG.md | 3 ++- Makefile | 40 ++++++++-------------------------------- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 307ff3e..ecc02c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -103,7 +103,8 @@ and this project adheres to [0ver](https://0ver.org) (more or less). - LICENSE - README -[Unreleased]: https://github.com/mvisonneau/vac/compare/v0.0.7...HEAD +[Unreleased]: https://github.com/mvisonneau/vac/compare/v0.0.8...HEAD +[v0.0.8]: https://github.com/mvisonneau/vac/tree/v0.0.8 [v0.0.7]: https://github.com/mvisonneau/vac/tree/v0.0.7 [v0.0.6]: https://github.com/mvisonneau/vac/tree/v0.0.6 [v0.0.5]: https://github.com/mvisonneau/vac/tree/v0.0.5 diff --git a/Makefile b/Makefile index a69b5c3..50ca2e9 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,8 @@ NAME := vac -FILES := $(shell git ls-files */*.go) +COVERAGE_FILE := coverage.out REPOSITORY := mvisonneau/$(NAME) .DEFAULT_GOAL := help -.PHONY: setup -setup: ## Install required libraries/tools for build tasks - @command -v gofumpt 2>&1 >/dev/null || go install mvdan.cc/gofumpt@v0.2.1 - @command -v gosec 2>&1 >/dev/null || go install github.com/securego/gosec/v2/cmd/gosec@v2.9.6 - @command -v ineffassign 2>&1 >/dev/null || go install github.com/gordonklaus/ineffassign@v0.0.0-20210914165742-4cc7213b9bc8 - @command -v misspell 2>&1 >/dev/null || go install github.com/client9/misspell/cmd/misspell@v0.3.4 - @command -v revive 2>&1 >/dev/null || go install github.com/mgechev/revive@v1.1.3 - .PHONY: fmt fmt: ## Format source code go run mvdan.cc/gofumpt@v0.6.0 -w $(shell git ls-files **/*.go) @@ -22,7 +14,13 @@ lint: ## Run all lint related tests upon the codebase .PHONY: test test: ## Run the tests against the codebase - go test -v -count=1 -race ./... + @rm -rf $(COVERAGE_FILE) + go test -v -count=1 -race ./... -coverprofile=$(COVERAGE_FILE) + @go tool cover -func $(COVERAGE_FILE) | awk '/^total/ {print "coverage: " $$3}' + +.PHONY: coverage +coverage: ## Prints coverage report + go tool cover -func $(COVERAGE_FILE) .PHONY: install install: ## Build and install locally the binary (dev purpose) @@ -49,28 +47,6 @@ prerelease: ## Build & prerelease the binaries (edge) clean: ## Remove binary if it exists rm -f $(NAME) -.PHONY: coverage -coverage: ## Generates coverage report - rm -rf *.out - go test -count=1 -race -v ./... -coverpkg=./... -coverprofile=coverage.out - -.PHONY: coverage-html -coverage-html: ## Generates coverage report and displays it in the browser - go tool cover -html=coverage.out - -.PHONY: dev-env -dev-env: ## Build a local development environment using Docker - @docker run -it --rm \ - -v $(shell pwd):/go/src/github.com/mvisonneau/$(NAME) \ - -w /go/src/github.com/mvisonneau/$(NAME) \ - golang:1.17 \ - /bin/bash -c 'make setup; make install; bash' - -.PHONY: is-git-dirty -is-git-dirty: ## Tests if git is in a dirty state - @git status --porcelain - @test $(shell git status --porcelain | grep -c .) -eq 0 - .PHONY: all all: lint test build coverage ## Test, builds and ship package for all supported platforms From 281a481f81600a013a6d510d5e6a3e63ee0d7333 Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Mon, 3 Nov 2025 10:56:36 +0700 Subject: [PATCH 10/11] Upgrade go.mod for security vuln --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 6a78b40..f3b03de 100644 --- a/go.mod +++ b/go.mod @@ -48,11 +48,11 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/crypto v0.36.0 // indirect - golang.org/x/net v0.37.0 // indirect + golang.org/x/crypto v0.43.0 // indirect + golang.org/x/net v0.46.0 // indirect golang.org/x/sys v0.37.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect + golang.org/x/term v0.36.0 // indirect + golang.org/x/text v0.30.0 // indirect golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 9dc6e39..ad3b144 100644 --- a/go.sum +++ b/go.sum @@ -116,16 +116,16 @@ github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBi github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= +golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= -golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= +golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -145,15 +145,15 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= +golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= +golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From bedda0fb6104afa890c2bdc779f242846d963ebb Mon Sep 17 00:00:00 2001 From: Manatsawin Hanmongkolchai Date: Thu, 4 Dec 2025 14:51:31 +0700 Subject: [PATCH 11/11] Vulnerability update --- go.mod | 10 +++++----- go.sum | 6 ++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index f3b03de..59e0cd9 100644 --- a/go.mod +++ b/go.mod @@ -48,11 +48,11 @@ require ( github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/ryanuber/go-glob v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 // indirect - golang.org/x/crypto v0.43.0 // indirect - golang.org/x/net v0.46.0 // indirect - golang.org/x/sys v0.37.0 // indirect - golang.org/x/term v0.36.0 // indirect - golang.org/x/text v0.30.0 // indirect + golang.org/x/crypto v0.45.0 // indirect + golang.org/x/net v0.47.0 // indirect + golang.org/x/sys v0.38.0 // indirect + golang.org/x/term v0.37.0 // indirect + golang.org/x/text v0.31.0 // indirect golang.org/x/time v0.5.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index ad3b144..d7db20e 100644 --- a/go.sum +++ b/go.sum @@ -118,6 +118,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -126,6 +128,7 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -141,12 +144,14 @@ golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= +golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -154,6 +159,7 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=