mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Merge pull request #231 from crazy-max/lint
lint gha job and remove travis
This commit is contained in:
@@ -11,7 +11,7 @@ on:
|
||||
|
||||
env:
|
||||
DESTDIR: ./bin
|
||||
GO_VERSION: 1.16.7
|
||||
GO_VERSION: 1.18.5
|
||||
|
||||
jobs:
|
||||
validate:
|
||||
@@ -20,6 +20,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
target:
|
||||
- lint
|
||||
- validate-vendor
|
||||
steps:
|
||||
-
|
||||
@@ -58,9 +59,37 @@ jobs:
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass
|
||||
-
|
||||
name: GPG conf
|
||||
if: ${{ matrix.os == 'ubuntu-20.04' }}
|
||||
uses: actions/github-script@v6
|
||||
id: gpg
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
const gnupgfolder = `${require('os').homedir()}/.gnupg`;
|
||||
if (!fs.existsSync(gnupgfolder)){
|
||||
fs.mkdirSync(gnupgfolder);
|
||||
}
|
||||
fs.copyFile('.github/workflows/fixtures/gpg.conf', `${gnupgfolder}/gpg.conf`, (err) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
core.setOutput('key', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.key', {encoding: 'utf8'}));
|
||||
core.setOutput('passphrase', fs.readFileSync('.github/workflows/fixtures/7D851EB72D73BDA0.pass', {encoding: 'utf8'}));
|
||||
-
|
||||
name: Import GPG key
|
||||
if: ${{ matrix.os == 'ubuntu-20.04' }}
|
||||
uses: crazy-max/ghaction-import-gpg@v5
|
||||
with:
|
||||
gpg_private_key: ${{ steps.gpg.outputs.key }}
|
||||
passphrase: ${{ steps.gpg.outputs.passphrase }}
|
||||
-
|
||||
name: Test
|
||||
run: |
|
||||
if [ "${{ matrix.os }}" = "ubuntu-20.04" ]; then
|
||||
echo -e "trust\n5\ny" | gpg --batch --no-tty --command-fd 0 --edit-key 7D851EB72D73BDA0
|
||||
pass init 7D851EB72D73BDA0
|
||||
fi
|
||||
go test -short -v -coverprofile=./coverage.txt -covermode=atomic ./...
|
||||
go tool cover -func=./coverage.txt
|
||||
shell: bash
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
-----BEGIN PGP PRIVATE KEY BLOCK-----
|
||||
|
||||
lQdGBF6tzaABEACjFbX7PFEG6vDPN2MPyxYW7/3o/sonORj4HXUFjFxxJxktJ3x3
|
||||
N1ayHPJ1lqIeoiY7jVbq0ZdEVGkd3YsKG9ZMdZkzGzY6PQPC/+M8OnzOiOPwUdWc
|
||||
+Tdhh115LvVz0MMKYiab6Sn9cgxj9On3LCQKpjvMDpPo9Ttf6v2GQIw8h2ACvdzQ
|
||||
71LtIELS/I+dLbfZiwpUu2fhQT13EJkEnYMOYwM5jNUd66P9itUc7MrOWjkicrKP
|
||||
oF1dQaCM+tuKuxvD8WLdiwU5x60NoGkJHHUehKQXl2dVzjpqEqHKEBJt9tfJ9lpE
|
||||
YIisgwB8o3pes0fgCehjW2zI95/o9+ayJ6nl4g5+mSvWRXEu66h71nwM0Yuvquk8
|
||||
3me7qhYfDrDdCwcxS5BS1hwakTgUQLD99FZjbx1j8sq96I65O0GRdyU2PR8KIjwu
|
||||
JrkTH4ZlKxK3FQghUhFoA5GkiDb+eClmRMSni5qg+81T4XChmUkEprA3eWCHL+Ma
|
||||
xRNNxLS+r6hH9HG5JBxpV3iaTI9HHpnQKhEeaLXqsUTDZliN9hP7Ywo8bpUB8j2d
|
||||
oWYwDV4dPyMKr6Fb8RDCh2q5gJGbVp8w/NmmBTeL+IP2fFggJkRfyumv3Ul7x66L
|
||||
tBFQ4rYo4JUUrGweSTneG6REIgxH66hIrNl6Vo/D1ZyknTe1dMOu/BTkkQARAQAB
|
||||
/gcDAqra8KO+h3bfyu90vxTL1ro4x/x9il7VBcWlIR4cBP7Imgxv+T4hwPIu8P1x
|
||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SN1qQZiYdwLL5dw6APNyBVjxTN1J
|
||||
gkCdJ/HwAY+r93Lbl5g8gz8d0vJEyfn//34sn9u+toSTw55GcG9Ks1kSKIeDNh0h
|
||||
MiPm3HmJAh8EGAEIAAkFAl6tzaACGwwACgkQfYUety1zvaBV9hAAgliX36pXJ59g
|
||||
3I9/4R68e/fGg0FMM6D+01yCeiKApOYRrJ0cYKn7ITDYmHhlGGpBAie90UsqX12h
|
||||
hdLP7LoQx7sjTyzQt6JmpA8krIwi2ON7FKBkdYb8IYx4mE/5vKnYT4/SFnwTmnZY
|
||||
+m+NzK2U/qmhq8JyO8gozdAKJUcgz49IVv2Ij0tQ4qaPbyPwQxIDyKnT758nJhB1
|
||||
jTqo+oWtER8q3okzIlqcArqn5rDaNJx+DRYL4E/IddyHQAiUWUka8usIUqeW5reu
|
||||
zoPUE2CCfOJSGArkqHQQqMx0WEzjQTwAPaHrQbera4SbiV/o4CLCV/u5p1Qnig+Q
|
||||
iUsakmlD299t//125LIQEa5qzd9hRC7u1uJS7VdW8eGIEcZ0/XT/sr+z23z0kpZH
|
||||
D3dXPX0BwM4IP9xu31CNg10x0rKwjbxy8VaskFEelpqpu+gpAnxqMd1evpeUHcOd
|
||||
r5RgPgkNFfba9Nbxf7uEX+HOmsOM+kdtSmdGIvsBZjVnW31nnoDMp49jG4OynjrH
|
||||
cRuoM9sxdr6UDqb22CZ3/e0YN4UaZM3YDWMVaP/QBVgvIFcdByqNWezpd9T4ZUII
|
||||
MZlaV1uRnHg6B/zTzhIdMM80AXz6Uv6kw4S+Lt7HlbrnMT7uKLuvzH7cle0hcIUa
|
||||
PejgXO0uIRolYQ3sz2tMGhx1MfBqH64=
|
||||
=WbwB
|
||||
-----END PGP PRIVATE KEY BLOCK-----
|
||||
@@ -0,0 +1 @@
|
||||
with stupid passphrase
|
||||
@@ -1,9 +1,6 @@
|
||||
#!/usr/bin/env sh
|
||||
set -ex
|
||||
|
||||
sh -e /etc/init.d/xvfb start
|
||||
sleep 3 # give xvfb some time to start
|
||||
|
||||
# init key for pass
|
||||
gpg --batch --gen-key <<-EOF
|
||||
%echo Generating a standard key
|
||||
Key-Type: DSA
|
||||
@@ -17,6 +14,3 @@ Expire-Date: 0
|
||||
%commit
|
||||
%echo done
|
||||
EOF
|
||||
|
||||
key=$(gpg --no-auto-check-trustdb --list-secret-keys | grep ^sec | cut -d/ -f2 | cut -d" " -f1)
|
||||
pass init $key
|
||||
@@ -0,0 +1,3 @@
|
||||
default-cache-ttl 21600
|
||||
max-cache-ttl 31536000
|
||||
allow-preset-passphrase
|
||||
@@ -0,0 +1,71 @@
|
||||
################################################################################
|
||||
# GnuPG Options
|
||||
|
||||
# (OpenPGP-Configuration-Options)
|
||||
# Assume that command line arguments are given as UTF8 strings.
|
||||
utf8-strings
|
||||
|
||||
# (OpenPGP-Protocol-Options)
|
||||
# Set the list of personal digest/cipher/compression preferences. This allows
|
||||
# the user to safely override the algorithm chosen by the recipient key
|
||||
# preferences, as GPG will only select an algorithm that is usable by all
|
||||
# recipients.
|
||||
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
|
||||
personal-cipher-preferences AES256 AES192 AES CAST5 CAMELLIA192 BLOWFISH TWOFISH CAMELLIA128 3DES
|
||||
personal-compress-preferences ZLIB BZIP2 ZIP
|
||||
|
||||
# Set the list of default preferences to string. This preference list is used
|
||||
# for new keys and becomes the default for "setpref" in the edit menu.
|
||||
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAST5 ZLIB BZIP2 ZIP Uncompressed
|
||||
|
||||
# (OpenPGP-Esoteric-Options)
|
||||
# Use name as the message digest algorithm used when signing a key. Running the
|
||||
# program with the command --version yields a list of supported algorithms. Be
|
||||
# aware that if you choose an algorithm that GnuPG supports but other OpenPGP
|
||||
# implementations do not, then some users will not be able to use the key
|
||||
# signatures you make, or quite possibly your entire key.
|
||||
#
|
||||
# SHA-1 is the only algorithm specified for OpenPGP V4. By changing the
|
||||
# cert-digest-algo, the OpenPGP V4 specification is not met but with even
|
||||
# GnuPG 1.4.10 (release 2009) supporting SHA-2 algorithm, this should be safe.
|
||||
# Source: https://tools.ietf.org/html/rfc4880#section-12.2
|
||||
cert-digest-algo SHA512
|
||||
digest-algo SHA256
|
||||
|
||||
# Selects how passphrases for symmetric encryption are mangled. 3 (the default)
|
||||
# iterates the whole process a number of times (see --s2k-count).
|
||||
s2k-mode 3
|
||||
|
||||
# (OpenPGP-Protocol-Options)
|
||||
# Use name as the cipher algorithm for symmetric encryption with a passphrase
|
||||
# if --personal-cipher-preferences and --cipher-algo are not given. The
|
||||
# default is AES-128.
|
||||
s2k-cipher-algo AES256
|
||||
|
||||
# (OpenPGP-Protocol-Options)
|
||||
# Use name as the digest algorithm used to mangle the passphrases for symmetric
|
||||
# encryption. The default is SHA-1.
|
||||
s2k-digest-algo SHA512
|
||||
|
||||
# (OpenPGP-Protocol-Options)
|
||||
# Specify how many times the passphrases mangling for symmetric encryption is
|
||||
# repeated. This value may range between 1024 and 65011712 inclusive. The
|
||||
# default is inquired from gpg-agent. Note that not all values in the
|
||||
# 1024-65011712 range are legal and if an illegal value is selected, GnuPG will
|
||||
# round up to the nearest legal value. This option is only meaningful if
|
||||
# --s2k-mode is set to the default of 3.
|
||||
s2k-count 1015808
|
||||
|
||||
################################################################################
|
||||
# GnuPG View Options
|
||||
|
||||
# Select how to display key IDs. "long" is the more accurate (but less
|
||||
# convenient) 16-character key ID. Add an "0x" to include an "0x" at the
|
||||
# beginning of the key ID.
|
||||
keyid-format 0xlong
|
||||
|
||||
# List all keys with their fingerprints. This is the same output as --list-keys
|
||||
# but with the additional output of a line with the fingerprint. If this
|
||||
# command is given twice, the fingerprints of all secondary keys are listed too.
|
||||
with-fingerprint
|
||||
with-fingerprint
|
||||
@@ -0,0 +1,35 @@
|
||||
run:
|
||||
timeout: 10m
|
||||
modules-download-mode: vendor
|
||||
|
||||
linters:
|
||||
enable:
|
||||
- gofmt
|
||||
- govet
|
||||
- deadcode
|
||||
- depguard
|
||||
- goimports
|
||||
- ineffassign
|
||||
- misspell
|
||||
- unused
|
||||
- varcheck
|
||||
- revive
|
||||
- staticcheck
|
||||
- typecheck
|
||||
- structcheck
|
||||
disable-all: true
|
||||
|
||||
linters-settings:
|
||||
depguard:
|
||||
list-type: blacklist
|
||||
include-go-root: true
|
||||
packages:
|
||||
# The io/ioutil package has been deprecated.
|
||||
# https://go.dev/doc/go1.16#ioutil
|
||||
- io/ioutil
|
||||
|
||||
issues:
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- revive
|
||||
text: "stutters"
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
---
|
||||
# See appveyor.yml for windows build.
|
||||
sudo: required
|
||||
language: go
|
||||
dist: trusty
|
||||
osx_image: xcode10.1
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
notifications:
|
||||
email: false
|
||||
go:
|
||||
- 1.12.x
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libsecret-1-dev
|
||||
- pass
|
||||
before_script:
|
||||
- make deps
|
||||
- "export DISPLAY=:99.0"
|
||||
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sh ci/before_script_linux.sh; fi
|
||||
- make validate
|
||||
script: make test
|
||||
+24
-3
@@ -3,6 +3,7 @@
|
||||
ARG GO_VERSION=1.18.5
|
||||
ARG XX_VERSION=1.1.2
|
||||
ARG OSXCROSS_VERSION=11.3-r7-alpine
|
||||
ARG GOLANGCI_LINT_VERSION=v1.47.3
|
||||
|
||||
ARG PKG=github.com/docker/docker-credential-helpers
|
||||
|
||||
@@ -48,6 +49,14 @@ RUN --mount=type=bind,target=.,rw <<EOT
|
||||
fi
|
||||
EOT
|
||||
|
||||
FROM golangci/golangci-lint:${GOLANGCI_LINT_VERSION}-alpine AS golangci-lint
|
||||
FROM gobase AS lint
|
||||
RUN apk add musl-dev gcc libsecret-dev pass
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=from=golangci-lint,source=/usr/bin/golangci-lint,target=/usr/bin/golangci-lint \
|
||||
golangci-lint run ./...
|
||||
|
||||
FROM gobase AS version
|
||||
ARG PKG
|
||||
RUN --mount=target=. \
|
||||
@@ -60,16 +69,28 @@ ARG TARGETPLATFORM
|
||||
RUN xx-apk add musl-dev gcc libsecret-dev pass
|
||||
|
||||
FROM base AS test
|
||||
RUN xx-apk add gnome-keyring gpg-agent gnupg-gpgconf pass
|
||||
RUN --mount=type=bind,target=. \
|
||||
--mount=type=cache,target=/root/.cache \
|
||||
--mount=type=cache,target=/go/pkg/mod <<EOT
|
||||
set -e
|
||||
xx-go test -short -v -coverprofile=/tmp/coverage.txt -covermode=atomic ./...
|
||||
xx-go tool cover -func=/tmp/coverage.txt
|
||||
cp -r .github/workflows/fixtures /root/.gnupg
|
||||
gpg-connect-agent "RELOADAGENT" /bye
|
||||
gpg --import --batch --yes /root/.gnupg/7D851EB72D73BDA0.key
|
||||
echo -e "trust\n5\ny" | gpg --batch --no-tty --command-fd 0 --edit-key 7D851EB72D73BDA0
|
||||
gpg-connect-agent "PRESET_PASSPHRASE 3E2D1142AA59E08E16B7E2C64BA6DDC773B1A627 -1 77697468207374757069642070617373706872617365" /bye
|
||||
gpg-connect-agent "KEYINFO 3E2D1142AA59E08E16B7E2C64BA6DDC773B1A627" /bye
|
||||
gpg-connect-agent "PRESET_PASSPHRASE BA83FC8947213477F28ADC019F6564A956456163 -1 77697468207374757069642070617373706872617365" /bye
|
||||
gpg-connect-agent "KEYINFO BA83FC8947213477F28ADC019F6564A956456163" /bye
|
||||
pass init 7D851EB72D73BDA0
|
||||
|
||||
mkdir /out
|
||||
xx-go test -short -v -coverprofile=/out/coverage.txt -covermode=atomic ./...
|
||||
xx-go tool cover -func=/out/coverage.txt
|
||||
EOT
|
||||
|
||||
FROM scratch AS test-coverage
|
||||
COPY --from=test /tmp/coverage.txt /coverage.txt
|
||||
COPY --from=test /out /
|
||||
|
||||
FROM base AS build-linux
|
||||
ARG TARGETOS
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
.PHONY: all deps osxkeychain secretservice test validate wincred pass deb
|
||||
.PHONY: all osxkeychain secretservice test lint validate-vendor fmt validate wincred pass deb vendor
|
||||
|
||||
TRAVIS_OS_NAME ?= linux
|
||||
VERSION := $(shell grep 'const Version' credentials/version.go | awk -F'"' '{ print $$2 }')
|
||||
|
||||
all: test
|
||||
|
||||
deps:
|
||||
go get -u golang.org/x/lint/golint
|
||||
|
||||
clean:
|
||||
rm -rf bin
|
||||
rm -rf release
|
||||
@@ -50,28 +46,16 @@ test:
|
||||
# tests all packages except vendor
|
||||
go test -v `go list ./... | grep -v /vendor/`
|
||||
|
||||
vet: vet_$(TRAVIS_OS_NAME)
|
||||
go vet ./credentials
|
||||
|
||||
vet_win:
|
||||
go vet ./wincred
|
||||
|
||||
vet_osx:
|
||||
go vet ./osxkeychain
|
||||
|
||||
vet_linux:
|
||||
go vet ./secretservice
|
||||
|
||||
lint:
|
||||
for p in `go list ./... | grep -v /vendor/`; do \
|
||||
golint $$p ; \
|
||||
done
|
||||
docker buildx bake lint
|
||||
|
||||
validate-vendor:
|
||||
docker buildx bake vendor-validate
|
||||
|
||||
fmt:
|
||||
gofmt -s -l `ls **/*.go | grep -v vendor`
|
||||
|
||||
validate: vet lint fmt
|
||||
|
||||
validate: lint validate-vendor fmt
|
||||
|
||||
BUILDIMG:=docker-credential-secretservice-$(VERSION)
|
||||
deb:
|
||||
@@ -84,14 +68,9 @@ deb:
|
||||
docker run --rm --net=none $(BUILDIMG) tar cf - /release | tar xf -
|
||||
docker rmi $(BUILDIMG)
|
||||
|
||||
.PHONY: vendor
|
||||
vendor:
|
||||
$(eval $@_TMP_OUT := $(shell mktemp -d -t docker-output.XXXXXXXXXX))
|
||||
docker buildx bake --set "*.output=type=local,dest=$($@_TMP_OUT)" vendor
|
||||
rm -rf ./vendor
|
||||
cp -R "$($@_TMP_OUT)"/* .
|
||||
rm -rf "$($@_TMP_OUT)"
|
||||
|
||||
.PHONY: validate-vendor
|
||||
validate-vendor:
|
||||
docker buildx bake vendor-validate
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -32,7 +31,7 @@ type mockProgram struct {
|
||||
// Output returns responses from the remote credentials helper.
|
||||
// It mocks those responses based in the input in the mock.
|
||||
func (m *mockProgram) Output() ([]byte, error) {
|
||||
in, err := ioutil.ReadAll(m.input)
|
||||
in, err := io.ReadAll(m.input)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -108,8 +107,8 @@ func ExampleStore() {
|
||||
|
||||
func TestStore(t *testing.T) {
|
||||
valid := []credentials.Credentials{
|
||||
{validServerAddress, "foo", "bar"},
|
||||
{validServerAddress2, "<token>", "abcd1234"},
|
||||
{ServerURL: validServerAddress, Username: "foo", Secret: "bar"},
|
||||
{ServerURL: validServerAddress2, Username: "<token>", Secret: "abcd1234"},
|
||||
}
|
||||
|
||||
for _, v := range valid {
|
||||
@@ -119,7 +118,7 @@ func TestStore(t *testing.T) {
|
||||
}
|
||||
|
||||
invalid := []credentials.Credentials{
|
||||
{invalidServerAddress, "foo", "bar"},
|
||||
{ServerURL: invalidServerAddress, Username: "foo", Secret: "bar"},
|
||||
}
|
||||
|
||||
for _, v := range invalid {
|
||||
@@ -142,8 +141,8 @@ func ExampleGet() {
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
valid := []credentials.Credentials{
|
||||
{validServerAddress, "foo", "bar"},
|
||||
{validServerAddress2, "<token>", "abcd1234"},
|
||||
{ServerURL: validServerAddress, Username: "foo", Secret: "bar"},
|
||||
{ServerURL: validServerAddress2, Username: "<token>", Secret: "abcd1234"},
|
||||
}
|
||||
|
||||
for _, v := range valid {
|
||||
|
||||
+9
-1
@@ -22,15 +22,23 @@ group "default" {
|
||||
}
|
||||
|
||||
group "validate" {
|
||||
targets = ["vendor-validate"]
|
||||
targets = ["lint", "vendor-validate"]
|
||||
}
|
||||
|
||||
target "lint" {
|
||||
inherits = ["_common"]
|
||||
target = "lint"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "vendor-validate" {
|
||||
inherits = ["_common"]
|
||||
target = "vendor-validate"
|
||||
output = ["type=cacheonly"]
|
||||
}
|
||||
|
||||
target "vendor" {
|
||||
inherits = ["_common"]
|
||||
target = "vendor-update"
|
||||
output = ["."]
|
||||
}
|
||||
|
||||
+12
-6
@@ -9,7 +9,7 @@ import (
|
||||
"encoding/base64"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io/fs"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
// PASS_FOLDER contains the directory where credentials are stored
|
||||
const PASS_FOLDER = "docker-credential-helpers" //nolint: golint
|
||||
const PASS_FOLDER = "docker-credential-helpers" //nolint:revive
|
||||
|
||||
// Pass handles secrets using Linux secret-service as a store.
|
||||
type Pass struct{}
|
||||
@@ -116,16 +116,22 @@ func getPassDir() string {
|
||||
func listPassDir(args ...string) ([]os.FileInfo, error) {
|
||||
passDir := getPassDir()
|
||||
p := path.Join(append([]string{passDir, PASS_FOLDER}, args...)...)
|
||||
contents, err := ioutil.ReadDir(p)
|
||||
entries, err := os.ReadDir(p)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return []os.FileInfo{}, nil
|
||||
}
|
||||
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return contents, nil
|
||||
infos := make([]fs.FileInfo, 0, len(entries))
|
||||
for _, entry := range entries {
|
||||
info, err := entry.Info()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
infos = append(infos, info)
|
||||
}
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
// Get returns the username and secret to use for a given registry server URL.
|
||||
|
||||
Reference in New Issue
Block a user