Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter domains by rcode blocked pending status #4550

Merged
merged 4 commits into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions api/src/domain/inputs/domain-filter.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { GraphQLInputObjectType, GraphQLEnumType } from 'graphql'
import {
ComparisonEnums,
DomainOrderField,
DomainTagLabel,
StatusEnum,
} from '../../enums'
import { ComparisonEnums, DomainOrderField, DomainTagLabel, StatusEnum } from '../../enums'

const filterValueEnumsVals = {}
const filterValueEnums = [
...StatusEnum.getValues(),
...DomainTagLabel.getValues(),
]
const filterValueEnums = [...StatusEnum.getValues(), ...DomainTagLabel.getValues()]
filterValueEnums.forEach(
({ name, value, description }) =>
(filterValueEnumsVals[name] = {
Expand All @@ -21,8 +13,7 @@ filterValueEnums.forEach(

export const domainFilter = new GraphQLInputObjectType({
name: 'DomainFilter',
description:
'This object is used to provide filtering options when querying org-claimed domains.',
description: 'This object is used to provide filtering options when querying org-claimed domains.',
fields: () => ({
filterCategory: {
type: DomainOrderField,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,21 @@ export const loadDomainConnectionsByOrgId =
${domainFilters}
FILTER domain.archived ${comparison} true
`
} else if (filterValue === 'nxdomain') {
domainFilters = aql`
${domainFilters}
FILTER domain.rcode ${comparison} "NXDOMAIN"
`
} else if (filterValue === 'blocked') {
domainFilters = aql`
${domainFilters}
FILTER domain.blocked ${comparison} true
`
} else if (filterValue === 'scan-pending') {
domainFilters = aql`
${domainFilters}
FILTER domain.webScanPending ${comparison} true
`
} else {
domainFilters = aql`
${domainFilters}
Expand Down
18 changes: 14 additions & 4 deletions api/src/enums/domain-tag-label.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ export const DomainTagLabel = new GraphQLEnumType({
},
PROD: {
value: 'PROD',
description:
'Bilingual Label for tagging domains as a production environment.',
description: 'Bilingual Label for tagging domains as a production environment.',
},
STAGING: {
value: 'STAGING',
description:
'English label for tagging domains as a staging environment.',
description: 'English label for tagging domains as a staging environment.',
},
DEV: {
value: 'DÉV',
Expand Down Expand Up @@ -49,6 +47,18 @@ export const DomainTagLabel = new GraphQLEnumType({
value: 'archived',
description: 'English label for tagging domains that are archived.',
},
NXDOMAIN: {
value: 'nxdomain',
description: 'Label for tagging domains that have an rcode status of NXDOMAIN.',
},
BLOCKED: {
value: 'blocked',
description: 'Label for tagging domains that are possibly blocked by a firewall.',
},
SCAN_PENDING: {
value: 'scan-pending',
description: 'Label for tagging domains that have a pending web scan.',
},
},
description: 'An enum used to assign and test user-generated domain tags',
})
13 changes: 10 additions & 3 deletions frontend/src/domains/DomainsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,17 @@ export default function DomainsPage() {

<InfoPanel isOpen={isOpen} onToggle={onToggle}>
<InfoBox title={t`Domain`} info={t`The domain address.`} />
<InfoBox title={t`Ciphers`} info={t`Shows if the domain uses only ciphers that are strong or acceptable.`} />
<InfoBox title={t`Curves`} info={t`Shows if the domain uses only curves that are strong or acceptable.`} />
<InfoBox title={t`HSTS`} info={t`Shows if the domain meets the HSTS requirements.`} />
{/* Web statuses */}
<InfoBox
title={t`HTTPS`}
info={t`Shows if the domain meets the Hypertext Transfer Protocol Secure (HTTPS) requirements.`}
/>
<InfoBox title={t`HSTS`} info={t`Shows if the domain meets the HSTS requirements.`} />
<InfoBox title={t`Certificates`} info={t`Shows if the domain has a valid SSL certificate.`} />
<InfoBox title={t`Protocols`} info={t`Shows if the domain uses acceptable protocols.`} />
<InfoBox title={t`Ciphers`} info={t`Shows if the domain uses only ciphers that are strong or acceptable.`} />
<InfoBox title={t`Curves`} info={t`Shows if the domain uses only curves that are strong or acceptable.`} />
{/* Email statuses */}
<InfoBox title={t`SPF`} info={t`Shows if the domain meets the Sender Policy Framework (SPF) requirements.`} />
<InfoBox
title={t`DKIM`}
Expand All @@ -169,6 +172,10 @@ export default function DomainsPage() {
title={t`DMARC`}
info={t`Shows if the domain meets the Message Authentication, Reporting, and Conformance (DMARC) requirements.`}
/>
{/* Tags */}
<InfoBox title={t`NXDOMAIN`} info={t`Tag used to show domains that have an rcode status of NXDOMAIN`} />
<InfoBox title={t`BLOCKED`} info={t`Tag used to show domains that are possibly blocked by a firewall.`} />
<InfoBox title={t`SCAN PENDING`} info={t`Tag used to show domains that have a pending web scan.`} />
</InfoPanel>

<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
Expand Down
1 change: 1 addition & 0 deletions frontend/src/graphql/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ export const PAGINATED_ORG_DOMAINS = gql`
claimTags
hidden
archived
rcode
blocked
webScanPending
}
Expand Down
Loading