Accepting a BCB at one interaction point and sourcing a new BCB over the same target at a different interaction point deletes the bundle

Aperta
#398 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 6 giorni

@pablomadoery ci sta già lavorando.

Dal 25/11/2026.

  • #399 di @pablomadoery — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
c
Ambito
backend, security

Direzione di ricerca

Start with BSL_BundleRefState_RepopulateTgts and trace how it updates the bcb_tgts map when an acceptor removes a BCB result. Then inspect BSL_SecCtx_ValidatePolicyActionSet, which the issue identifies as treating an empty target entry as active. Done means a BCB accepted at CLIN can be replaced at CLOUT and the bundle is forwarded with only the new BCB; tests and a proposed fix are mentioned, and linked pull request #399 is already open.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Description

A policy that accepts a BCB over the payload at CLIN and sources a new BCB
over the payload at CLOUT cannot be applied. The intent is to re-encrypt the
payload while forwarding: decrypt it with the existing BCB when the bundle is
received, then encrypt it again under a new security source when it is sent.
Instead the bundle is deleted at CLOUT. The same happens with APPIN and APPOUT.

This is different from #396, where both operations are at the same interaction
point; the fix proposed for #396 (#397) does not cover this case.

Expected behavior

At CLIN the acceptor decrypts the payload and removes the BCB. At CLOUT the
source operation adds a new BCB over the payload, and the bundle is forwarded
with only the new BCB.

Actual behavior

The acceptor succeeds at CLIN, but at CLOUT validation still finds an existing
BCB over the payload, the action is skipped and the bundle is deleted with
reason code 0:

<INFO> [BCB_AES_GCM.c:108:BSLX_BCB_Decrypt] BCB attempting to decrypt
<INFO> [SamplePolicyProvider.c:467:BSLP_FinalizePolicy] PP FINALIZE: Sec Oper from action 0 at index 0: SUCCESS
<ERROR> [SecurityContext.c:818:BSL_SecCtx_ValidatePolicyActionSet] Cannot add service to target 1 that is already targeted by an existing BCB
<WARNING> [SecurityContext.c:661:BSL_SecCtx_ExecutePolicyActionSet] Skipping security action due to previous BSL validation failure
<INFO> [agent.c:445:MockBPA_DeleteBundle] MockBPA: BSL indicated to delete bundle with reason code 0

The first two lines are from CLIN, the rest from CLOUT.

The cause is in BSL_BundleRefState_RepopulateTgts. When the acceptor strips
the result for the payload, the reference to the BCB is removed from the
payload's entry in bcb_tgts, but the entry itself stays in the map with an
empty set. BSL_SecCtx_ValidatePolicyActionSet only checks whether the target
is present in the map (BSLB_AsbPtrSetMap_cget(...)), so the payload still
counts as a BCB target.

The same pattern with BIBs produces the expected output, because an existing
BIB over the target only causes a non-blocking warning for a BIB source.

Steps to reproduce

With bsl-mock-bpa built from main (ad0cb52), policy (keys from
mock-bpa-test/data/default-scs/keyset-1.json):

{
  "policyrule_set": [
    { "policyrule": {
        "filter": { "rule_id": "1", "role": "a", "tgt": 1, "loc": "clin", "sc_id": 2 },
        "spec": { "svc": "bcb", "sc_id": 2,
                  "sc_parms": { "key_name": "ExampleA.2", "key_wrap": true } },
        "policy_action_on_fail": "delete_bundle" } },
    { "policyrule": {
        "filter": { "rule_id": "2", "role": "s", "tgt": 1, "loc": "clout", "sc_id": 2 },
        "spec": { "svc": "bcb", "sc_id": 2,
                  "sc_parms": { "key_name": "ExampleA.2", "aes_variant": 1,
                                "aad_scope": 0, "key_wrap": true } },
        "policy_action_on_fail": "delete_bundle" } }
  ]
}

Send the RFC 9173 Appendix A.2 bundle (EXAMPLE_A_2_WITH_BCB in
mock-bpa-test/test_default_scs.py) from the underlayer. No bundle is
forwarded, and the log shows the lines above.

Environment
  • BSL main at ad0cb52 (also reproduced with v2.0.1)
  • Ubuntu 22.04, gcc 13.4, OpenSSL 3.0.2, Jansson 2.15.1
Proposed fix

I have a fix with tests and can open a pull request: in
BSL_BundleRefState_RepopulateTgts, remove target blocks that no security
block references any more, so that a block is only present in the target maps
while it is actually targeted.

Lingua principale
C
Stelle
16
Fork
11
Merge medio
8g 3h
PR unite (30g)
10

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di NASA-AMMOS/BSL

Tutte le issue di NASA-AMMOS/BSL

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.