Skip to content
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
24 changes: 24 additions & 0 deletions .github/workflows/typos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Spell check with typos

on:
push:
branches: ["main"]
pull_request:
branches: ["**"]

permissions: {}

jobs:
typos:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Run typos
uses: crate-ci/typos@d43b6c087ac471e2ea7b8af622ff15f05c0c365b # v1.50.1

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ buildx-machine:
docker buildx create --name=$(MACHINE) --platform=$(DEFAULT_PLATFORMS)

test-image:
# Instead of loading image, target all platforms, effectivelly testing
# Instead of loading image, target all platforms, effectively testing
# the build for the target architectures.
$(MAKE) build-image BUILD_ACTION="--platform=$(TARGET_PLATFORMS)"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ case class PolicyOutput(
applicationsInPolicy: List[(String, Int)]
)
/*=========================================
For new dashbaord API
For new dashboard API
=========================================*/
case class DashboardNotificationDTO(
criticalSecurityEvents: CriticalSecurityEventDTO,
Expand Down Expand Up @@ -945,7 +945,7 @@ object DashboardJsonProtocol extends DefaultJsonProtocol with LazyLogging {
)

/*=========================================
For new dashbaord API
For new dashboard API
=========================================*/

given podFormat: RootJsonFormat[Pod] = jsonFormat7(Pod.apply)
Expand Down
36 changes: 26 additions & 10 deletions admin/src/main/scala/com/neu/model/SystemConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,38 @@ package com.neu.model
/**
* Created by bxu on 4/28/16.
*/
case class RegistyHttpProxy(url: String, username: String, password: Option[String])
case class RegistyHttpsProxy(url: String, username: String, password: Option[String])
case class RegistyHttpProxyCfg(
case class RegistryHttpProxy(url: String, username: String, password: Option[String])
case class RegistryHttpsProxy(url: String, username: String, password: Option[String])
case class RegistryHttpProxyCfg(
url: Option[String],
username: Option[String],
password: Option[String]
)
case class RegistyHttpsProxyCfg(
case class RegistryHttpsProxyCfg(
url: Option[String],
username: Option[String],
password: Option[String]
)
case class Webhook(
name: String,
url: String,
enable: Boolean,
use_proxy: Boolean,
`type`: String,
cfg_type: String,
username: Option[String] = None,
password: Option[String] = None
)

case class MaskedWebhook(
name: String,
url: String,
enable: Boolean,
use_proxy: Boolean,
`type`: String,
cfg_type: String
)

case class RemoteRepository(
nickname: String,
provider: String,
Expand Down Expand Up @@ -71,8 +83,8 @@ case class SystemConfig(
webhooks: Option[Array[Webhook]] = None,
cluster_name: Option[String] = None,
auth_by_platform: Option[Boolean] = None,
registry_http_proxy: Option[RegistyHttpProxy] = None,
registry_https_proxy: Option[RegistyHttpsProxy] = None,
registry_http_proxy: Option[RegistryHttpProxy] = None,
registry_https_proxy: Option[RegistryHttpsProxy] = None,
registry_http_proxy_status: Option[Boolean] = None,
registry_https_proxy_status: Option[Boolean] = None,
xff_enabled: Option[Boolean] = None,
Expand Down Expand Up @@ -128,10 +140,10 @@ case class SystemConfigAuthCfgV2(
case class SystemConfigProxyCfgV2(
registry_http_proxy_status: Option[Boolean] = None,
registry_https_proxy_status: Option[Boolean] = None,
registry_http_proxy: Option[RegistyHttpProxy] = None,
registry_https_proxy: Option[RegistyHttpsProxy] = None,
registry_http_proxy_cfg: Option[RegistyHttpProxyCfg] = None,
registry_https_proxy_cfg: Option[RegistyHttpsProxyCfg] = None
registry_http_proxy: Option[RegistryHttpProxy] = None,
registry_https_proxy: Option[RegistryHttpsProxy] = None,
registry_http_proxy_cfg: Option[RegistryHttpProxyCfg] = None,
registry_https_proxy_cfg: Option[RegistryHttpsProxyCfg] = None
)

case class SystemConfigIBMSAVCfg2(
Expand Down Expand Up @@ -186,6 +198,10 @@ case class WebhookConfigWrap(
config: Webhook
)

case class MaskedWebhookConfigWrap(
config: MaskedWebhook
)

case class SystemConfig4DashboardWrap(
config: SystemConfig4Dashboard,
error: Option[Error]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ import spray.json.*
*/
object SystemConfigJsonProtocol extends DefaultJsonProtocol {
given errorFormat: RootJsonFormat[Error] = jsonFormat1(Error.apply)
given registyHttpsProxyFormat: RootJsonFormat[RegistyHttpsProxy] = jsonFormat3(
RegistyHttpsProxy.apply
given registryHttpsProxyFormat: RootJsonFormat[RegistryHttpsProxy] = jsonFormat3(
RegistryHttpsProxy.apply
)
given registyHttpProxyFormat: RootJsonFormat[RegistyHttpProxy] = jsonFormat3(
RegistyHttpProxy.apply
given registryHttpProxyFormat: RootJsonFormat[RegistryHttpProxy] = jsonFormat3(
RegistryHttpProxy.apply
)
given registyHttpsProxyCfgFormat: RootJsonFormat[RegistyHttpsProxyCfg] = jsonFormat3(
RegistyHttpsProxyCfg.apply
given registryHttpsProxyCfgFormat: RootJsonFormat[RegistryHttpsProxyCfg] = jsonFormat3(
RegistryHttpsProxyCfg.apply
)
given registyHttpProxyCfgFormat: RootJsonFormat[RegistyHttpProxyCfg] = jsonFormat3(
RegistyHttpProxyCfg.apply
given registryHttpProxyCfgFormat: RootJsonFormat[RegistryHttpProxyCfg] = jsonFormat3(
RegistryHttpProxyCfg.apply
)
given githubConfigurationFormat: RootJsonFormat[GithubConfiguration] = jsonFormat6(
GithubConfiguration.apply
)
given azureDevopsConfigurationFormat: RootJsonFormat[AzureDevopsConfiguration] = jsonFormat5(
AzureDevopsConfiguration.apply
)
given webhookFormat: RootJsonFormat[Webhook] = jsonFormat6(Webhook.apply)
given webhookFormat: RootJsonFormat[Webhook] = jsonFormat8(Webhook.apply)
given remoteRepoFormat: RootJsonFormat[RemoteRepository] = jsonFormat6(RemoteRepository.apply)
given remoteRepositoryWrapFormat: RootJsonFormat[RemoteRepositoryWrap] = jsonFormat1(
RemoteRepositoryWrap.apply
Expand All @@ -52,6 +52,11 @@ object SystemConfigJsonProtocol extends DefaultJsonProtocol {
WebhookConfigWrap.apply
)

given MaskedWebhookFormat: RootJsonFormat[MaskedWebhook] = jsonFormat6(MaskedWebhook.apply)
given MaskedWebhookConfigWrapFormat: RootJsonFormat[MaskedWebhookConfigWrap] = jsonFormat1(
MaskedWebhookConfigWrap.apply
)

given systemConfigSvcCfgV2Format: RootJsonFormat[SystemConfigSvcCfgV2] = jsonFormat3(
SystemConfigSvcCfgV2.apply
)
Expand Down Expand Up @@ -104,6 +109,9 @@ object SystemConfigJsonProtocol extends DefaultJsonProtocol {
def webhookConfigWrapToJson(webhookConfigWrap: WebhookConfigWrap): String =
webhookConfigWrap.toJson.compactPrint

def maskedWebhookConfigWrapToJson(maskedWebhookConfigWrap: MaskedWebhookConfigWrap): String =
maskedWebhookConfigWrap.toJson.compactPrint

def remoteRepositoryToJson(remoteRepository: RemoteRepository): String =
remoteRepository.toJson.compactPrint

Expand Down
2 changes: 1 addition & 1 deletion admin/src/main/scala/com/neu/service/Services.scala
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ object Utils extends LazyLogging with Directives {
* bit1 bit2 bit3 bit4
* ----------------------------------------------------------------------------------------------------------------------------
* Supplemental bit 1 ONLY env MANAGER_SSL on: 1 Request static resources env IS_DEV == true or
* NOT requset js files off: 0 true: 1 true: 1 (undefined): 0 false: 0 false: 0
* NOT request js files off: 0 true: 1 true: 1 (undefined): 0 false: 0 false: 0
*/
val headerConfigMapKey: Short =
(1000 + isUsingSSLBit * 100 + isStaticResourceBit * 10 + isDevOrNotJsBit).toShort
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class OpenIdAuthService()(implicit
} else {
Await
.result(
handleExistingResoureces(code, state, ip, host, nonce),
handleExistingResources(code, state, ip, host, nonce),
RestClient.waitingLimit.seconds
)
}
Expand Down Expand Up @@ -105,7 +105,7 @@ class OpenIdAuthService()(implicit
}
}

private def handleExistingResoureces(
private def handleExistingResources(
code: Option[String],
state: Option[String],
ip: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,13 @@ class DashboardService()(implicit executionContext: ExecutionContext)
)
logger.debug("Got {}", dashboardScoreDTO)
val endTime = new DateTime()
logger.info("Dashbaord scores - End: {}", endTime)
logger.info("Dashboard scores - End: {}", endTime)
logger.info(
"Dashbaord scores - Calculation Duration: {}",
"Dashboard scores - Calculation Duration: {}",
endTime.getMillis - calculationStartTime.getMillis
)
logger.info(
"Dashbaord scores - Duration: {}",
"Dashboard scores - Duration: {}",
endTime.getMillis - startTime.getMillis
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,21 @@ class DeviceService extends Directives with DefaultJsonFormats with LazyLogging
}

def updateWebhook(tokenId: String, webhook: Webhook, scope: Option[String]): Route = complete {
val printedPayload = maskedWebhookConfigWrapToJson(
MaskedWebhookConfigWrap(
MaskedWebhook(
name = webhook.name,
url = webhook.url,
enable = webhook.enable,
use_proxy = webhook.use_proxy,
`type` = webhook.`type`,
cfg_type = webhook.cfg_type
)
)
)
logger.info("Update config: {}", printedPayload)

val payload = webhookConfigWrapToJson(WebhookConfigWrap(webhook))
logger.info("Update config: {}", payload)

RestClient.httpRequestWithHeader(
scope.fold(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ class PolicyService() extends BaseService with DefaultJsonFormats with LazyLoggi
}

def addAdmissionRules(tokenId: String, admissionRuleConfig: AdmRuleConfig): Route = complete {
logger.info("Adding addmission rule: {}", admissionRuleConfig)
logger.info("Adding admission rule: {}", admissionRuleConfig)
logger.info(
"config in json: {}",
admissionRuleConfigToJson(admissionRuleConfig)
Expand All @@ -867,7 +867,7 @@ class PolicyService() extends BaseService with DefaultJsonFormats with LazyLoggi
}

def updateAdmissionRule(tokenId: String, admissionRuleConfig: AdmRuleConfig): Route = complete {
logger.info("Updating addmission rule: {}", admissionRuleConfig)
logger.info("Updating admission rule: {}", admissionRuleConfig)
logger.info(
"config in json: {}",
admissionRuleConfigToJson(admissionRuleConfig)
Expand Down
2 changes: 1 addition & 1 deletion admin/test/REST_API/test_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ base_url="https://127.0.0.1:8443"
file="${inputDir}/test_data.properties"

function start_test {
#Variables initialzation
#Variables initialization

#Remove all output files
rm -f ${outputDir}
Expand Down
6 changes: 3 additions & 3 deletions admin/webapp/websrc/app/common/constants/global.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class GlobalConstant {
public static NETWORK_RULES_PORTS_DISPLAY_LEN = 40;
public static EXTERNAL = 'external';
public static PROXY_VALUE = 'neuvector-service-webui:8443/proxy';
public static NO_CAHCE = 'no-cache';
public static NO_CACHE = 'no-cache';
public static KUBE = 'kubernetes';
public static OPENSHIFT = 'Kubernetes-OpenShift';
public static RANCHER = 'Kubernetes-Rancher';
Expand Down Expand Up @@ -190,7 +190,7 @@ export class GlobalConstant {
SOURCE: 'source',
DESTINATION: 'destination',
},
PROTOCOL: 'protocal',
PROTOCOL: 'protocol',
};

public static TAB_NAME = {
Expand Down Expand Up @@ -281,7 +281,7 @@ export class GlobalConstant {
WAF: 'cfgWafExport.yaml',
COMPLIANCE_PROFILE: 'cfgComplianceProfileExport.yaml',
VUL_PROFILE: 'cfgVulProfileExport.yaml',
RESPONSE_RULES: 'cfgReponseRulesExport.yaml',
RESPONSE_RULES: 'cfgResponseRulesExport.yaml',
FED_SYSTEM_CONFIG: 'cfgFedSystemConfigExport.yaml',
};

Expand Down
2 changes: 1 addition & 1 deletion admin/webapp/websrc/app/common/constants/map.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class MapConstant {
LEFT: 'left',
KICKED: 'kicked',
DISCONNECTED: 'disconnected',
UPGADE_REQUIRED: 'joint_upgrade_required',
UPGRADE_REQUIRED: 'joint_upgrade_required',
SYNCED: 'synced',
OUT_OF_SYNC: 'out_of_sync',
JOIN: 'join',
Expand Down
16 changes: 8 additions & 8 deletions admin/webapp/websrc/app/common/constants/path.constant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ export class PathConstant {
public static SAML_SLO_URL = 'token_auth_server_slo'; //auth
public static OIDC_AUTH = 'openId_auth'; //auth
public static LICENSE_LOAD_URL = 'license/update'; //auth
public static GROUP_URL = 'group'; //poilcy
public static SERVICE_URL = 'service'; //poilcy
public static PROCESS_PROFILE_URL = 'processProfile'; //poilcy
public static FILE_PROFILE_URL = 'fileProfile'; //poilcy
public static FILE_PREDEFINED_PROFILE_URL = 'filePreProfile'; //poilcy
public static POLICY_URL = 'policy'; //poilcy
public static POLICY_APP_URL = 'policy/application'; //poilcy
public static POLICY_RULE_URL = 'policy/rule'; //poilcy
public static GROUP_URL = 'group'; //policy
public static SERVICE_URL = 'service'; //policy
public static PROCESS_PROFILE_URL = 'processProfile'; //policy
public static FILE_PROFILE_URL = 'fileProfile'; //policy
public static FILE_PREDEFINED_PROFILE_URL = 'filePreProfile'; //policy
public static POLICY_URL = 'policy'; //policy
public static POLICY_APP_URL = 'policy/application'; //policy
public static POLICY_RULE_URL = 'policy/rule'; //policy
public static VUL_ASSET_URL = 'vulasset'; //risks
public static RISK_CVE_URL = 'risk/cve'; //risks
public static RISK_COMPLIANCE_URL = 'risk/compliance'; //risks
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,35 @@
to.header | translate
}}</mat-card-header>
<mat-card-content *ngIf="to.content">
<ng-container *ngIf="isArrayContent(to.content); else OtherDiplay">
<ng-container *ngIf="to.isBulletMode; else NormalListDiplay">
<ng-container *ngIf="isArrayContent(to.content); else OtherDisplay">
<ng-container *ngIf="to.isBulletMode; else NormalListDisplay">
<ul>
<li *ngFor="let c of to.content">{{ c | translate }}</li>
</ul>
</ng-container>
<ng-template #NormalListDiplay>
<ng-template #NormalListDisplay>
<div *ngFor="let c of to.content">
{{ c | translate }}
</div>
</ng-template>
</ng-container>
<ng-template #OtherDiplay>
<ng-template #OtherDisplay>
<ng-container
*ngIf="isObjectContent(to.content); else NormalStringDiplay">
<ng-container *ngIf="to.isBulletMode; else NormalObjectDiplay">
*ngIf="isObjectContent(to.content); else NormalStringDisplay">
<ng-container *ngIf="to.isBulletMode; else NormalObjectDisplay">
<ul>
<li *ngFor="let c of getObjectContentKeys(to.content)">
{{ c | translate }} - {{ to.content[c] }}
</li>
</ul>
</ng-container>
<ng-template #NormalObjectDiplay>
<ng-template #NormalObjectDisplay>
<div *ngFor="let c of getObjectContentKeys(to.content)">
{{ c | translate }} - {{ to.content[c] }}
</div>
</ng-template>
</ng-container>
<ng-template #NormalStringDiplay>
<ng-template #NormalStringDisplay>
<pre>{{ to.content }}</pre>
</ng-template>
</ng-template>
Expand Down
Loading
Loading