Skip to content

Commit

Permalink
basic functionality (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
markus621 authored Oct 29, 2024
1 parent cd25773 commit f453e86
Show file tree
Hide file tree
Showing 25 changed files with 1,749 additions and 46 deletions.
27 changes: 27 additions & 0 deletions .deb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package: pinion
source: pinion
version: 1:0.1.0
architecture:
- amd64
- arm64
maintainer: The OSSPkg Team <github@osspkg.com>
homepage: https://osspkg.com/
description:
- Reverse proxy
section: utils
priority: optional
control:
depends:
- systemd
- ca-certificates
build: devtool build --arch=%arch%
conffiles:
- /etc/pinion/config.yaml
preinst: scripts/preinst.sh
postinst: scripts/postinst.sh
prerm: scripts/prerm.sh
postrm: scripts/postrm.sh
data:
bin/pinion: build/pinion_%arch%
etc/pinion/config.yaml: config/config.yaml
etc/systemd/system/pinion.service: init/pinion.service
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

version: 2
updates:
- package-ecosystem: "gomod" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
go: [ '1.22' ]
steps:
- uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.go }}

- name: Run CI
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: make ci
29 changes: 12 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
# If you prefer the allow list template instead of the deny list, see community template:
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
#
# Binaries for programs and plugins
.tools/
bin/
vendor/
build/
.idea/
.vscode/
coverage.txt
coverage.out
*.exe
*.exe~
*.dll
*.so
*.dylib

# Test binary, built with `go test -c`
*.db
*.db-journal
*.mmdb
*.test

# Output of the go coverage tool, specifically when used with LiteIDE
*.out

# Dependency directories (remove the comment below to include it)
# vendor/

# Go workspace file
go.work
go.work.sum

# env file
.env
*.dev.yaml
213 changes: 213 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@

run:
go: "1.22.5"
concurrency: 4
timeout: 5m
tests: false
issues-exit-code: 1
modules-download-mode: readonly

issues:
exclude-use-default: false
max-issues-per-linter: 100
max-same-issues: 4
new: false
exclude-files:
- ".+_test.go"
exclude-dirs:
- "vendor$"

output:
formats:
- format: line-number
sort-results: true

linters-settings:
govet:
check-shadowing: true
enable:
- asmdecl
- assign
- atomic
- atomicalign
- bools
- buildtag
- cgocall
- composites
- copylocks
- deepequalerrors
- errorsas
- findcall
- framepointer
- httpresponse
- ifaceassert
- loopclosure
- lostcancel
- nilfunc
- nilness
- printf
- reflectvaluecompare
- shadow
- shift
- sigchanyzer
- sortslice
- stdmethods
- stringintconv
- structtag
- testinggoroutine
- tests
- unmarshal
- unreachable
- unsafeptr
- unusedresult
- unusedwrite
disable:
- fieldalignment
gofmt:
simplify: true
errcheck:
check-type-assertions: true
check-blank: true
gocyclo:
min-complexity: 30
misspell:
locale: US
prealloc:
simple: true
range-loops: true
for-loops: true
unparam:
check-exported: false
gci:
skip-generated: true
custom-order: false
gosec:
includes:
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
excludes:
- G101 # Look for hard coded credentials
- G102 # Bind to all interfaces
- G103 # Audit the use of unsafe block
- G104 # Audit errors not checked
- G106 # Audit the use of ssh.InsecureIgnoreHostKey
- G107 # Url provided to HTTP request as taint input
- G108 # Profiling endpoint automatically exposed on /debug/pprof
- G109 # Potential Integer overflow made by strconv.Atoi result conversion to int16/32
- G110 # Potential DoS vulnerability via decompression bomb
- G111 # Potential directory traversal
- G112 # Potential slowloris attack
- G113 # Usage of Rat.SetString in math/big with an overflow (CVE-2022-23772)
- G114 # Use of net/http serve function that has no support for setting timeouts
- G201 # SQL query construction using format string
- G202 # SQL query construction using string concatenation
- G203 # Use of unescaped data in HTML templates
- G204 # Audit use of command execution
- G301 # Poor file permissions used when creating a directory
- G302 # Poor file permissions used with chmod
- G303 # Creating tempfile using a predictable path
- G304 # File path provided as taint input
- G305 # File traversal when extracting zip/tar archive
- G306 # Poor file permissions used when writing to a new file
- G307 # Deferring a method which returns an error
- G401 # Detect the usage of DES, RC4, MD5 or SHA1
- G402 # Look for bad TLS connection settings
- G403 # Ensure minimum RSA key length of 2048 bits
- G404 # Insecure random number source (rand)
- G501 # Import blocklist: crypto/md5
- G502 # Import blocklist: crypto/des
- G503 # Import blocklist: crypto/rc4
- G504 # Import blocklist: net/http/cgi
- G505 # Import blocklist: crypto/sha1
- G601 # Implicit memory aliasing of items from a range statement
exclude-generated: true
severity: medium
confidence: medium
concurrency: 12
config:
global:
nosec: true
"#nosec": "#my-custom-nosec"
show-ignored: true
audit: true
G101:
pattern: "(?i)passwd|pass|password|pwd|secret|token|pw|apiKey|bearer|cred"
ignore_entropy: false
entropy_threshold: "80.0"
per_char_threshold: "3.0"
truncate: "32"
G104:
fmt:
- Fscanf
G111:
pattern: "http\\.Dir\\(\"\\/\"\\)|http\\.Dir\\('\\/'\\)"
G301: "0750"
G302: "0600"
G306: "0600"

lll:
line-length: 130
tab-width: 1
staticcheck:
go: "1.15"
# SAxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
# Default: ["*"]
checks: [ "*", "-SA1019" ]

linters:
disable-all: true
enable:
- govet
- gofmt
- errcheck
- misspell
- gocyclo
- ineffassign
- goimports
- nakedret
- unparam
- unused
- prealloc
- durationcheck
- staticcheck
- makezero
- nilerr
- errorlint
- bodyclose
- exportloopref
- gci
- gosec
# - lll
fast: false
3 changes: 3 additions & 0 deletions .lic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
author: "Mikhail Knyazhev <markus621@yandex.com>"
lic_short: "GPL-3.0"
lic_file: LICENSE
Loading

0 comments on commit f453e86

Please sign in to comment.