@@ -18,7 +18,7 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
1818*/
1919
2020import type { ComponentType , ExternalReferenceType , HashAlgorithm , Vulnerability } from '../enums'
21- import type { HashContent } from '../models'
21+ import { type HashContent , NamedLicense , SpdxLicense } from '../models'
2222import type { Format , Version } from './enums'
2323
2424/**
@@ -79,6 +79,7 @@ export class _Spec implements _SpecProtocol {
7979 readonly #supportsLicenseAcknowledgement: boolean
8080 readonly #supportsServices: boolean
8181 readonly #supportsToolsComponentsServices: boolean
82+ readonly #supportsLicenseProperties: boolean
8283
8384 /* eslint-disable-next-line @typescript-eslint/max-params -- architectural decision */
8485 constructor (
@@ -101,7 +102,8 @@ export class _Spec implements _SpecProtocol {
101102 supportsExternalReferenceHashes : boolean ,
102103 supportsLicenseAcknowledgement : boolean ,
103104 supportsServices : boolean ,
104- supportsToolsComponentsServices : boolean
105+ supportsToolsComponentsServices : boolean ,
106+ supportsLicenseProperties : boolean
105107 ) {
106108 this . #version = version
107109 this . #formats = new Set ( formats )
@@ -123,6 +125,7 @@ export class _Spec implements _SpecProtocol {
123125 this . #supportsLicenseAcknowledgement = supportsLicenseAcknowledgement
124126 this . #supportsServices = supportsServices
125127 this . #supportsToolsComponentsServices = supportsToolsComponentsServices
128+ this . #supportsLicenseProperties = supportsLicenseProperties
126129 }
127130
128131 get version ( ) : Version {
@@ -166,9 +169,13 @@ export class _Spec implements _SpecProtocol {
166169 return this . #requiresComponentVersion
167170 }
168171
169- supportsProperties ( ) : boolean {
170- // currently a global allow/deny -- might work based on input, in the future
171- return this . #supportsProperties
172+ supportsProperties ( model : any ) : boolean {
173+ switch ( true ) {
174+ case model instanceof NamedLicense || model instanceof SpdxLicense :
175+ return this . #supportsLicenseProperties
176+ default :
177+ return this . #supportsProperties
178+ }
172179 }
173180
174181 get supportsVulnerabilities ( ) : boolean {
0 commit comments