นโยบายที่หยุดบิลด์เมื่อข้อมูลระดับจำกัดไปถึงโมเดลที่มีการจัดการโดยไม่ได้ปิดบัง
องค์กร
ข้อมูล
ของ คลาส หนึ่ง ต้อง ไม่ ไป ถึง ส่วน ประกอบ ของ อีก คลาส หนึ่ง ตาม เส้น ทาง ของ กราฟ บิลด์ เว้น แต่ จะ มี Feature ที่ ทำ หน้าที่ ปลด คลาส แนบ อยู่ บน เส้น ทาง นั้น
พื้นที่
กฎ
สิ่งที่ตัวอย่างนี้บิลด์
| อินสแตนซ์ | Component ของ | สิ่ง |
|---|---|---|
assistant | local/ai-agent/claims-assistant | ผู้ |
helpdesk | core/ai-agent/langgraph | ผู้ |
checkpointer | core/datastore/valkey | ที่ |
masking-gateway | core/gateway/litellm | เกตเวย์ AI ที่chat โดยcore/data-masking |
plain-gateway | core/gateway/litellm | เกตเวย์ |
gpt | core/ai-model/openai | API ที่ OpenAI จัดการ เข้า |
analyzer, anonymizer | core/security/presidio-analyzer, core/security/presidio-anonymizer | บริการ |
เกตเวย์gpt ผ่านmodels ของPERSON และ EMAIL_ADDRESS ผู้model ที่ Component ของ
Releases ทั้งสาม
Releases ต่าง
| Release | ทราฟฟิก | ทราฟฟิก | การ |
|---|---|---|---|
release-masked.yaml | ผ่าน masking-gateway | ผ่าน plain-gateway | เสร็จ |
release-unmasked.yaml | ผ่าน plain-gateway | ผ่าน plain-gateway | หยุด |
release-masking-off-route.yaml | ผ่าน plain-gateway | ผ่าน masking-gateway | หยุด |
Release แต่ละmodel ของ
ร่างตัวอย่าง
คุณ
เขียน
aggrega draft --example policy-data-class-routeจาก
cd policy-data-class-routeบิลด์
aggrega build --release release-masked.yaml --config governance-rego.yaml --auto-pullaggrega build --release release-unmasked.yaml --config governance-rego.yaml --auto-pull # halts; exits 1aggrega build --release release-masking-off-route.yaml --config governance-rego.yaml --auto-pull # halts; exits 1สลับ governance-rego.yaml เป็น governance-cel.yaml หรือ governance-opa.yaml เพื่อ
--config ระบุAGGREGA_CONFIG ระบุ หรือ.aggrega-config.yaml ของdefault_registry หรือaggrega login ไม่
การ
ต้อง
- แค็ตตาล็อก
ไลบรารี มาตรฐาน .aggrega-config.yamlระบุcatalog/ของพื้นที่ ทำงาน นี้ ซึ่ง มี ผู้ ช่วย ด้าน การ เคลม และ เอนทิตี Plugin ของ เอนจิน OPA ส่วน อื่น ทั้งหมด รวม ถึง เอนทิตี Plugin ของ เอนจิน Rego และ CEL หา ค่า จาก รีจิสทรี hub ด้าน ล่าง หรือ จาก checkout ของ แค็ตตาล็อก ที่ ระบุ ด้วย --catalog - รีจิสทรี hub การ
ทำให้ การ ปิดบัง ข้อมูล เป็น รูป ธรรม เขียน การ ตั้ง ค่า ราว กั้น ผ่าน ปลั๊กอิน ตัว เดียว ที่ ไม่ ได้ จัด ส่ง มา กับ คอมไพเลอร์ หรือ แค็ตตาล็อก คือ ขั้น ตอน การ กำหนด ค่า เกตเวย์ pipeline-step/litellm-gateway-configและบิลด์ pull ปลั๊กอิน นั้น จาก รีจิสทรี ที่ default_registryระบุ คือhub.aggrega.ai
--auto-pull เติม
กับผู้ช่วย AI
ผู้
ใช้เครื่องมือของ Aggrega เท่านั้น และไม่สร้างโฟลเดอร์เอง หากโฟลเดอร์พื้นที่ทำงานยังไม่มีโฟลเดอร์ `policy-data-class-route` เรียกเครื่องมือ `draft` หนึ่งครั้งโดยตั้ง `example` เป็น `policy-data-class-route` และไม่ระบุ `dir`: เครื่องมือจะเขียนตัวอย่างลงในโฟลเดอร์ `policy-data-class-route` ใหม่ จากนั้นเรียกเครื่องมือ `cli-build` ซึ่งรัน `aggrega build` และรับแฟล็ก `--config` หนึ่งครั้งต่อ Release แต่ละรายการ ตามลำดับนี้ — `release-masked.yaml`, `release-unmasked.yaml` และ `release-masking-off-route.yaml` — โดยทุกครั้งตั้ง `workspace_root` เป็น `policy-data-class-route` ตั้ง `release` เป็นไฟล์นั้น ตั้ง `auto_pull` เป็น true และตั้ง `config` เป็น `governance-rego.yaml` รายการที่สองและสามมีไว้เพื่อให้ถูกปฏิเสธ จึงแจ้งการปฏิเสธแต่ละครั้งให้ฉัน แจ้งฉันว่าบิลด์แรกเขียนไฟล์ใดบ้าง ไฟล์เหล่านั้นอยู่ใต้ `policy-data-class-route/dist/`การหยุด
release-unmasked.yaml ภาย
[… omitted: the pull's lines, and a lint notice about core/referenced-secret][POLICY_ERROR E0005] policy plugin "rego" rejected the build: assistant (restricted) reaches gpt (public) with no declassifying Feature attached between them caused by: policy violationเอนจิน CEL:
[… omitted: the pull's lines, and a lint notice about core/referenced-secret][POLICY_ERROR E0005] policy plugin "cel" rejected the build: assistant (restricted) reaches gpt (public) with no declassifying Feature attached between them caused by: policy violationOPA:
[… omitted: a warning that the OPA guest runs unverified, the pull's lines, and a lint notice about core/referenced-secret][POLICY_ERROR E0005] policy plugin "opa" rejected the build: assistant (restricted) reaches gpt (public) with no declassifying Feature attached between them caused by: policy violationบิลด์1 และdist/: นโยบายE0005 คือrelease-masking-off-route.yaml พิมพ์
อ่านassistant ถือrestricted ทราฟฟิกgpt ซึ่งpublic ผ่าน plain-gateway และ
การ pull ยัง
ทำให้เป็นไปตามกฎ: เกตเวย์ปิดบังข้อมูลบนเส้นทาง
release-masked.yaml กำหนดmasking-gateway และ<workspace> แทน
[… omitted: the pull's lines, a lint notice, under OPA a warning that its guest runs unverified, and the total build time]Build completed: 17 files written to <workspace>/distเกตเวย์declassifying_features ของdist/helm/assistant-deployment.yaml ส่งdist/helm/helpdesk-deployment.yaml ส่ง
# dist/helm/assistant-deployment.yaml, the env of the assistant's containerenv: [… omitted: the recursion limit] - name: OPENAI_BASE_URL value: http://masking-gateway-default:4000/v1 [… omitted: the alias, the checkpointer's address and the graph's entrypoint]# dist/helm/helpdesk-deployment.yaml, the env of the helpdesk's containerenv: [… omitted: the recursion limit] - name: OPENAI_BASE_URL value: http://plain-gateway-default:4000/v1 [… omitted: the alias, the checkpointer's address and the graph's entrypoint]การconfig.yaml ของ dist/helm/masking-gateway/litellm-gateway-config/configmap.yaml:
[… omitted: the routing table]litellm_settings: callbacks: - /etc/litellm-request-guard/request_field_filter.filter turn_off_message_logging: trueguardrails: - guardrail_name: masking-gateway-masking litellm_params: default_on: true guardrail: litellm_content_filter mode: pre_call patterns: - action: MASK name: claim_number pattern: "\\bCLM-[0-9]{8}\\b" pattern_type: regex skip_tool_message_in_guardrail: true [… omitted: three more guardrail entries masking the same pattern and the two entity types, and the request guard's settings]การ
นโยบายrelease-masked ของir-verdict ซึ่ง
นโยบาย
เหตุใด Releases จึงย้ายเส้นทาง ไม่ใช่ย้ายการแนบ
Release แนบ Feature ได้ แต่values และ core/data-masking เก็บpatterns และ entities ไว้values โดยmasking-gateway และ
- ใน
release-masked.yamlการแนบ อยู่ บน เส้น ทาง ของ ผู้ ช่วย ด้าน การ เคลม และ บิลด์ สำเร็จ - ใน
release-unmasked.yamlการแนบ ไม่ อยู่ บน เส้น ทาง ของ ผู้ ช่วย ตัว ใด เลย และ บิลด์ หยุด - ใน
release-masking-off-route.yamlการแนบ อยู่ บน เส้น ทาง ของ เฮลป์เดสก์ และ บิลด์ หยุด อีก ครั้ง
บิลด์
สิ่งที่นโยบายอ่าน
ทั้งหมดir-verdict และ
- เส้น
ทาง ที่ คอมไพเลอร์ แจกแจง input.precalculated_paths: แต่ละเส้น ทาง เป็น รายการ ที่ เรียง ลำดับ ของ ส่วน ประกอบ ที่ ต่อ กัน ด้วย เส้น เชื่อม usesบนrelease-unmasked.yamlเส้นทาง หนึ่ง คือ assistant → plain-gateway → gptนโยบายอ่าน แต่ละ เส้น ทาง จาก ส่วน ประกอบ แรก ซึ่ง เพียง พอ เพราะ คอมไพเลอร์ แจกแจง เส้น ทาง ที่ ออก จาก ทุก ส่วน ประกอบ นโยบาย ไม่ แจกแจง สิ่ง ใด เอง - คลาส
ของ ค่าส่วน ประกอบ แต่ละ รายการ ของ ป้าย กำกับ ที่ class_labelระบุ คือcompliance.aggrega.ai/data-classเมื่อส่วน ประกอบ มี ป้าย กำกับ นั้น: มี เพียง assistantที่มี โดย มี ค่า restrictedมิฉะนั้น คือ คลาส ของ รายการ classes_by_labelรายการแรก ที่ ป้าย กำกับ และ ค่า ตรง กับ ที่ ส่วน ประกอบ มี - การ
แนบ ของ ส่วน ประกอบ แต่ละ รายการ input.graph.spec.feature_values_mappingรายการattached_featuresของเส้น ทาง เอง ไม่ ถูก อ่าน โดย เจตนา: รายการ นั้น ระบุ ทุก Feature ที่ แนบ ที่ ใด ก็ตาม บน เส้น ทาง จึง บอก ไม่ ได้ ว่า มี Feature ใด อยู่ ระหว่าง สอง ส่วน ประกอบ ที่ พิจารณา หรือ ไม่
ส่วน
คลาสgpt ไม่มีcore/ai-model/openai มี component.aggrega.ai/hosting: managed ซึ่ง
classes_by_label: - label: component.aggrega.ai/hosting value: managed class: publicโมเดลcore/ai-model/vllm และself-hosted แทน จึง
เส้น
คลาสเป็นของนโยบาย ไม่ใช่ของคอมไพเลอร์
คอมไพเลอร์compliance.aggrega.ai/data-class ไปrestricted ละเอียดpublic หรือ
class_label: compliance.aggrega.ai/data-classrank: public: 0 internal: 1 restricted: 2องค์กรrank ป้ายclass_label การclasses_by_label และ Features ที่declassifying_features แก้ไขrank ไม่Restricted ทุกrelease-masked.yaml และ aggrega build --release release-masked.yaml --config governance-rego.yaml --auto-pull พิมพ์
[… omitted: under OPA a warning that its guest runs unverified, the pull's lines, and a lint notice about core/referenced-secret][POLICY_ERROR E0005] policy plugin "rego" rejected the build: assistant carries the data class "Restricted", which the policy's rank setting does not list; correct the class or rank it caused by: policy violationคลาสlocal/ai-agent/claims-assistant ขยาย core/ai-agent/langgraph สืบทอดrelease-unmasked.yaml บิลด์public แต่
สามเอนจิน กฎเดียวที่เขียนสามครั้ง
| เอนจิน | แนบ | กฎ |
|---|---|---|
| เอนจิน Rego ที่ | governance-rego.yaml | policies/data-class-paths.rego ระบุwith.sources |
| เอนจิน CEL ที่ | governance-cel.yaml | policies/data-class-paths.cel ระบุwith.sources |
| OPA ที่ | governance-opa.yaml | policies/data-class-paths-opa.rego คอมไพล์ |
สำเนา
สำเนา
- สำเนา CEL ผูก
ชื่อ กับ ค่า หรือ ไล่ ตำแหน่ง ของ รายการ ไม่ ได้ การ ตั้ง ค่า ของ สำเนา นี้ จึง มี อีก หนึ่ง รายการ คือ positionsตำแหน่ง 0 ถึง 15 ที่ใช้ อ่าน ส่วน ประกอบ ของ เส้น ทาง เส้น ทาง ที่ ยาว กว่า นั้น หยุด บิลด์ โดย ระบุ ว่า เริ่ม ที่ ใด แทนที่ จะ อ่าน เพียง บาง ส่วน - สำเนา OPA คอมไพล์
ล่วง หน้า ด้วย ชุด เครื่อง มือ ของ OPA เอง และ ฝัง ไว้ ใน เกสต์ ข้าง catalog/plugin/governance/opa/1.0.0/plugin.yamlการแนบ ของ สำเนา นี้ จึง ให้ เพียง การ ตั้ง ค่า และ ไม่มี ไฟล์ นโยบาย อะแดปเตอร์ ไม่ ให้ ฟังก์ชัน ใน ตัว ใด ที่ OPA ปล่อย ให้ โฮสต์ ของ OPA สำเนา นี้ จึง ต่อ ข้อความ ด้วย concatในที่ ที่ สำเนา ของ เอนจิน Rego จัด รูป แบบ ด้วย sprintfการแก้ไข สำเนา นี้ ไม่ เปลี่ยน บิลด์ ใด จนกว่า จะ บิลด์ เกสต์ ใหม่ ตาม ที่ อธิบาย ด้าน ล่าง
การgovernance/rego:0.9.0 และ governance/cel:0.9.0 และcatalog/plugin/governance/ เป็นการ1.0.0 การgovernance/opa:1.0.0 การpolicy plugin "rego", "cel" หรือ "opa" และ
การตรวจสอบทุกบิลด์
การaggrega draft --example เขียน
./check.shcheck.sh บิลด์ Releases ทั้ง./build-release.sh และE0005 ที่
ENGINE RELEASE EXIT EXPECTED VERDICT------------------------------------------------------------------------------------------none release-masked.yaml 0 reference OKrego release-masked.yaml 0 pass OK: completed, byte-identical to the build with no policyrego release-unmasked.yaml 1 halt OK: E0005, the expected sentencerego release-masking-off-route.yaml 1 halt OK: E0005, the expected sentencecel release-masked.yaml 0 pass OK: completed, byte-identical to the build with no policycel release-unmasked.yaml 1 halt OK: E0005, the expected sentencecel release-masking-off-route.yaml 1 halt OK: E0005, the expected sentenceopa release-masked.yaml 0 pass OK: completed, byte-identical to the build with no policyopa release-unmasked.yaml 1 halt OK: E0005, the expected sentenceopa release-masking-off-route.yaml 1 halt OK: E0005, the expected sentence
check: every build ended as expected.ต้อง./build-release.sh หาAGGREGA_BIN กำหนด-- ส่ง./check.sh -- --offline รันdist/ อยู่
การบิลด์เกสต์ OPA ใหม่
catalog/plugin/governance/opa/1.0.0/governance--opa.wasm คือrust/examples/policy-opa-wasm ในaggrega-pdk โดยpolicies/data-class-paths-opa.rego แทนaggrega-pdk ที่ afd9ac6c6800c34c6c47a2030f580c9681387047 และ aggrega-abi ซึ่ง2ececa8d3b598243f023a2a6c80b351c8d1411a1 ด้วย rustc 1.97.1 โดย
ก่อน
opa build -t wasm -e data_class_paths/deny policies/data-class-paths-opa.rego -o bundle.tar.gztar -xzf bundle.tar.gz -O /policy.wasm > policy.wasmrm bundle.tar.gzsha256sum policy.wasm# 321e8a1f150a7ef7625e174cf636967b6c0e1f7bd39c3b7fa1010838ce35c871 policy.wasmOPA 1.21.1 คอมไพล์
จาก$BUILD ที่
mkdir -p "$BUILD/aggrega-pdk" "$BUILD/aggrega-abi"git -C <aggrega-pdk checkout> archive afd9ac6c6800c34c6c47a2030f580c9681387047 | tar -x -C "$BUILD/aggrega-pdk"git -C <aggrega-abi checkout> archive 2ececa8d3b598243f023a2a6c80b351c8d1411a1 | tar -x -C "$BUILD/aggrega-abi"cp policy.wasm "$BUILD/aggrega-pdk/rust/examples/policy-opa-wasm/policy.wasm"cd "$BUILD/aggrega-pdk/rust/examples/policy-opa-wasm"SRC="$(rustc +stable --print sysroot)/lib/rustlib/src/rust"HASH="$(rustc +stable -vV | awk '/^commit-hash: /{print $2}')"RUSTFLAGS="--remap-path-prefix=$BUILD=/build --remap-path-prefix=${CARGO_HOME:-$HOME/.cargo}=/cargo --remap-path-prefix=$SRC=/rustc/$HASH" \ CARGO_TARGET_DIR="$BUILD/target" \ cargo +stable build --locked --release --target wasm32-wasip1และ$BUILD/target/wasm32-wasip1/release/policy_opa_wasm_rust.wasm ไปcatalog/plugin/governance/opa/1.0.0/governance--opa.wasm
เกสต์
python3 -c 'import sys; print(open(sys.argv[1], "rb").read() in open(sys.argv[2], "rb").read())' \ policy.wasm catalog/plugin/governance/opa/1.0.0/governance--opa.wasm# Trueไบต์eb53965efd7e812ecc933c7b681936c87aa0d242b28628a957f44a6a8072ec93
ตำแหน่งที่คอมไพเลอร์ไม่ตีความ
คอมไพเลอร์uses ที่ Aggregate และ Releases ประกาศ และmanaged หมายความcore/data-masking ปกปิด
ไฟล์
aggregate.yaml— ผู้ช่วย สอง ตัว checkpointer ของ ผู้ ช่วย ทั้ง สอง เกตเวย์ สอง ตัว โมเดล และ ตัว ตรวจ จับ คู่ หนึ่ง การ ปิดบัง ข้อมูล ที่ แนบ กับ masking-gatewayและซ็อกเก็ต modelของผู้ ช่วย ทั้ง สอง ที่ ยัง ไม่ ผูก manifest.yaml— ผูกชนิด ของ ส่วน ประกอบ ทุก ชนิด และ ชนิด Feature ทั้ง สอง เข้า กับ Recipes ของ Kubernetes และ ผูก ผู้ ช่วย ด้าน การ เคลม เข้า กับ Recipe ของ เอเจนต์ พื้น ฐาน ใช้ ร่วม กัน โดย Releases ทั้ง สาม release-masked.yaml,release-unmasked.yaml,release-masking-off-route.yaml— การกำหนด เส้น ทาง ทั้ง สาม แบบ และ Secret ที่ ใช้ อ่าน คีย์ ของ เกตเวย์ แต่ละ ตัว catalog/component/local/ai-agent/claims-assistant/1.0.0/component.yaml— ผู้ช่วย ด้าน การ เคลม คือ core/ai-agent/langgraphที่เพิ่ม ป้าย กำกับ คลาส catalog/plugin/governance/opa/1.0.0/plugin.yaml— เอนทิตี Plugin ของเอนจิน OPA โดย มี เกสต์ governance--opa.wasmอยู่ข้าง กัน policies/data-class-paths.rego,policies/data-class-paths.cel,policies/data-class-paths-opa.rego— กฎ หนึ่งไฟล์ ต่อ เอนจิน governance-rego.yaml,governance-cel.yaml,governance-opa.yaml— ไฟล์--configหนึ่งไฟล์ ต่อ เอนจิน แต่ละ ไฟล์ แนบ กฎ ที่ ir-verdictด้วยการ ตั้ง ค่า เดียวกัน .aggrega-config.yaml— สแตกการ ค้นหา แค็ตตาล็อก และ รีจิสทรี ไม่มี การ แนบ ด้าน การ กำกับ ดูแล build-release.sh— บิลด์ Release หนึ่งรายการ พร้อม พิมพ์ คำ สั่ง aggrega buildที่เทียบ เท่า ออก มา check.sh— บิลด์ทั้ง เก้า รายการ และ ตรวจ สอบ ผล ของ แต่ละ รายการ