# एक attacker क्या recover कर सकता है (reversal classes)

Static-attacker classes जिनमें AfterPack के transforms आते हैं, और हर एक को recover करने से attacker को क्या मिलता है।

Source: https://www.afterpack.dev/hi/docs/reversal-classes

AfterPack अपनी protections को classes में बाँटता है। हर class reversal की लागत अलग तरह से बढ़ाती है। यह जानना कि आपके code के [किसी region](https://www.afterpack.dev/hi/docs/directives#what-you-can-set) को कौन-सी class कवर करती है, आपको बताता है कि उसे पढ़ने पर attacker क्या recover करता है। [Protection Map](https://www.afterpack.dev/hi/docs/protection-map) हर token को उसके complexity score के आधार पर रंगता है और आपके चुने हुए code की class बताता है।

## Static attacker, परिभाषा

ये **static-attacker** classes हैं। ये बताती हैं कि bytes पढ़ने वाले व्यक्ति के सामने क्या आता है: grep, AST tooling, एक deobfuscator pass, या एक LLM जो code को चलाए बिना समझाता है। जो attacker artifact को instrumentation के तहत चलाता है, वह एक अलग और ज़्यादा मज़बूत मामला है, जिसे [threat model](https://www.afterpack.dev/hi/docs/threat-model) में कवर किया गया है।

*(interactive reversal-classes diagram — see the web page)*

## Classes

| Class | एक static attacker क्या recover करता है | Tier |
|---|---|---|
| **Renamed & encoded** (polynomial-injective) | संरचना, मेहनत के साथ। नामों, literals, flatten किए गए control flow और fuse की गई identities, सभी के लिए असली pattern-recognition का काम लगता है। यह काम [हर build](https://www.afterpack.dev/hi/docs/config#seed) पर फिर से करना पड़ता है। | Free |
| **Flattened & fused** (polynomial-non-injective) | [वैसा ही व्यवहार](https://www.afterpack.dev/hi/docs/semantic-contract) करने वाला एक समकक्ष program। Logic को ऐसे फिर से लिखा जाता है कि कई अलग-अलग मूल computations एक ही output में सिमट जाती हैं, और यह mapping कि आपने असल में कौन-सी लिखी थी, खो जाती है। आज कोई shipped transform इस class तक नहीं पहुँचता। | — |

Free tier आपके पूरे bundle में renamed & encoded class बनाता है ([पूरी तालिका Plans & tiers में है](https://www.afterpack.dev/hi/docs/tiers))। ऊँचे [presets](https://www.afterpack.dev/hi/docs/presets) इसी class के अंदर और ज़ोर लगाते हैं। डिफ़ॉल्ट preset `light` है ([complexity target](https://www.afterpack.dev/hi/docs/config#complexity) `5`); [`--preset=hard`](https://www.afterpack.dev/hi/docs/config#preset) जैसा ज़्यादा मज़बूत preset और ज़ोर लगाता है और पूरे bundle में page का startup समय कई गुना कर देता है ([load लागत](https://www.afterpack.dev/hi/docs/presets#load-cost))। `medium` और ऊपर, engine control-flow flattening, identity fusion और [constant destruction](https://www.afterpack.dev/hi/docs/config#strings-encode) को पूरे bundle में एक समान जोड़ता है, और यह सब renamed & encoded class के भीतर ही रहता है।

> **Flattened & fused और destroyed & fused आज नहीं बनतीं**
>
> कोई build इन तक नहीं पहुँचती, और किसी region को कभी "flattened & fused" या "destroyed & fused" class नहीं मिलती। [`/* @afterpack preset=extreme */`](https://www.afterpack.dev/hi/docs/config#preset) किसी region को [string floor](https://www.afterpack.dev/hi/docs/config#strings-encode) चालू रखते हुए [complexity target](https://www.afterpack.dev/hi/docs/config#complexity) `25` तक ले जाता है, जो renamed & encoded class के अंदर वास्तविक, मापने योग्य सुरक्षा है।

## किसी class को recover करने से attacker को क्या मिलता है

किसी class से attacker को क्या मिलता है, यह इस पर निर्भर करता है कि वह किस चीज़ के पीछे था।

- **एक secret** (API key, license threshold, hardcoded table): कोई भी class अपने दम पर इसे नहीं छिपाती। Secret हर उस program से निकल आता है जो आपके program जैसा व्यवहार करता है, जिसमें किसी protected region से recover किया गया program भी शामिल है। Secret को protect करने के लिए एक अलग mechanism चाहिए। देखें [Secret को protect करना](https://www.afterpack.dev/hi/docs/threat-model#protecting-a-secret)।
- **आपके code को समझना और clone करना**: एक static reader काम करने वाला, पढ़ने योग्य समकक्ष recover कर सकता है, लेकिन केवल उस असली pattern-recognition के काम के बाद जिसकी लागत renamed & encoded class लगाती है, और यह काम हर build के लिए फिर से करना पड़ता है। इस गुण की सीमाओं के लिए देखें [AfterPack किसकी जगह नहीं लेता](https://www.afterpack.dev/hi/docs/threat-model#what-afterpack-does-not-replace)।
- **एक check ढूँढकर patch करना** (paywall बंद करना, एक `return true` पलटना): कोई भी class अपने आप ज़्यादा मदद नहीं करती। Attacker को बस वह एक node ढूँढना है। उसे दोबारा ढूँढने में कुछ लागत लगती है, और वह [हर release पर reset होती है](https://www.afterpack.dev/hi/docs/config#seed)। Self-integrity ([`transforms.selfIntegrity.enabled`](https://www.afterpack.dev/hi/docs/config#transforms-kind-enabled)) इसे नहीं पकड़ता: यह केवल अपनी check table में बदलाव पकड़ता है। Rotation के बारे में [Best practices](https://www.afterpack.dev/hi/docs/best-practices) देखें।

## अपनी build पर इसे जाँचें

[Protection Map](https://www.afterpack.dev/hi/docs/protection-map) हर token का सबूत दिखाता है: आपका मूल source, हर token के complexity score के आधार पर रंगा हुआ, और hover करने पर उसकी class और उसके पीछे का transform stack। [लाइव demo खोलें](https://www.afterpack.dev/protection-map-demo) या [`npx afterpack@latest`](https://www.afterpack.dev/hi/docs/cli#usage) से अपना बनाएँ।

## आगे

- [Threat model](https://www.afterpack.dev/hi/docs/threat-model): attackers की वह सीढ़ी जिसके सापेक्ष ये classes तय की गई हैं।
- [Protection Map](https://www.afterpack.dev/hi/docs/protection-map): आपकी अपनी build के लिए per-token view।
- [Best practices](https://www.afterpack.dev/hi/docs/best-practices): क्या mark करें और क्यों।
- [Directives](https://www.afterpack.dev/hi/docs/directives): वे markers जो किसी region को एक class से दूसरी में ले जाते हैं।
- [Presets](https://www.afterpack.dev/hi/docs/presets): सीढ़ी, और हर पायदान द्वारा सेट किया गया complexity target।
