-
-
-
Evaluates remote access security requirements and potential exposure to external threats.
+
+
+
+
+
Evaluates remote access security requirements and potential
+ exposure to external threats.
-
-
-
-
Assesses supply chain risk and the need for vendor security management.
+
+
+
+
+
Assesses supply chain risk and the need for vendor security
+ management.
-
-
-
-
Determines the need for secure development practices and application security measures.
+
+
+
+
+
Determines the need for secure development practices and
+ application security measures.
-
+
+
+
+
+
+
+
+
+
Determines exposure to different cybersecurity
+ regulations.
+
+
+
+
+
+
+
+
Assesses potential impact of data breaches.
+
+
+
+
+
+
+
+
+
Defines data protection requirements.
+
+
+
+
+
+
+
+
+
Indicates the variety of systems requiring
+ protection.
+
+
+
+
+
+
+
+
Assesses third-party cybersecurity risks.
+
+
+
+
+
+
+
+
Determines specific cybersecurity controls.
+
+
+
+
+
+
+
+
Evaluates cybersecurity needs based on IP
+ ownership.
+
+
+
+
+
+
+
+
Identifies required compliance frameworks.
+
+
+
+
+
+
+
+
Evaluates potential for cascade failures.
+
+
+
+
+
+
+
+
Determines the scope of remote access security
+ requirements.
+
+
+
+
+
+
+
@@ -178,5 +704,5 @@
{{end}}
{{define "bottom"}}
-
-{{end}}
\ No newline at end of file
+
+{{end}}
diff --git a/db/advancedProfile.go b/db/advancedProfile.go
new file mode 100644
index 0000000..0a85da0
--- /dev/null
+++ b/db/advancedProfile.go
@@ -0,0 +1,43 @@
+package db
+
+type AdvancedProfile struct {
+ CompanyId int
+ GeographicDistribution string
+ CustomerConcentration string
+ ProductServicePortfolio string
+ OrganizationalCulture string
+ SupplierDiversity string
+ TechnologicalInfrastructure string
+ IntellectualProperty string
+ ManagementTeamExperience string
+}
+
+// InsertAdvancedProfile inserts a new record into the AdvancedProfile table
+func InsertAdvancedProfile(profile AdvancedProfile) (int, error) {
+ query := `
+ INSERT INTO AdvancedProfile (
+ CompanyId, GeographicDistribution, CustomerConcentration, ProductServicePortfolio, OrganizationalCulture,
+ SupplierDiversity, TechnologicalInfrastructure, IntellectualProperty, ManagementTeamExperience
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
+ RETURNING id
+ `
+
+ stmt, err := db.Prepare(query)
+ if err != nil {
+ return -2, err
+ }
+ defer stmt.Close()
+
+ id := 0
+ err = stmt.QueryRow(
+ profile.CompanyId, profile.GeographicDistribution, profile.CustomerConcentration, profile.ProductServicePortfolio,
+ profile.OrganizationalCulture, profile.SupplierDiversity, profile.TechnologicalInfrastructure, profile.IntellectualProperty,
+ profile.ManagementTeamExperience,
+ ).Scan(&id)
+
+ if err != nil {
+ return -1, err
+ }
+
+ return id, nil
+}
diff --git a/db/basicProfile.go b/db/basicProfile.go
index 0d349fe..5b5c1d6 100644
--- a/db/basicProfile.go
+++ b/db/basicProfile.go
@@ -1,24 +1,36 @@
package db
type BasicProfile struct {
- CompanyId int
- Employees string
- Revenue string
- Applications string
- Compliance string
- Industry string
- ITDependency string
- DataSensitivity string
- DataVolume string
- NetworkSegmentation string
- LegacySystems string
- IoTIntegration string
- RemoteWork string
- BYOD string
- VPN string
- API string
- VendorAccess string
- InternalDev string
+ CompanyId int // Company ID (foreign key reference)
+ Employees string // Current employee headcount
+ Revenue string // Annual revenue range
+ Applications string // Critical business applications
+ Compliance string // Regulatory frameworks
+ Industry string // Primary industry sector
+ ITDependency string // Technology dependency
+ DataSensitivity string // Sensitive data level
+ DataVolume string // Data volume (if applicable)
+ NetworkSegmentation string // Network infrastructure model
+ LegacySystems string // Legacy systems (if applicable)
+ IoTIntegration string // IoT integration (if applicable)
+ RemoteWork string // Remote work details
+ BYOD string // Bring Your Own Device policy
+ VPN string // VPN usage policy
+ API string // API integration (if applicable)
+ VendorAccess string // Third-party vendor access
+ InternalDev string // Internal software development activities
+
+ // New fields from the advanced form
+ GeoScope string // Geographic operational scope
+ CustomerBase string // Customer base distribution
+ CustomerType string // Primary customer type
+ ProductPortfolio string // Product/service portfolio
+ SupplierBase string // Supplier base structure
+ ITInfrastructure string // IT infrastructure model (comma-separated values)
+ IPProtection string // Intellectual property protection (comma-separated values)
+ SensitiveData string // Sensitive data types (comma-separated values)
+ IntegrationLevel string // Integration level of business systems
+ RemotePolicy string // Remote work policy
}
// InsertBasicProfile inserts a new record into the BasicProfile table
diff --git a/db/db.go b/db/db.go
index bb41825..35613a3 100644
--- a/db/db.go
+++ b/db/db.go
@@ -26,7 +26,8 @@ func InitDB() {
}
func createTables() {
- companyTable := `
+ tables := []string{
+ `
CREATE TABLE IF NOT EXISTS Company (
id INTEGER PRIMARY KEY AUTOINCREMENT,
UUID TEXT NOT NULL,
@@ -34,9 +35,9 @@ func createTables() {
TaxId TEXT NOT NULL,
Email TEXT NOT NULL,
Password TEXT NOT NULL
- );`
+ );`,
- basicProfileTable := `
+ `
CREATE TABLE IF NOT EXISTS BasicProfile (
id INTEGER PRIMARY KEY AUTOINCREMENT,
CompanyId INTEGER,
@@ -57,37 +58,33 @@ func createTables() {
API TEXT,
VendorAccess TEXT,
InternalDev TEXT,
+ GeoScope TEXT, -- Geographic operational scope
+ CustomerBase TEXT, -- Customer base distribution
+ CustomerType TEXT, -- Primary customer type
+ ProductPortfolio TEXT, -- Product/service portfolio
+ SupplierBase TEXT, -- Supplier base structure
+ ITInfrastructure TEXT, -- IT infrastructure model (comma-separated values)
+ IPProtection TEXT, -- Intellectual property protection (comma-separated values)
+ SensitiveData TEXT, -- Sensitive data types (comma-separated values)
+ IntegrationLevel TEXT, -- Integration level of business systems
+ RemotePolicy TEXT, -- Remote work policy
FOREIGN KEY (CompanyId) REFERENCES Company(id)
- );`
+ );`,
- advancedProfileTable := `
- CREATE TABLE IF NOT EXISTS AdvancedProfile (
+ `CREATE TABLE IF NOT EXISTS Session (
id INTEGER PRIMARY KEY AUTOINCREMENT,
- CompanyId INTEGER,
- GeographicDistribution TEXT,
- CustomerConcentration TEXT,
- ProductServicePortfolio TEXT,
- OrganizationalCulture TEXT,
- SupplierDiversity TEXT,
- TechnologicalInfrastructure TEXT,
- IntellectualProperty TEXT,
- ManagementTeamExperience TEXT,
- FOREIGN KEY (CompanyId) REFERENCES Company(id)
- );`
+ key TEXT NOT NULL,
+ value TEXT NOT NULL
+ );`,
- _, err := db.Exec(companyTable)
- if err != nil {
- log.Fatalf("Error creating Company table: %v", err)
+ `CREATE INDEX IF NOT EXISTS idx_session_key ON Session(key);`,
}
- _, err = db.Exec(basicProfileTable)
- if err != nil {
- log.Fatalf("Error creating BasicProfile table: %v", err)
- }
-
- _, err = db.Exec(advancedProfileTable)
- if err != nil {
- log.Fatalf("Error creating AdvancedProfile table: %v", err)
+ for _, table := range tables {
+ _, err := db.Exec(table)
+ if err != nil {
+ log.Fatalf("Error creating table: %v", err)
+ }
}
}
diff --git a/db/utils.go b/db/utils.go
index b3ea3ab..b8b1a9b 100644
--- a/db/utils.go
+++ b/db/utils.go
@@ -1,16 +1,23 @@
package db
import (
- "math/rand"
+ "crypto/rand"
+ "log"
+ "math/big"
)
-var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")
+var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
func GenerateRandomString() string {
- const n = 25
+ const n = 38
b := make([]rune, n)
for i := range b {
- b[i] = letters[rand.Intn(len(letters))]
+ num, err := rand.Int(rand.Reader, big.NewInt(int64(len(letters))))
+ if err != nil {
+ log.Println("Error generating random string: ", err)
+ continue
+ }
+ b[i] = letters[num.Int64()]
}
return string(b)
}