Propose COBOL COMMAREA copy length guards

Proprietary

Propose a received-length check for application-team review before a direct character MOVE from an incoming COMMAREA. Bind the entry interval and approved existing exit to an exact source path, program, SHA-256 and MOVE line. Derive the required count from the source field offset, literal slice and receiving width. Preserve the MOVE and its padding behavior. Require a concrete short-entry witness and fully known arrivals with an unchanged actual count. Reject unresolved native counts above 9999 and intervals beyond the declared incoming extent. Insert a separate typed IF sentence before a single-statement MOVE sentence on its own fixed-format line. Send insufficient counts through the approved paragraph only when its bounded jump path reaches GOBACK or plain CICS RETURN. Preserve existing messages, sentences and periods. Require ordinary complete source, unaliased storage and validated data copies. Aliases, source switches, alternate ENTRY statements, NEXT SENTENCE, unknown arrivals, unsupported layouts and unproven exits prevent changes and produce explicit barriers. The contract establishes caller admission and exit suitability. The proof establishes the local read extent and terminal path. The proposal does not infer exact-length caller conventions, truncate a copy, add an error routine or change transaction policy. Approved terminal paths may contain bounded literal MOVE stores into validated local scalar fields. Stores require complete ordinary source and unaliased storage. Preserve every existing assignment. Also permit bounded default INITIALIZE on these terminal jump paths. Validate at most 16 local fields or groups and 64 elementary writes. Require complete ordinary unaliased storage. Integer defaults are zero and PIC X defaults are spaces within 256 characters per field. VALUE and FILLER phrases, replacement phrases, FILLER members, tables and unsupported storage prevent this proof. An explicit TO DEFAULT retains default behavior. Preserve every initialization and message before the existing terminal. Preserve known received counts after a supported incoming-area MOVE or plain character DISPLAY only when they cover its complete read extent. Keep paths with an earlier short read unknown. They cannot authorize a later guard insertion. Successful output remains unproven. Require every expanded data COPY to match its separately approved original content hash. Caller hashes do not approve copybook contents. Missing, stale or extra COPY approvals prevent findings and edits. An omitted COPY map approves only a program without COPY references.

io.moderne.mainframe.security.ProposeCommareaCopyLengthGuard

Required

Exact repository-relative source path covered by the approved contract.

Exact program ID. Retain quotes for a literal ID. Literal contents match case exactly.

Lowercase SHA-256 of the complete UTF-8 source text without a byte order mark. The approved entry and exit contract must cover this exact snapshot.

One-based MOVE line selected by the approved source contract.

Exact outermost-first dotted declaration name of the incoming LINKAGE area.

Exact outermost-first dotted declaration name of the actual received byte count at normal entry. Its storage must be separate from the area and copy destination.

Smallest admitted incoming byte count. Every integer through the maximum must be admitted by the approved contract.

Largest admitted byte count. Must be at most 32767 and no larger than the declared incoming record. The complete interval must fit the existing numeric proof.

Existing paragraph approved for insufficient received lengths at this exact site. An optional IN or OF section qualifier is supported. The contract must establish that this path preserves required cleanup, messages and transaction behavior.

Provenance of the approved entry and exit contract. The recipe records this input and does not fetch or infer the contract.

Optional

JSON object mapping every selected-program COPY name to the SHA-256 of its complete original UTF-8 content. Use uppercase names. Omit or use an empty object only when the selected program has no COPY references.

mod run . --recipe=io.moderne.mainframe.security.ProposeCommareaCopyLengthGuard \ -P sourcePath=security/cbl/VSKGBAD.cbl \ -P programName=VSKGBAD \ -P sourceSha256=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef \ -P copyLine=15 \ -P commarea=DFHCOMMAREA \ -P receivedLength=DFHEIBLK.EIBCALEN \ -P minimumLength=0 \ -P maximumLength=16 \ -P approvedExit='LENGTH-ERROR IN ERROR-HANDLERS' \ -P contractSource='mainframe-fixtures/README.md fictional incoming-area contract'

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.