Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate will now decode base64 secret data #232

Merged
merged 2 commits into from
Aug 31, 2023
Merged
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
8 changes: 8 additions & 0 deletions src/lib/validate-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { shouldSkipRequest } from "./filter";
import { Request, ValidateResponse } from "./k8s/types";
import Log from "./logger";
import { PeprValidateRequest } from "./validate-request";
import { convertFromBase64Map } from "./utils";
import { Secret } from "./k8s/upstream";

export async function validateProcessor(
capabilities: Capability[],
Expand All @@ -18,6 +20,12 @@ export async function validateProcessor(
allowed: true, // Assume it's allowed until a validation check fails
};

// If the resource is a secret, decode the data
const isSecret = req.kind.version == "v1" && req.kind.kind == "Secret";
if (isSecret) {
convertFromBase64Map(wrapped.Raw as unknown as Secret);
}

Log.info(reqMetadata, `Processing validation request`);

for (const { name, bindings } of capabilities) {
Expand Down