Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

v1.0.0 #173

Merged
merged 67 commits into from
Nov 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
378102d
v0.16.1
Sep 30, 2020
e530ae8
ci: add a codeql analysis
Oct 1, 2020
9451a76
ci: add github's codeql analysis
Oct 1, 2020
e688a38
agent/metrics: add binning metrics
Sep 14, 2020
e74b9a0
agent/metrics: poc version integrating time and performance histograms
Sep 23, 2020
bc3cd5d
agent: performance histogram integration
Oct 2, 2020
c57c89a
sqlib/sqtime: add a shared stopwatch
Oct 2, 2020
220fd2c
agent/rule/callback/waf: refactor the callbacks to the new native cal…
Oct 5, 2020
c11f415
agent/rule/callback: callback framework
Oct 9, 2020
d71cf72
agent: performance cap poc
Oct 12, 2020
5934786
go: update go-sdk to v1.2.0 including binning metrics
Oct 13, 2020
a794b40
agent: refactoring protection/agent interfaces
Oct 13, 2020
3e01632
agent/rule/callback: fix the callcount callback wrapper
Oct 15, 2020
2876050
sdk/middleware/sqecho/v4: update the middleware with the recent prote…
Oct 15, 2020
15ca756
agent/protection/http: fix tests
Oct 15, 2020
7583241
sdk/middleware: fix broken tests
Oct 19, 2020
6f337da
agent/protection/http: fix http protection tests
Oct 19, 2020
229e82c
agent/command: fix tests
Oct 19, 2020
70c0426
agent/backend/api: disable flaky fuzzing test
Oct 19, 2020
deb4bda
agent/rule/callback: fix callback tests
Oct 19, 2020
d264bb0
sqlib/sqtime: fix first/last start/stop race
Oct 20, 2020
f7414d1
agent/rule/callback/security-responses: fix blocking attack api
Oct 20, 2020
1caf4d2
agent/metrics: fix ongoing values handling
Oct 20, 2020
4d95c3a
agent/metrics: update metrics documentation
Oct 20, 2020
0869c28
agent/rule/callback: ignore the perf cap on critical callbacks
Oct 21, 2020
0df2594
agent/rule/callback: add tests of callback middlewares
Oct 22, 2020
fedf3fa
agent/rule/callback: fix go1.12 compilation error
Oct 22, 2020
6e0c42a
agent/rule/callback: try fix flaky windows test
Oct 22, 2020
1072066
agent/rule/callback: try fix flaky windows test
Oct 22, 2020
66d6f39
agent/metrics: add an extra test to try to find windows issue
Oct 22, 2020
8b3df8e
agent/metrics: try debug windows panic
Oct 22, 2020
bdf2d9b
agent/actors: try fix a flaky windows test by using the monotonic clock
Oct 22, 2020
2b73910
agent/metrics: fix max value when ongoing
Oct 22, 2020
41c8af8
agent/rule/waf: add some deadline checks to abort the waf when the de…
Oct 22, 2020
7c8604f
agent/metrics: remove debug block of code
Oct 22, 2020
e4f8db2
agent: performance monitoring
Oct 22, 2020
a542038
agent/rule/callback/monitor-http-status-code: add not_found attack
Oct 28, 2020
94a43cf
agent/rule: adapt to the new HandleAttack API
Oct 28, 2020
65f548a
agent/rule/callback/monitor-http-status-code: add tests
Oct 28, 2020
6e98daa
agent: enhance the event manager event throughtput
Oct 28, 2020
856c0a5
agent/rule/callback/monitor-http-status-code: add not_found events
Oct 29, 2020
7c8c77b
sdk/middleware/echo: fix status code monitoring of handler errors
Oct 30, 2020
344793d
sdk/middleware/echo: fix status code monitoring of handler errors
Oct 30, 2020
bb740d2
sqlib: error backoff logging
Nov 2, 2020
0b0339d
agent: backoff error logger integration
Nov 2, 2020
33c9148
agent: general fixes after overall dogfooding
Nov 3, 2020
f6e3046
agent: hot path error management
Nov 3, 2020
be1a2c6
sdk/middleware/sqgin: fix response's content-lenght monitoring
Nov 3, 2020
9a1e81d
sdk/middleware: add response monitoring tests
Nov 3, 2020
ce914a0
sdk/middleware/sqgin: response's content length monitoring
Nov 3, 2020
f6ddb94
agent/rule/callback/security-response: fix the event name and restore…
Nov 5, 2020
ecb633a
agent/rule/callback/security-responses: fix the event name of securit…
Nov 5, 2020
7067c0b
sdk: move to public interface API
Nov 5, 2020
a2837c6
sdk: interface-only public sdk api
Nov 6, 2020
9ff0c80
agent/rule/callback/binding-accessors/sql: unwrap the SQL driver befo…
Nov 10, 2020
204c448
agent/rule/callback/binding-accessors/sql: finer-grained SQL dialect …
Nov 10, 2020
f87a508
agent/rule/callback/binding-accessors/sql: unwrap the SQL driver befo…
Nov 12, 2020
b8d555a
sdk/middleware/sqhttp: transparent response writer wrapper
Nov 12, 2020
6f3abd2
sdk/middleware/{sqgin,sqecho}: response writer wrapper cleanup
Nov 12, 2020
58eeeae
agent/protection/http/binding-accessor: unalias url.Values to fix the…
Nov 17, 2020
b4824cc
sdk/middleware/sqhttp: transparent http response writer wrapper
Nov 17, 2020
9b0856e
agent/metrics: fix metrics regressions
Nov 18, 2020
d4c64f0
agent/path-passlist: fix the lookup by prefix rather than exact match
Nov 18, 2020
a0d8208
agent: fix the early logger log level
Nov 18, 2020
402e454
sdk: add FromRequest() function helper
Nov 18, 2020
ded1fbb
sdk: add FromRequest() helper
Nov 18, 2020
31ce2bb
repo: add v1.0.0 changelog
Nov 19, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/agent-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ jobs:
matrix:
runs-on: [ macos-latest, ubuntu-latest, windows-latest ]
go-version: [ 1, 1.15, 1.14, 1.13, 1.12 ]
go-test-options:
- ""
- "-tags sqassert -race"
fail-fast: false
runs-on: ${{ matrix.runs-on }}
steps:
Expand All @@ -17,7 +20,7 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- run: go test ./...
- run: go test ./... # note: do not support large number of goroutines for -race

# Same tests but on the official golang container for linux
# Docker for Windows is not yet available on Github Actions.
Expand All @@ -35,7 +38,7 @@ jobs:
# Install gcc and the libc headers on alpine images
- if: ${{ matrix.distribution == 'alpine' }}
run: apk add gcc musl-dev libc6-compat git
- run: go test ./...
- run: go test ${{ matrix.go-test-options }} ./...

# debian stretch doesn't have the latest go versions
golang-debian-stretch-container:
Expand All @@ -48,4 +51,4 @@ jobs:
image: golang:${{ matrix.go-version }}-stretch
steps:
- uses: actions/checkout@v2
- run: go test ./...
- run: go test ${{ matrix.go-test-options }} ./...
69 changes: 69 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [master, dev]
pull_request:
# The branches below must be a subset of the branches above
branches: [feature/*, fix/*, hotfix/*, release/*]

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['go']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
504 changes: 319 additions & 185 deletions CHANGELOG.md

Large diffs are not rendered by default.

145 changes: 0 additions & 145 deletions Makefile

This file was deleted.

80 changes: 41 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,64 +18,66 @@ Sqreen provides automatic defense against attacks:
- Protect with security modules: RASP (Runtime Application Self-Protection),
in-app WAF (Web Application Firewall), Account takeovers and more.

- Sqreen’s modules adapt to your application stack with no need of configuration.
- Sqreen’s modules adapt to your application stack with no need of
configuration.

- Prevent attacks from the OWASP Top 10 (Injections, XSS and more), 0-days,
data Leaks, and more.
- Create security automation playbooks that automatically react against
your advanced business-logic threats.
- Prevent attacks from the OWASP Top 10 (Injections, XSS and more), 0-days, data
Leaks, and more.

- Create security automation playbooks that automatically react against your
advanced business-logic threats.

For more details, visit [sqreen.com](https://www.sqreen.com/)

# Quick start

1. Use the middleware function for the Go web framework you use:
- [net/http](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqhttp)
- [Gin](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqgin)
- [Echo](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqecho/v4)
- [net/http](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqhttp)
- [Gin](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqgin)
- [Echo](https://godoc.org/github.com/sqreen/go-agent/sdk/middleware/sqecho/v4)

If your framework is not listed, it is usually possible to use instead the
standard `net/http` middleware. If not, please, let us know by [creating an
issue](http://github.com/sqreen/go-agent/issues/new).
standard `net/http` middleware. If not, please, let us know
by [creating an issue](http://github.com/sqreen/go-agent/issues/new).

1. Compile your program with Sqreen

Sqreen's dynamic configuration of your protection is made possible thanks to
Go instrumentation. It is safely performed at compilation time by the following
instrumentation tool.
Go instrumentation. It is safely performed at compilation time by the
following instrumentation tool.

Install the following instrumentation tool and compile your program using it
in order to enable Sqreen.

1. Use `go build` to download and compile the instrumentation tool:

```console
$ go build github.com/sqreen/go-agent/sdk/sqreen-instrumentation
```

1. Configure the Go toolchain to use it:

Use the instrumentation tool using the go options
`-a -toolexec /path/to/sqreen-instrumentation`.

It can be done either in your Go compilation command lines or by setting the
`GOFLAGS` environment variable.

For example, the following two commands are equivalent:
```console
$ go build -a -toolexec $PWD/sqreen-instrumentation-tool my-project
$ env GOFLAGS="-a -toolexec $PWD/sqreen-instrumentation-tool" go build my-project
```

1. [Signup to Sqreen](https://my.sqreen.io/signup) to get a token for your app,
and store it in the agent's configuration file `sqreen.yaml`:

1. Use `go install` to compile the instrumentation tool:
```console
$ go install github.com/sqreen/go-agent/sdk/sqreen-instrumentation-tool
```

By default, the resulting `sqreen-instrumentation-tool` tool is installed
in the
`bin` directory of the `GOPATH`. You can find it using `go env GOPATH`.

1. Configure the Go toolchain to use it:

Use the instrumentation tool using the go options
`-a -toolexec /path/to/sqreen-instrumentation-tool`.

It can be done either in your Go compilation command lines or by setting
the `GOFLAGS` environment variable.

For example, the following two commands are equivalent:
```console
$ go build -a -toolexec $(go env GOPATH)/bin/sqreen-instrumentation-tool my-project
$ env GOFLAGS="-a -toolexec $(go env GOPATH)/bin/sqreen-instrumentation-tool" go build my-project
```

1. [Signup to Sqreen](https://my.sqreen.io/signup) to get your app credentials:
```sh
app_name: Your Go app name
token: your token
```

This file can be stored in your current working directory when starting the
executable, the same directory as your app's executable file, or in any other
path by defining the configuration file location into the environment
Expand All @@ -87,9 +89,9 @@ Congratulations, your Go web application is now protected by Sqreen!
<img width="60%" src="./doc/images/blocking-page-with-gopher.png" alt="Sqreen for Go" title="Sqreen for Go" />
</p>


# Advanced integration

Optionally, use the SDK to perform [user monitoring](https://docs.sqreen.com/go/user-monitoring/)
Optionally, use the SDK to
perform [user monitoring](https://docs.sqreen.com/go/user-monitoring/)
or [custom security events](https://docs.sqreen.com/go/custom-events/) you would
like to track and possibly block.
Loading