Documentation
¶
Index ¶
- func CheckAllowlist(r *api.Repo, allowlist []string) bool
- func Compress(level int, value []byte) ([]byte, error)
- func Decompress(value []byte) ([]byte, error)
- func Decrypt(key string, value []byte) ([]byte, error)
- func Encrypt(key string, value []byte) ([]byte, error)
- func EscapeValue(value string) string
- func FormParameter(c *gin.Context, parameter string) string
- func HandleError(c context.Context, status int, err error)
- func PathParameter(c *gin.Context, parameter string) string
- func QueryParameter(c *gin.Context, parameter, value string) string
- func Sanitize(field string) string
- func SplitFullName(value string) (string, string)
- func Unique(stringSlice []string) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAllowlist ¶ added in v0.20.0
CheckAllowlist is a helper function to ensure only repos in the allowlist are specified.
a single entry of '*' allows any repo to be enabled.
func Compress ¶ added in v0.26.0
Compress is a helper function to compress values. First, an empty buffer is created for storing compressed data. Then, a zlib writer, using the DEFLATE algorithm, is created with the provided compression level to output to this buffer. Finally, the provided value is compressed and written to the buffer and the writer is closed which flushes all bytes from the writer to the buffer.
func Decompress ¶ added in v0.26.0
Decompress is a helper function to decompress values. First, a buffer is created from the provided compressed data. Then, a zlib reader, using the DEFLATE algorithm, is created from the buffer as an input for reading data from the buffer. Finally, the data is decompressed and read from the buffer.
func Decrypt ¶ added in v0.24.0
Decrypt is a helper function to Decrypt values. First a AES-256 Galois Counter Mode cipher block is created from the encryption key to Decrypt the value. Then, we verify the value isn't smaller than the nonce which would indicate the value isn't encrypted. Finally the cipher block and nonce is used to Decrypt the value.
func Encrypt ¶ added in v0.24.0
Encrypt is a helper function to Encrypt values. First a AES-256 Galois Counter Mode cipher block is created from the encryption key to Encrypt the value. Then, we create the nonce from a cryptographically secure random number generator. Finally, the cipher block and nonce is used to Encrypt the value.
func EscapeValue ¶ added in v0.14.0
EscapeValue safely escapes any string by removing any new lines and HTML escaping it.
func FormParameter ¶ added in v0.14.0
FormParameter safely captures a form parameter from the context by removing any new lines and HTML escaping the value.
func HandleError ¶
HandleError appends the error to the handler chain for logging and outputs it.
func PathParameter ¶ added in v0.14.0
PathParameter safely captures a path parameter from the context by removing any new lines and HTML escaping the value.
func QueryParameter ¶ added in v0.14.0
QueryParameter safely captures a query parameter from the context by removing any new lines and HTML escaping the value.
func Sanitize ¶ added in v0.24.0
Sanitize is a helper function to verify the provided input field does not contain HTML content. If the input field does contain HTML, then the function will sanitize and potentially remove the HTML if deemed malicious.
func SplitFullName ¶ added in v0.20.0
SplitFullName safely splits the repo.FullName field into an org and name.
Types ¶
This section is empty.