https://github.com/c1982/secureimage
Small image verification package for Go
https://github.com/c1982/secureimage
golang image security upload verification
Last synced: 5 months ago
JSON representation
Small image verification package for Go
- Host: GitHub
- URL: https://github.com/c1982/secureimage
- Owner: c1982
- License: mit
- Created: 2018-05-03T12:08:00.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-28T22:59:45.000Z (about 6 years ago)
- Last Synced: 2024-06-20T11:54:38.298Z (almost 2 years ago)
- Topics: golang, image, security, upload, verification
- Language: Go
- Homepage:
- Size: 608 KB
- Stars: 22
- Watchers: 6
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# secureimage
TR: Go web uygulamalarında upload edilen resim dosyalarının güvenilir olup, olmadığını kontrol eden küçük bir doğrulama paketidir.
Bu paket sadece gif, jpeg ve png dosya formatlarını doğrular.
EN: This is a small verification package that checks whether image files uploaded in Go web applications are reliable.
This package only supports gif, jpeg and png file formats.
## Install
```bash
go get github.com/c1982/secureimage
```
## Usage
```go
package main
import (
"fmt"
"os"
"github.com/c1982/secureimage"
)
func main() {
trusted, err := secureimage.Check("./uploads/tmp_test.jpg")
if err != nil {
panic(err)
}
if trusted {
fmt.Println("file is trusted.")
} else {
fmt.Println("bad file")
}
}
```
## Todos
- [x] Magic Bytes check
- [x] Validate image file format
- [x] Clean exif data in jpeg format
## Credits
* [Oğuzhan](https://github.com/c1982)
## License
The MIT License (MIT) - see LICENSE.md for more details