Skip to content

Commit

Permalink
Don't accept files larger than 650MB for scanning.
Browse files Browse the repository at this point in the history
  • Loading branch information
plusvic committed May 28, 2021
1 parent 66c3316 commit 8ae1651
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion filescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func (s *FileScanner) Scan(r io.Reader, filename string, progress chan<- float32

w.Close()

if payloadSize > payloadMaxSize {

if payloadSize > maxFileSize {
return nil, fmt.Errorf("file size can't be larger than %d bytes", maxFileSize)
} else if payloadSize > maxPayloadSize {
// Payload is bigger than supported by AppEngine in a POST request,
// let's ask for an upload URL.
var u string
Expand Down
2 changes: 1 addition & 1 deletion monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (s *MonitorUploader) upload(r io.Reader, params map[string]string, progress

w.Close()

if payloadSize > payloadMaxSize {
if payloadSize > maxPayloadSize {
// Payload is bigger than supported by AppEngine in a POST request,
// let's ask for an upload URL.
var u string
Expand Down
5 changes: 4 additions & 1 deletion vt.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ const (
)

const (
payloadMaxSize = 30 * 1024 * 1024 // 30 MB
// Maximum size of payloads posted to VirusTotal's API endpoints.
maxPayloadSize = 30 * 1024 * 1024 // 30 MB
// Maximum file size that can scanned by VirusTotal.
maxFileSize = 650 * 1024 * 1024 // 650 MB
)

var baseURL = url.URL{
Expand Down

0 comments on commit 8ae1651

Please sign in to comment.