Skip to content

Commit

Permalink
initial updates related to OAM v0.13.0
Browse files Browse the repository at this point in the history
  • Loading branch information
caffix committed Feb 4, 2025
1 parent 35bad0a commit b2ebc0a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions engine/sessions/scope/assoc.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand All @@ -18,10 +18,10 @@ import (
oam "github.com/owasp-amass/open-asset-model"
oamcert "github.com/owasp-amass/open-asset-model/certificate"
"github.com/owasp-amass/open-asset-model/contact"
"github.com/owasp-amass/open-asset-model/dns"

Check failure on line 21 in engine/sessions/scope/assoc.go

View workflow job for this annotation

GitHub Actions / Coverage

no required module provides package github.com/owasp-amass/open-asset-model/dns; to add it:

Check failure on line 21 in engine/sessions/scope/assoc.go

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, 1.23.1)

no required module provides package github.com/owasp-amass/open-asset-model/dns; to add it:
oamnet "github.com/owasp-amass/open-asset-model/network"
"github.com/owasp-amass/open-asset-model/org"
oamreg "github.com/owasp-amass/open-asset-model/registration"
"github.com/owasp-amass/open-asset-model/relation"
oamurl "github.com/owasp-amass/open-asset-model/url"
"golang.org/x/net/publicsuffix"
)
Expand All @@ -40,7 +40,7 @@ func (s *Scope) IsAssociated(c *cache.Cache, req *Association) ([]*Association,
return nil, errors.New("invalid request")
}
if atype := req.Submission.Asset.AssetType(); atype != oam.FQDN &&
atype != oam.EmailAddress && atype != oam.Organization && atype != oam.Location {
atype != oam.Identifier && atype != oam.Organization && atype != oam.Location {

Check failure on line 43 in engine/sessions/scope/assoc.go

View workflow job for this annotation

GitHub Actions / Lint (ubuntu-latest, 1.23.1)

undefined: oam.Identifier (typecheck)
return nil, errors.New("the request included a submission with an unsupported asset type")
}

Expand Down Expand Up @@ -378,7 +378,7 @@ func (s *Scope) IsAddressInScope(c *cache.Cache, ip *oamnet.IPAddress) bool {

if edges, err := c.IncomingEdges(addr, c.StartTime(), "dns_record"); err == nil && len(edges) > 0 {
for _, edge := range edges {
if rec, ok := edge.Relation.(*relation.BasicDNSRelation); ok && rec.Header.RRType == rtype {
if rec, ok := edge.Relation.(*dns.BasicDNSRelation); ok && rec.Header.RRType == rtype {
from, err := c.FindEntityById(edge.FromEntity.ID)
if err != nil {
continue
Expand Down
16 changes: 8 additions & 8 deletions engine/sessions/scope/domains.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand All @@ -8,11 +8,11 @@ import (
"strings"

oam "github.com/owasp-amass/open-asset-model"
"github.com/owasp-amass/open-asset-model/domain"
"github.com/owasp-amass/open-asset-model/dns"
"golang.org/x/net/publicsuffix"
)

func (s *Scope) AddFQDN(fqdn *domain.FQDN) bool {
func (s *Scope) AddFQDN(fqdn *dns.FQDN) bool {
if fqdn.Name == "" {
return false
}
Expand All @@ -34,16 +34,16 @@ func (s *Scope) AddFQDN(fqdn *domain.FQDN) bool {
}

func (s *Scope) AddDomain(d string) bool {
return s.AddFQDN(&domain.FQDN{Name: strings.ToLower(strings.TrimSpace(d))})
return s.AddFQDN(&dns.FQDN{Name: strings.ToLower(strings.TrimSpace(d))})
}

func (s *Scope) FQDNs() []*domain.FQDN {
func (s *Scope) FQDNs() []*dns.FQDN {
s.domLock.Lock()
defer s.domLock.Unlock()

var results []*domain.FQDN
var results []*dns.FQDN
for _, v := range s.domains {
if fqdn, ok := v.(*domain.FQDN); ok {
if fqdn, ok := v.(*dns.FQDN); ok {
results = append(results, fqdn)
}
}
Expand All @@ -61,7 +61,7 @@ func (s *Scope) Domains() []string {
return results
}

func (s *Scope) matchesDomain(fqdn *domain.FQDN) (oam.Asset, int) {
func (s *Scope) matchesDomain(fqdn *dns.FQDN) (oam.Asset, int) {
s.domLock.Lock()
defer s.domLock.Unlock()

Expand Down
2 changes: 1 addition & 1 deletion engine/sessions/scope/locations.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion engine/sessions/scope/networks.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand Down
2 changes: 1 addition & 1 deletion engine/sessions/scope/orgs.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand Down
22 changes: 11 additions & 11 deletions engine/sessions/scope/scope.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand All @@ -11,7 +11,7 @@ import (
oam "github.com/owasp-amass/open-asset-model"
oamcert "github.com/owasp-amass/open-asset-model/certificate"
"github.com/owasp-amass/open-asset-model/contact"
"github.com/owasp-amass/open-asset-model/domain"
"github.com/owasp-amass/open-asset-model/dns"
oamnet "github.com/owasp-amass/open-asset-model/network"
"github.com/owasp-amass/open-asset-model/org"
oamreg "github.com/owasp-amass/open-asset-model/registration"
Expand All @@ -22,10 +22,10 @@ func (s *Scope) Add(a oam.Asset) bool {
var newentry bool

switch v := a.(type) {
case *domain.FQDN:
case *dns.FQDN:
newentry = s.AddFQDN(v)
case *contact.EmailAddress:
newentry = s.AddFQDN(&domain.FQDN{Name: v.Domain})
/*case *contact.EmailAddress:
newentry = s.AddFQDN(&domain.FQDN{Name: v.Domain})*/
case *oamnet.IPAddress:
newentry = s.AddIPAddress(v)
case *oamnet.Netblock:
Expand Down Expand Up @@ -62,18 +62,18 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
var match oam.Asset

switch v := a.(type) {
case *domain.FQDN:
case *dns.FQDN:
match, accuracy = s.matchesDomain(v)
case *contact.EmailAddress:
match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.Domain})
/*case *contact.EmailAddress:
match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.Domain})*/
case *oamnet.IPAddress:
match, accuracy = s.addressInScope(v)
case *oamnet.Netblock:
match, accuracy = s.matchesNetblock(v)
case *oamnet.AutonomousSystem:
match, accuracy = s.matchesAutonomousSystem(v)
case *oamreg.DomainRecord:
match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.Domain})
match, accuracy = s.matchesDomain(&dns.FQDN{Name: v.Domain})
if match == nil || accuracy == 0 {
match, accuracy = s.matchesOrg(&org.Organization{Name: v.Name}, conf)
}
Expand All @@ -85,9 +85,9 @@ func (s *Scope) IsAssetInScope(a oam.Asset, conf int) (oam.Asset, int) {
match, accuracy = s.matchesOrg(&org.Organization{Name: v.Name}, conf)
}
case *oamcert.TLSCertificate:
match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.SubjectCommonName})
match, accuracy = s.matchesDomain(&dns.FQDN{Name: v.SubjectCommonName})
case *oamurl.URL:
match, accuracy = s.matchesDomain(&domain.FQDN{Name: v.Host})
match, accuracy = s.matchesDomain(&dns.FQDN{Name: v.Host})
case *org.Organization:
match, accuracy = s.matchesOrg(v, conf)
case *contact.Location:
Expand Down
2 changes: 1 addition & 1 deletion engine/sessions/scope/type.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © by Jeff Foley 2017-2024. All rights reserved.
// Copyright © by Jeff Foley 2017-2025. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
// SPDX-License-Identifier: Apache-2.0

Expand Down

0 comments on commit b2ebc0a

Please sign in to comment.