mirror of
https://github.com/github/codeql.git
synced 2026-01-29 22:32:58 +01:00
Add getHeaderValue predicate to HTTP::HeaderWrite
This commit is contained in:
@@ -64,10 +64,17 @@ module HTTP {
|
||||
/** Gets the (lower-case) name of a header set by this definition. */
|
||||
string getHeaderName() { result = this.getName().getStringValue().toLowerCase() }
|
||||
|
||||
/** Gets the value of the header set by this definition. */
|
||||
string getHeaderValue() {
|
||||
result = this.getValue().getStringValue()
|
||||
or
|
||||
result = this.getValue().getIntValue().toString()
|
||||
}
|
||||
|
||||
/** Holds if this header write defines the header `header`. */
|
||||
predicate definesHeader(string header, string value) {
|
||||
header = this.getHeaderName() and
|
||||
value = this.getValue().getStringValue()
|
||||
value = this.getHeaderValue()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,6 +108,9 @@ module HTTP {
|
||||
/** Gets the (lower-case) name of a header set by this definition. */
|
||||
string getHeaderName() { result = self.getHeaderName() }
|
||||
|
||||
/** Gets the value of the header set by this definition. */
|
||||
string getHeaderValue() { result = self.getHeaderValue() }
|
||||
|
||||
/** Holds if this header write defines the header `header`. */
|
||||
predicate definesHeader(string header, string value) { self.definesHeader(header, value) }
|
||||
|
||||
|
||||
@@ -108,9 +108,7 @@ module NetHttp {
|
||||
|
||||
override string getHeaderName() { result = "status" }
|
||||
|
||||
override predicate definesHeader(string header, string value) {
|
||||
header = "status" and value = this.getValue().getIntValue().toString()
|
||||
}
|
||||
override string getHeaderValue() { result = this.getValue().getIntValue().toString() }
|
||||
|
||||
override DataFlow::Node getName() { none() }
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ package main
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"html"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/html"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user