mirror of
https://github.com/projectdiscovery/nuclei
synced 2026-06-08 16:50:47 +00:00
50996a7481
Prev. project keyed cache lookups from dumped HTTP
request bytes alone. For eq requests, this allowed
"http" and "https" targets to collide and reuse
cached responses across schemes.
Derive a scoped cache key by prefixing normalized
scheme://host before `projectfile.{Get,Set}`
keying input in the HTTP protocol path.
Close #6866
Signed-off-by: Dwi Siswanto <git@dw1.io>
20 lines
559 B
Go
20 lines
559 B
Go
package http
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGetHTTPProjectCacheScope_SeparatesSchemeAndPort(t *testing.T) {
|
|
requestDump := []byte("GET / HTTP/1.1\r\nHost: example.com\r\n\r\n")
|
|
|
|
httpScoped := getHTTPProjectCacheScope(requestDump, "http", "example.com:80")
|
|
httpsScoped := getHTTPProjectCacheScope(requestDump, "https", "example.com:443")
|
|
|
|
require.NotEqual(t, httpScoped, httpsScoped)
|
|
require.True(t, bytes.HasSuffix(httpScoped, requestDump))
|
|
require.True(t, bytes.HasSuffix(httpsScoped, requestDump))
|
|
}
|