diff --git a/Contrast.K8s.AgentOperator.v3.ncrunchsolution b/Contrast.K8s.AgentOperator.v3.ncrunchsolution deleted file mode 100644 index 1af18350..00000000 --- a/Contrast.K8s.AgentOperator.v3.ncrunchsolution +++ /dev/null @@ -1,12 +0,0 @@ - - - True - - tests\Contrast.K8s.AgentOperator.Tests\Contrast.K8s.AgentOperator.Tests.csproj - src\Contrast.K8s.AgentOperator\Contrast.K8s.AgentOperator.csproj\Entities - src\Contrast.K8s.AgentOperator\Contrast.K8s.AgentOperator.csproj\Options - src\Contrast.K8s.AgentOperator\Contrast.K8s.AgentOperator.csproj\Core\Events - - True - - \ No newline at end of file diff --git a/docs/public/02-supported-technologies.md b/docs/public/02-supported-technologies.md index ababb4f2..67a5e86b 100644 --- a/docs/public/02-supported-technologies.md +++ b/docs/public/02-supported-technologies.md @@ -25,7 +25,6 @@ | NodeJS ESM | nodejs-esm | Beta | [Supported NodeJS technologies](https://docs.contrastsecurity.com/en/node-js-supported-technologies.html ) | | PHP | php | Beta | [Supported PHP technologies](https://docs.contrastsecurity.com/en/php-supported-technologies.html) | | Python | python | Beta | [Supported Python technologies](https://docs.contrastsecurity.com/en/python-supported-technologies.html) | -| NodeJS (Protect only) | nodejs-protect | Deprecated | [Supported NodeJS technologies](https://docs.contrastsecurity.com/en/node-js-supported-technologies.html ) | - Injection of NodeJS and PHP applications is in beta. Beta status means the feature might change or act unexpectedly. By using this feature, you agree to the [Contrast Beta Terms and Conditions](https://docs.contrastsecurity.com/en/beta-terms-and-conditions.html "Contrast Beta Terms and Conditions"). - Injection of the NodeJS Agent may result in a substantial increase in the startup time of the instrumented application. If startup time is unacceptable, injecting the agent during compilation may be desireable. If the application was injected by the NodeJS agent during compilation then injection during runtime by the operator should be disabled. See the [rewriter CLI](https://docs.contrastsecurity.com/en/node-js-agent-rewriter-cli.html) for more information. diff --git a/manifests/examples/testing/scenarios/namespaced/injection-nodejs-protect.yaml b/manifests/examples/testing/scenarios/namespaced/injection-nodejs-protect.yaml deleted file mode 100644 index 4fa5a5b0..00000000 --- a/manifests/examples/testing/scenarios/namespaced/injection-nodejs-protect.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: agents.contrastsecurity.com/v1beta1 -kind: AgentInjector -metadata: - name: injection-nodejs-protect -spec: - enabled: true - type: nodejs-protect - selector: - labels: - - name: app - value: injection-nodejs-protect - image: - pullPolicy: Never - connection: - name: testing-agent-connection - configuration: - name: testing-agent-configuration ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: injection-nodejs-protect - labels: - app: injection-nodejs-protect -spec: - replicas: 1 - selector: - matchLabels: - app: injection-nodejs-protect - strategy: - type: Recreate - template: - metadata: - labels: - app: injection-nodejs-protect - spec: - containers: - - image: k8s.gcr.io/pause:3.3 - name: pause diff --git a/manifests/examples/testing/scenarios/namespaced/kustomization.yaml b/manifests/examples/testing/scenarios/namespaced/kustomization.yaml index fc3a7653..5c4318eb 100644 --- a/manifests/examples/testing/scenarios/namespaced/kustomization.yaml +++ b/manifests/examples/testing/scenarios/namespaced/kustomization.yaml @@ -16,7 +16,6 @@ resources: - ./injection-javatooloptions.yaml - ./injection-nodejs-cjs.yaml - ./injection-nodejs-esm.yaml - - ./injection-nodejs-protect.yaml - ./injection-php.yaml - ./injection-python.yaml - ./missing-deps.yaml diff --git a/manifests/install/all/crds/base/agentinjectors_agents_contrastsecurity_com.yaml b/manifests/install/all/crds/base/agentinjectors_agents_contrastsecurity_com.yaml index bc3c9c0f..9340643b 100644 --- a/manifests/install/all/crds/base/agentinjectors_agents_contrastsecurity_com.yaml +++ b/manifests/install/all/crds/base/agentinjectors_agents_contrastsecurity_com.yaml @@ -29,7 +29,7 @@ spec: type: string type: description: The type of agent to inject. Can be one of ['dotnet-core', 'java', 'nodejs', 'nodejs-esm', 'php', 'python']. Required. - pattern: ^(dotnet-core|dotnet|java|node|nodejs|node-esm|nodejs-esm|node-protect|nodejs-protect|php|personal-home-page|python|dummy)$ + pattern: ^(dotnet-core|dotnet|java|node|nodejs|node-esm|nodejs-esm|php|personal-home-page|python|dummy)$ type: string image: description: Overrides the default agent images. diff --git a/src/Contrast.K8s.AgentOperator/Core/AgentInjectionTypeConverter.cs b/src/Contrast.K8s.AgentOperator/Core/AgentInjectionTypeConverter.cs index 8ade6a0b..c05273e8 100644 --- a/src/Contrast.K8s.AgentOperator/Core/AgentInjectionTypeConverter.cs +++ b/src/Contrast.K8s.AgentOperator/Core/AgentInjectionTypeConverter.cs @@ -40,7 +40,6 @@ public string GetDefaultImageName(AgentInjectionType type) AgentInjectionType.Java => "agent-java", AgentInjectionType.NodeJs => "agent-nodejs", AgentInjectionType.NodeJsEsm => "agent-nodejs", - AgentInjectionType.NodeJsProtect => "agent-nodejs-protect", AgentInjectionType.Php => "agent-php", AgentInjectionType.Python => "agent-python", AgentInjectionType.Dummy => "busybox", @@ -57,10 +56,8 @@ public AgentInjectionType GetTypeFromString(string type) "java" => AgentInjectionType.Java, "node" => AgentInjectionType.NodeJs, "node-esm" => AgentInjectionType.NodeJsEsm, - "node-protect" => AgentInjectionType.NodeJsProtect, "nodejs" => AgentInjectionType.NodeJs, "nodejs-esm" => AgentInjectionType.NodeJsEsm, - "nodejs-protect" => AgentInjectionType.NodeJsProtect, "php" => AgentInjectionType.Php, "personal-home-page" => AgentInjectionType.Php, "python" => AgentInjectionType.Python, diff --git a/src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/Patching/Agents/NodeJsProtectAgentPatcher.cs b/src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/Patching/Agents/NodeJsProtectAgentPatcher.cs deleted file mode 100644 index 8cd6328b..00000000 --- a/src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/Patching/Agents/NodeJsProtectAgentPatcher.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using Contrast.K8s.AgentOperator.Core.State.Resources.Primitives; -using k8s.Models; -using System.Collections.Generic; - -namespace Contrast.K8s.AgentOperator.Core.Reactions.Injecting.Patching.Agents; - -public class NodeJsProtectAgentPatcher : IAgentPatcher -{ - //This patcher is deprecated as of nodejs agent v5 - public bool Deprecated => true; - - public AgentInjectionType Type => AgentInjectionType.NodeJsProtect; - - public IEnumerable GenerateEnvVars(PatchingContext context) - { - // https://nodejs.org/api/cli.html#node_optionsoptions - yield return new V1EnvVar("NODE_OPTIONS", $"--require {context.AgentMountPath}/node_modules/@contrast/protect-agent"); - yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent.log"); - yield return new V1EnvVar("CONTRAST__AGENT__SECURITY_LOGGER__PATH", $"{context.WritableMountPath}/logs/contrast_agent_cef.log"); - } -} diff --git a/src/Contrast.K8s.AgentOperator/Core/State/Resources/Primitives/AgentInjectionType.cs b/src/Contrast.K8s.AgentOperator/Core/State/Resources/Primitives/AgentInjectionType.cs index 433844f5..7d94e2f4 100644 --- a/src/Contrast.K8s.AgentOperator/Core/State/Resources/Primitives/AgentInjectionType.cs +++ b/src/Contrast.K8s.AgentOperator/Core/State/Resources/Primitives/AgentInjectionType.cs @@ -9,7 +9,6 @@ public enum AgentInjectionType Java, NodeJs, NodeJsEsm, - NodeJsProtect, //deprecated Php, Python, Dummy diff --git a/src/Contrast.K8s.AgentOperator/Entities/RegexConstants.cs b/src/Contrast.K8s.AgentOperator/Entities/RegexConstants.cs index 82cb412a..23524d21 100644 --- a/src/Contrast.K8s.AgentOperator/Entities/RegexConstants.cs +++ b/src/Contrast.K8s.AgentOperator/Entities/RegexConstants.cs @@ -8,7 +8,7 @@ namespace Contrast.K8s.AgentOperator.Entities; public static class RegexConstants { [RegexPattern] - public const string AgentTypeRegex = @"^(dotnet-core|dotnet|java|node|nodejs|node-esm|nodejs-esm|node-protect|nodejs-protect|php|personal-home-page|python|dummy)$"; + public const string AgentTypeRegex = @"^(dotnet-core|dotnet|java|node|nodejs|node-esm|nodejs-esm|php|personal-home-page|python|dummy)$"; [RegexPattern] public const string InjectorVersionRegex = @"^(latest|(\d+(\.\d+){0,3}(-.+)?))$"; diff --git a/tests/Contrast.K8s.AgentOperator.FunctionalTests/Scenarios/Injection/Agents/NodeJsProtectInjectionTests.cs b/tests/Contrast.K8s.AgentOperator.FunctionalTests/Scenarios/Injection/Agents/NodeJsProtectInjectionTests.cs deleted file mode 100644 index 80f195be..00000000 --- a/tests/Contrast.K8s.AgentOperator.FunctionalTests/Scenarios/Injection/Agents/NodeJsProtectInjectionTests.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Contrast Security, Inc licenses this file to you under the Apache 2.0 License. -// See the LICENSE file in the project root for more information. - -using System.Threading.Tasks; -using Contrast.K8s.AgentOperator.FunctionalTests.Fixtures; -using FluentAssertions; -using FluentAssertions.Execution; -using Xunit; -using Xunit.Abstractions; - -namespace Contrast.K8s.AgentOperator.FunctionalTests.Scenarios.Injection.Agents; - -//Deprecated, remove after nodejs-protect support is removed -public class NodeJsProtectInjectionTests : IClassFixture -{ - private const string ScenarioName = "injection-nodejs-protect"; - - private readonly TestingContext _context; - - public NodeJsProtectInjectionTests(TestingContext context, ITestOutputHelper outputHelper) - { - _context = context; - _context.RegisterOutput(outputHelper); - } - - [Fact] - public async Task When_injected_then_pod_should_have_agent_injection_environment_variables() - { - var client = await _context.GetClient(); - - // Act - var result = await client.GetInjectedPodByPrefix(ScenarioName); - - // Assert - using (new AssertionScope()) - { - var container = result.Spec.Containers.Should().ContainSingle().Subject; - container.Env.Should().Contain(x => x.Name == "NODE_OPTIONS") - .Which.Value.Should().Be("--require /contrast/agent/node_modules/@contrast/protect-agent"); - container.Env.Should().Contain(x => x.Name == "CONTRAST__AGENT__LOGGER__PATH") - .Which.Value.Should().Be("/contrast/data/logs/contrast_agent.log"); - } - } - - [Fact] - public async Task When_injected_then_pod_should_have_agent_injection_init_image() - { - var client = await _context.GetClient(); - - // Act - var result = await client.GetInjectedPodByPrefix(ScenarioName); - - // Assert - result.Spec.InitContainers.Should().ContainSingle(x => x.Name == "contrast-init") - .Which.Image.Should().Be("contrast/agent-nodejs-protect:latest"); - } -} diff --git a/tests/Contrast.K8s.AgentOperator.Tests/Entities/RegexConstantsTests.cs b/tests/Contrast.K8s.AgentOperator.Tests/Entities/RegexConstantsTests.cs index 92c6e5b8..736da54e 100644 --- a/tests/Contrast.K8s.AgentOperator.Tests/Entities/RegexConstantsTests.cs +++ b/tests/Contrast.K8s.AgentOperator.Tests/Entities/RegexConstantsTests.cs @@ -18,8 +18,6 @@ public class RegexConstantsTests [InlineData("nodejs")] [InlineData("node-esm")] [InlineData("nodejs-esm")] - [InlineData("node-protect")] - [InlineData("nodejs-protect")] [InlineData("php")] [InlineData("personal-home-page")] [InlineData("python")]