Skip to content

Commit

Permalink
Referrer Policy is added
Browse files Browse the repository at this point in the history
  • Loading branch information
Slepnev authored and Slepnev committed Oct 2, 2019
1 parent 8b769cb commit 13812e8
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ results
settings.json
sql_config.json
*.exe
*.txt
*.txt
.idea/
.vscode/
3 changes: 3 additions & 0 deletions apis/observatory/Observatory.sql
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ CREATE TABLE [ObservatoryV10](
[XFrameOptionsPassed] [bit] NULL,
[XFrameOptionsResult] [nvarchar](100) NULL,
[XFrameOptionsDesc] [nvarchar](250) NULL,
[ReferrerPolicyPassed] [bit] NULL,
[ReferrerPolicyDesc] [nvarchar](100) NULL,
[ReferrerPolicyResult] [nvarchar](250) NULL,
CONSTRAINT [PK_ObservatoryV10] PRIMARY KEY CLUSTERED
(
[ScanID] ASC,
Expand Down
26 changes: 26 additions & 0 deletions apis/observatory/observatory.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,11 @@ type TableRow struct {
XXSSProtectionDesc string

ScanStatus int

//referrer-policy
ReferrerPolicyPassed bool
ReferrerPolicyResult string
ReferrerPolicyDesc string
}

// maximum Number of parallel Scans
Expand Down Expand Up @@ -312,6 +317,21 @@ type ScanResults struct {
ScoreDescription string `json:"score_description"`
ScoreModifier int `json:"score_modifier"`
} `json:"x-xss-protection"`

//referrer-policy
ReferrerPolicy struct{
Expectation string `json:"expectation"`
Name string `json:"name"`
Output struct {
Data interface{} `json:"data"`
Http bool `json:"http"`
Meta bool `json:"meta"`
} `json:"output"`
Pass bool `json:"pass"`
Result string `json:"result"`
ScoreDescription string `json:"score_description"`
ScoreModifier int `json:"score_modifier"`
} `json:"referrer-policy"`
}

// invokeObservatoryAnalyzation starts an HTTP-Observatory assessment and polls
Expand Down Expand Up @@ -524,6 +544,12 @@ func parseResult(obsResult ScanResults, obsAnaly AnalyzeResult) TableRow {
row.XXSSProtectionPassed = obsResult.XXSSProtection.Pass
row.XXSSProtectionDesc = hooks.Truncate(obsResult.XXSSProtection.ScoreDescription, 250)
row.XXSSProtectionResult = hooks.Truncate(obsResult.XXSSProtection.Result, 100)

//referrer-policy
row.ReferrerPolicyPassed = obsResult.ReferrerPolicy.Pass
row.ReferrerPolicyDesc = hooks.Truncate(obsResult.ReferrerPolicy.ScoreDescription, 250)
row.ReferrerPolicyResult = hooks.Truncate(obsResult.ReferrerPolicy.Result, 100)

return row
}

Expand Down

0 comments on commit 13812e8

Please sign in to comment.