Skip to content

Security: Cheditte/abap-imap-inbound

SECURITY.md

Security and operations / Yetki ve işletim

Optional per-profile authorization

By default the programs rely on standard SAP authorizations (S_TABU_DIS, S_LOG_COM, S_DATASET). Anyone with display access to the log table can then see every profile's mail. If different teams must see only their own mailbox, define the optional object; the programs detect it and check it from then on:

  1. SU20: create authorization field ZCHE_PROF with data element ZCHE_IMAP_PROFID (created by the installer; the profile name such as INVOICE).
  2. SU21: create authorization object ZCHE_IMAP with fields ZCHE_PROF and ACTVT; permitted activities 02, 03, 16.
  3. PFCG: grant profile names and activities per role. Once the object exists, a user without a matching grant is refused.

Varsayılan olarak programlar standart SAP yetkilerini kullanır; log tablosunu görebilen herkes bütün profillerin maillerini görür. Profil bazında ayrım gerekiyorsa SU21'de ZCHE_IMAP nesnesini tanımlayın; programlar bundan sonra bu nesneyi denetler.

Activity Permission / İzin
03 Monitor, body and attachment display; profile display. / Monitör, gövde, ek ve profil görüntüleme.
02 Configure/delete a profile; explicitly reprocess failed mail. / Profil bakımı ve hatalı maili yeniden işleme.
16 Run the inbound job for that profile. / Profilin gelen posta işini çalıştırma.

The installer disables table maintenance and assigns TDDAT group ZCHI. Grant S_TABU_DIS only for the required table activities. Maintenance flags do not stop privileged SQL/debugging; do not grant production users generic table update or debug-change access. Root, handler prefix (HANDLER_PREFIX, default ZCHE_IMAP_HANDLER_) and retry limit (MAX_ATTEMPTS, default 3) are installer-owned parameters. The installer writes the defaults once and keeps existing values on a rerun.

Tablo bakımı kapalıdır; ZCHI tablo grubu kullanılır. Yetkili geliştiricinin doğrudan SQL/debug erişimi ayrıca sınırlandırılmalıdır. Kök klasör ve handler izin listesi profil ekranından değişmez.

Set program authorization group ZCHI in SE38 attributes for CONFIG, INBOUND and MONITOR. Create matching SE93 report transactions ZCHE_IMAP_CONFIG, ZCHE_IMAP_INBOUND, ZCHE_IMAP_MONITOR; grant scoped S_TCODE and S_PROGRAM. These role/transaction steps are explicit administrator setup, not automatic role provisioning.

SAP commands / SAP komutları

The programs start fixed SM69 commands through SXPG_COMMAND_EXECUTE, which checks S_LOG_COM (fields COMMAND, OPSYSTEM, HOST). Grant only the commands each user needs; without this grant the connection test fails with error SXPG1 (no permission).

User S_LOG_COM commands
CONFIG user ZCHE_IMAP_TEST
INBOUND / job user ZCHE_IMAP_LIST, ZCHE_IMAP_FETCH, ZCHE_IMAP_DONE
Installer All ZCHE_IMAP_* commands, plus SM69 maintenance

Programlar sabit SM69 komutlarını SXPG_COMMAND_EXECUTE ile çalıştırır; bu da S_LOG_COM yetkisini denetler. Her kullanıcıya yalnızca gereken komutları verin; bu yetki yoksa bağlantı testi SXPG1 (yetki yok) hatasıyla durur.

File access / Dosya erişimi

Principal Scope
CONFIG user S_DATASET ACTVT 34 for exact conf/ and, only with screen-managed secrets, secret/ paths; 06 on old revision credentials for rotation cleanup. No 33 read grant on secrets.
INBOUND/MONITOR users Read only the required in/ / done/ files; INBOUND can write the failed-cache marker. No ABAP read access to secret/.
SAP service account OS access to required work files; helper reads credentials. bin/ scripts and policy must be administrator-owned and read-only to this account.
Other users No secret-path read access, including CG3Y/generic file download.

Production default is Basis-managed credentials, source O (the existing protocol value; not B). Basis-managed credential files are UTF-8, independent of the SAP display codepage; screen-managed credential files use the declared SAP codepage. The job never reads the credential through ABAP. Passwords remain plaintext files protected by OS and SAP authorizations. curl receives the password over stdin (--config -); neither password nor mail content is passed as a command argument.

Üretim varsayılanı Basis’in yönettiği O kaynağıdır. Parolalar şifreli kasa değildir; dosya izinleriyle korunur. Konfigürasyon kullanıcısına gizli klasörde okuma yetkisi verilmez. Ekran parolası kullanılıyorsa yeni profil commit edildikten sonra önceki revizyon silinir; silme izni yoksa açık bir temizlik uyarısı gösterilir. Başarısız yayınlamadan kalan yetim dosyaları Basis, etkin CREDREV değerleriyle karşılaştırarak temizler.

SAPIMAP_POLICY is ignored. Only administrator-owned bin/policy.psd1 is loaded. Host allowlist, TLS restrictions, maximum size and timeout remain server policy. Certificate revocation checking defaults to false on Windows; set CheckRevoke = $true where the host can reach the CA's revocation services. Certificate-chain verification remains enabled in production.

Handler and recovery / Handler ve kurtarma

Only programs matching the installer-owned HANDLER_PREFIX (default ZCHE_IMAP_HANDLER_) and a plain FORM name may run. Configuration and processing both enforce the policy. Handlers must not commit/rollback, call side-effecting RFC or leave the processor's LUW. The processor commits business work with H, then resumes only the move after a crash. No EXPUNGE is issued by production code.

MAX_ATTEMPTS defaults to 3 failed attempts. Ordinary runs skip E; retry mode respects the cap. Authorized monitor reprocessing changes E to R and explicitly permits another attempt. Inbox messages are retained, not silently deleted or automatically quarantined; operators review capped failures.

Failed local caches receive failed.utc only after E is committed. The helper removes that marker before a successful cache reuse can reach a handler. PURGE expires marked failed caches after InCacheRetentionDays (default 30; to change it, add the key to bin/policy.psd1). H/move-recovery caches have no failed marker and are retained. The original inbox mail remains available for an explicit retry. Unmarked caches and unknown files/links are not deleted. Completed archives use the profile's existing retention setting.

Türkçe özet: üç hata sınırı otomatik tekrarları durdurur; monitörde yetkili yeniden işleme açık bir operatör kararıdır. Hatalı önbellek 30 gün sonra temizlenebilir, posta kutusundaki özgün mail korunur. Commit edilmiş işin bekleyen taşıması temizliğe dahil edilmez.

Migration / Geçiş

Stop old jobs before installing the renamed objects. ZIMAP_ and ZCHE_IMAP_ must never process the same mailbox concurrently. Reconcile old H/S business effects and mail identities before importing any log history. No old table, program, mailbox or credential is removed automatically. This candidate does not provide an automatic migration of production history.

There aren't any published security advisories