GithubHelp home page GithubHelp logo

go-directequality-checker's Introduction

go-directequality-checker

go-directequality-checker is a small tool that performs static analysis of a Go package to identify places where direct equality comparisons of fields are done when it isn't appropriate to do so. This is particularly useful if you're wanting to ensure that certain fields are only compared using constant-time comparison for security reasons.

Installation

Installing it is as simple as running

go get github.com/1password/go-directequality-checker

Usage

In order to use this tool, you'll first need to annotate a struct field that you want to designate as not being allowed to do direct equality comparisons with a tag: security:"nodirectequality"

Example:

type User struct {
    VerificationToken string `db:"verification_token" security:"nodirectequality"`
}

Once you've annotated your field, you can run the tool via

go-directequality-checker path/to/go/package

If the tool finds any direct equality comparisons, it will output information about what it has found and recommend using a constant time comparison function (i.e. crypto/subtle's ConstantTimeCompare):

[SECURITY] Found raw comparison of field 'VerificationToken'. Use constant time comparison function.
/Users/rfillion/go/src/go.1password.io/b5/server/src/logic/action/transfer.go:106
user.VerificationToken == token {

go-directequality-checker's People

Contributors

rickfillion avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.