Payload blacklisting

  • Policy setup, request inspection, scanner caches and refresh, matching rules, rejection and audit.
100%

Request policy selection, scanner refresh and decision outcomes

1 STARTUP · prepare policy data and compiled scanners2 EACH REQUEST · resolve, inspect and decide3 SCHEDULED REFRESH · later requests see refreshed cache statePayload blacklistingRequest / responseControl / stateFailure / rejectionparse + flagsthen loadconsumer / serviceexplicit policyno mappingNO_POLICYscanner foundscanner missingdefault founddefault absentaccepted matchno matchoverwritebuild + swapInbound requestResolve policyMapped scannerDefault scannerLiteral scanProceed downstreamReject and auditScanner unavailableActive policiesBuild scannersLoad API mappingsReload policy dataUpdate mappingsReplace trie mapparse + flagsthen loadconsumer / serviceexplicit policyno mappingNO_POLICYscanner foundscanner missingdefault founddefault absentaccepted matchno matchoverwritebuild + swap

Select a component to trace its direct connections. Drag to pan · Ctrl + wheel or pinch to zoom.

  • The consumer and service select a payload policy. An absent mapping uses the default policy. An explicit NO_POLICY mapping skips scanning. A literal match in the raw body rejects the request and creates an audit record.
  • The lower branch builds and refreshes the keyword scanners. A request uses the available scanner for its policy or the configured fallback. If both are missing, the documented check fails.
Payload blacklisting: request and outcome

Payload blacklisting: request and outcome

follow the complete lifecycle

Read the map in three bands: prepare policy data and scanners; inspect each request; refresh the cached policy state. Select a box for its configuration or behavior. This is body-keyword inspection before downstream processing, separate from JWT revocation and business authorization. The version label identifies the supplied design document; it is not a deployed application version.

Enter with the body and canonical API identity

The interceptor resolves SERVICE_CONSUMER and CONSUMER_SERVICE, then checks the mapping cache for that pair. It scans the entire supplied body as text without JSON, XML or multipart field selection. A positive cache entry selects a policy; a cached Optional.empty() selects the configured default. A cache miss queries the mapping repository and stores either result. The default is a policy choice, not an empty scanner.

Choose the scanner or explicit bypass

Resolution Next action
Explicit policy mapping Use that policy’s compiled scanner.
No mapping Use the configured default scanner.
Explicit NO_POLICY Skip scanning and continue downstream.
Mapped scanner not built yet Fall back to the configured default scanner.
Required default scanner absent The V2 guide’s flow fails the request.

Only one policy is intended for an API; there is no stack of policies to combine. DEFAULT_POLICY expresses the fallback in the guide, while DEFAULT_GLOBAL_BLACKLIST appears as a name in its cache illustration. They are not interchangeable configuration keys. Verify the selected default and its scanner.

Continue, reject, and identify what happened

The first accepted keyword match rejects the request. If no accepted match exists, scanning allows onward processing; NO_POLICY reaches the same downstream path without scanning. “Allowed” here means this component did not block the body, not that the request passed every other security control.

The documented blocked-event audit carries matched keyword, policy name, service consumer, consumer service, and request/correlation ID. These fields identify the decision without persisting the full body. Audit durability and the final response contract are separate implementation concerns.

The bounded Direct source observation found an enabled-by-property handler for /route/dispatch and a malicious result mapped to HTTP 400. It also found scanner exceptions logged as “Defaulting to SAFE” and returned as non-malicious. That source observation must not be generalized into IL/APIGW coverage or a blanket fail-closed promise. See the failure table in Inspection coverage and errors.

Policy and mapping data

Policy and mapping data

configure a reusable policy

CZ_SECURITY_POLICY_MASTER owns the keyword set and scanner flags. The configuration is processed when a trie is built; a request uses the resulting scanner rather than reparsing the policy.

Field Documented type Role
POLICY_NAME VARCHAR2(100 BYTE) Named policy; documented primary key.
POLICY_DESCRIPTION VARCHAR2(1000 BYTE) Policy intent.
BLOCK_PATTERNS CLOB Literal keywords or phrases separated by the configured delimiter.
DELIMITER VARCHAR2(10 BYTE) Separates patterns; select it so needed literal characters remain in patterns.
WHOLE_WORD_MATCH VARCHAR2(1 BYTE) Y/N alphabetic-boundary check.
CASE_SENSITIVE VARCHAR2(1 BYTE) Y/N case-sensitive matching.

The guide also describes maker–checker/approval fields and active-policy loading. It does not supply complete deployable DDL or defaults for omitted flags. Do not assume these fields are optional or infer SQL insert statements from this table.

Bind the API identity to that policy

CZ_SERVICE_CONSUMER_SECURITY_POLICY_MAPPING associates an API with a policy.

Field Documented type Role
SERVICE_CONSUMER VARCHAR2(250 BYTE) Consumer name linked to CMC_RH_CONSUMER_APP.
SERVICE_CONSUMER_ID VARCHAR2(36 BYTE) Consumer ID used with the service link.
CONSUMER_SERVICE VARCHAR2(250 BYTE) Service name linked to CMC_RH_CONSUMER_APP_SERVICE.
POLICY_NAME VARCHAR2(100 BYTE) Selected policy, including deliberate NO_POLICY bypass.
POLICY_COD_STATUS VARCHAR2(1 BYTE) Linked policy approval/status value.

The described foreign keys include (POLICY_NAME, POLICY_COD_STATUS) to policy identity/status and (SERVICE_CONSUMER_ID, CONSUMER_SERVICE) to the consumer-service table. The documented mapping primary key is (SERVICE_CONSUMER, CONSUMER_SERVICE, POLICY_NAME). That three-column key alone does not enforce the intended one-policy-per-pair rule; the full schema or writer must supply that invariant. Stacking or conflict precedence is not defined.

Hard deletes are described. Integration with soft-deleted kernel consumer/service records is only partial; the guide suggests joined-view filtering of RECORD_STAT != 'C'. Do not assume soft-deleting a kernel record already removes its effective mapping.

Worked policy choice: a name containing Union

Illustrative records adapted from the guide, with case-insensitive matching and whole-word matching enabled for this example:

Policy Literal pattern set Use
CUSTOM_POLICY_1 select, update, drop table, union APIs where any occurrence of the word Union is intended to block.
Configured default drop table, select, <script APIs that accept ordinary text containing Union.

Map the strict API explicitly to CUSTOM_POLICY_1. A text-entry API using the default can accept 123 Union Street, while Union Select 1 still contains the blocked select keyword. This illustrates reuse and reduced false positives, not a guarantee that benign text or attacks are classified correctly. The same policy can serve many API mappings.

A mapping edit can change the intended policy without a code deployment, but its effective scanner can remain the old/default choice until refresh. NO_POLICY is a deliberate bypass requiring trusted API identity and controlled configuration; it is not a request-time fallback for scanner trouble.

Startup, caches and refresh

Startup, caches and refresh

build before serving scans

BlacklistScannerManager participates in startup as a SmartInitializingBean. It loads active policy definitions, splits each pattern list with that policy’s delimiter, applies the case/boundary configuration and builds one Aho–Corasick scanner per policy. It then loads active consumer/service mappings. Parsing and trie construction stay outside ordinary request scanning.

Cache Key and value Job
czSecurityPolicyMasterCache Policy identity → active definition Spring cache of policy data used to build scanners.
czSecurityPolicyMappingCache Consumer/service pair → mapping or Optional.empty() Spring cache for API policy resolution.
policyTrieJVMCache POLICY_NAME → compiled scanner In-process JVM scanner lookup.

These are different stores with different responsibilities. A cached mapping is not a built scanner, and an in-process trie is not evidence of simultaneous publication in every JVM.

A miss and a negative hit are different

On a mapping-cache miss, the repository is queried and either the mapping or an empty result is cached. On a negative hit, Optional.empty() already says no mapping was found; the request uses the default without another database query until refresh.

The guide justifies negative caching using controlled platform consumer/service identifiers. That depends on the actual interception and identity-validation boundary. The document alone cannot prove externally supplied headers are unable to introduce arbitrary keys or select a weaker policy.

Scheduled refresh replaces compiled state

  1. Evict and repopulate the policy-definition cache from the database.
  2. Overwrite mapping entries; convert removed mappings to negative entries.
  3. Build a replacement trie map separately from the active one.
  4. Atomically replace the active trie-map reference.

The atomic operation covers the trie reference. The guide does not describe one atomic generation containing both mapping updates and scanner publication, nor a cluster-wide barrier. It does not specify a refresh interval, maximum stale age or failed-refresh retention contract.

Two requests during a new-policy rollout

Request/cache state before the next refresh What the request observes
API has never been looked up Cache miss finds the new mapping in the DB; its new scanner is absent, so the configured default scanner is used.
API already has a negative entry The cached empty result bypasses the DB; the configured default continues to be used.
Replacement state has been published The request can use the new mapping/scanner as available in that JVM.

The temporary gap is documented behavior. “Policy saved” or “mapping updated” does not mean every request is enforcing the new keyword set. Compare the selected policy, available scanner and refresh outcome per owning JVM when validating a change.

Literal matching and flags

Literal matching and flags

one compiled multi-pattern scanner

Aho–Corasick represents the configured literal patterns in a trie with failure transitions. The body advances through that automaton once; a mismatch follows the appropriate fallback rather than starting a separate whole-body search for every keyword. Candidate matches are checked against configured boundary rules, and the scan can stop at the first accepted match.

Construction depends on total pattern length; scanning is linear in input plus match-output processing. The document’s shorthand O(n) describes the single-pass traversal, not zero cost for arbitrarily many emitted matches. It provides no measured throughput or payload-size limit.

This avoids the repeated per-pattern scans of naive substring or single-pattern Boyer–Moore/Horspool approaches. It also avoids regex backtracking and hash-collision checks in this literal matcher. Those are selection reasons for this requirement, not claims that every regex or hash algorithm is unsuitable in general.

Flags change which candidate is accepted

DELIMITER splits BLOCK_PATTERNS; CASE_SENSITIVE controls case handling; WHOLE_WORD_MATCH enables the neighbor-character test shown below. These choices belong to the compiled policy. The matcher checks the character before and after a candidate match using Character.isAlphabetic.

“Whole word” here means alphabetic characters cannot touch the keyword. Digits, punctuation and underscores are not automatically excluded. This is not a SQL lexer or a general natural-language word-boundary definition.

Exact whole-word boundary implementationjava
private boolean isPartialMatch(CharSequence searchText, PayloadEmit<T> emit) {
    return emit.getStart() != 0 && Character.isAlphabetic(searchText.charAt(emit.getStart() - 1))
        || emit.getEnd() + 1 != searchText.length() && Character.isAlphabetic(searchText.charAt(emit.getEnd() + 1));
}

Work through the boundary examples

Keyword Body fragment Accepted match with whole-word enabled?
select select, (select), select,update Yes: no touching alphabetic neighbor.
select selection, myselectquery, preselect No: an adjacent character is alphabetic.
= 1=1, (=), == Yes: digits and punctuation pass the boundary test.
= a=b, value=, =true No: an alphabetic character touches the match.

The library also offers onlyWholeWordsWhiteSpaceSeparated, requiring whitespace boundaries. The guide explicitly says that stricter mode is not exposed by this policy configuration. Do not present it as another supported database flag.

Inspection coverage and errors

Inspection coverage and errors

the scanner sees literal body text

There is no JSON/XML/multipart parser, field-level inclusion/exclusion or automatic decoding stage. Query parameters, headers, path variables and cookies are outside the described body scan unless separately passed through the same mechanism. A matching keyword can therefore appear in harmless body content as well as malicious input.

Body content Policy consequence
A blocked literal in a free-text note A valid business request may be refused. Scope the policy to the relevant operation.
Structured or encoded fields Use format-aware validation for these fields. A literal scanner examines the body text it receives.
A missing or unavailable scanner Distinguish a policy configuration error from an accepted match in the audit record.

Test the actual body representation at the interceptor and record which policy selected the scanner.

Keep rejection, missing state and execution errors separate

Condition Behavior
Accepted keyword match Reject the body and emit the policy decision and correlation ID.
Explicit NO_POLICY Continue to the next handler.
Mapped scanner absent Resolve the configured default.
Default scanner unavailable The policy contract specifies failure.
Exception during scanning The Direct scan service can log the exception and return SAFE. Alert on this path and verify the intended error policy.

Direct enables this interceptor on its dispatch route through application configuration. Verify missing-policy and scanner-error handling separately for each deployed handler.

What remains outside this component

Parameterized database calls, structural input validation, authorization and other security layers still own their jobs. Literal body blocking is not a semantic SQL/XSS detector or a full WAF. Policy refinement reduces selected false positives but cannot eliminate them.

The source documents temporary new-policy gaps, but no refresh interval, cluster-wide convergence bound, maximum body bytes, scanning CPU budget, stale-policy deadline or failed-refresh contract. Those require implementation/runtime evidence before claiming operational guarantees. Validate policy selection, scanner readiness, rejected-event fields and error paths per protected API and owning JVM.