api security services in Kenya usually begin with a question nobody can answer: where are all the keys?
A payments team knows its Daraja credentials. The mobile app team knows its build secrets. Nobody knows about the integration a former contractor built for a partner in 2022.
That missing key can move money, read customer records and call every endpoint the partner was once allowed to use.
api security services in Kenya starts with an inventory, because a key that nobody owns is a key nobody rotates.
Every Integration Starts With a Key Somewhere
Most organisations discover the true size of their key estate when one appears in a public repository or a support ticket.
The inventory should record service name, owner, environment, scope, creation date and last rotation for every credential.
api security services in Kenya should treat an API key as an identity rather than a password. Anything with an identity needs a named owner.
Keys live in mobile apps, spreadsheets, CI pipelines, Postman collections and a developer’s notes application.
The register must record where each key is used, so rotation does not break an unknown integration at two in the morning.
A key with no owner is a key nobody will defend in a review, and nobody will revoke when the project dies.
Count integrations before counting keys, because one integration may hold three credentials for three environments.
api security services in Kenya should reconcile monthly: keys in the vault against keys observed in live traffic.
Traffic logs reveal shadow keys the inventory never captured, including those belonging to old app versions.
Retirement belongs in the lifecycle too. A key no application uses should be revoked, not archived for sentiment.
api security services in Kenya should present that list to the security committee every quarter, with the additions and the removals.
Key Rotation Without Breaking the Night Shift
Rotation is simple in theory: issue a new key, deploy it, revoke the old one.
In practice the old key sits inside an app on 4,000 phones, and the update rolls out over six weeks.
api security services in Kenya should support overlapping validity, so two keys work during a defined window.
A 30-day overlap is generous for server-to-server calls and tight for mobile apps with slow upgrade rates.
Rotation should be scheduled and rehearsed, not triggered only by an incident at midnight.
api security services in Kenya should track which systems have adopted the new key and report the stragglers by name.
Emergency rotation needs its own runbook: who issues, who deploys, who confirms traffic on the new credential.
Revoking before confirming live traffic is how a routine rotation becomes a customer-facing outage.
Record the rotation event with the actor, the time and the reason, because auditors ask and memory fails.
api security services in Kenya should alert when a key passes its maximum age, not when it expires in production.
Keys shared with partners need a coordinated calendar, since the other side rotates on its own schedule and its own holidays.
The aim is boring rotation, performed on a Tuesday morning, with no customer noticing and no engineer heroics.
Scopes Are the Smallest Useful Permission
A scope is a promise that a key can do one thing and not another.
Many gateways offer a single scope called full access, which is the same as offering no scope at all.
api security services in Kenya should define scopes by business action: read balance, initiate payment, read transaction, issue refund.
A reconciliation service needs read access and nothing else, however convenient write access might seem.
A partner that sends delivery notifications needs write access to one endpoint, not the customer table.
Reducing scope turns a stolen key from a breach into an inconvenience with a support ticket.
Test the scope rather than trusting it. Attempt the forbidden call and confirm a 403, not a 200 with an empty body.
api security services in Kenya should map every scope to a role and every role to a named person or system.
Legacy integrations often demand broad scopes because the original developer was in a hurry three years ago.
Split those integrations gradually, one endpoint at a time, with a rollback path if a hidden dependency appears.
Unused scopes deserve a report of their own, because a permission nobody exercises is pure risk.
The smallest useful permission is a moving target, reviewed whenever the integration or the business changes.
Rate Limits as a Security Control, Not a Fairness Policy
Rate limits usually appear to protect a server from load. They also protect it from guessing.
An endpoint that allows 10,000 attempts an hour is an invitation to enumerate customer records politely.
api security services in Kenya should set limits per key, per IP and per endpoint, with different thresholds for each.
Login and OTP endpoints need far tighter limits than a monthly reporting endpoint.
A limit without a response plan is a number in a configuration file and a false sense of safety.
api security services in Kenya should return a clear 429 with a retry window and log the breach against the key.
Burst limits catch scripts. Sustained limits catch slow, patient scraping by someone with time and a list.
Partners will request exemptions, and every exemption should carry an expiry date and a review.
api security services in Kenya should alert when a key reaches 80 percent of its limit repeatedly, because that is either a bug or an attack.
Limits also protect the downstream: M-PESA, the SMS gateway and the bank each have their own ceilings.
A queue that retries without backoff turns a small outage into a self-inflicted flood.
Exercise the limits during load testing, so the first real breach is not also the first test.
Logging Every Call With a Request Identity
A log line that says 401 unauthorized is a fact without a story.
Useful logs carry a request ID, a key identifier, a route, a status, a latency and a timestamp.
api security services in Kenya should never log the secret itself, only a fingerprint or the last four characters.
The request ID should travel from the gateway to the application and back, so one search finds the whole path.
Without it, an incident review becomes a debate between teams holding different timestamps and different memories.
api security services in Kenya should retain logs long enough to investigate a month-old complaint and protect them from deletion.
Personal data in logs needs masking. A phone number in a URL is a data protection problem, not a debugging convenience.
Access to logs is itself a permission, because logs reveal customer behaviour in detail.
api security services in Kenya should alert on patterns: a spike in 403s, a new user agent, a key used from an unfamiliar country.
Centralise logs from the gateway, the application and the callback handler in one searchable place.
A dashboard nobody watches is decoration. Route the alerts to a person with a rota and a phone.
Review the noisiest alerts each quarter and fix the causes rather than muting the channel.
M-PESA Callbacks and the Spoofing Window
An M-PESA callback is an unauthenticated HTTP request until the receiver proves otherwise.
Anyone who learns the callback URL can post a fake confirmation and mark an unpaid order as settled.
api security services in Kenya should verify the source: published IP ranges, TLS and a payload that matches the expected structure.
Better still, reconcile every callback against a transaction status query before releasing goods or sending a receipt.
A callback that arrives before the customer has answered the STK prompt deserves suspicion and a second look.
api security services in Kenya should validate the amount, shortcode, account reference and receipt number against the original request.
Store the raw callback body and headers, because a dispute needs the original message rather than a summary written later.
Idempotency matters here. The same confirmation may arrive twice, and the second must not credit the account again.
api security services in Kenya should reject callbacks for transactions it never initiated and alert on the attempt.
Test the negative path: post a forged callback to staging and confirm the system refuses it.
A confirmation URL that appears in a public repository is a standing invitation to every curious visitor.
After any leak, rotate the callback path or secret and check the logs for earlier abuse.
Third-Party Partners and the Keys They Share
Every partner holding a key is an extension of the security perimeter, whether the contract admits it or not.
A reseller with production access can leak more data than a careless employee and with better paperwork.
api security services in Kenya should issue a separate key per partner, never a shared key with a friendly name.
Separate keys make revocation surgical and attribution possible when something goes wrong.
The partner’s scope should match the contract, and the contract should describe the scope in words both sides understand.
api security services in Kenya should require the partner to rotate on a schedule and notify within 24 hours of a suspected compromise.
Onboarding needs a technical contact, an escalation number and an agreed traffic profile.
api security services in Kenya should monitor partner traffic for volume anomalies and endpoints outside the agreed set.
A partner that suddenly reads the full customer table at 3 am is either migrating or exfiltrating.
Offboarding deserves the same rigour: revoke, confirm, record the date and the person who approved it.
A partner register should carry contract dates, key identifiers and the data categories shared.
When a regulator asks who received personal data, that register is the answer and the delay is the problem.
Secrets Belong in a Vault, Not a Spreadsheet
A spreadsheet named API keys final v3 is the most common secrets store in the region.
It is also the most copied file on any shared drive, and the easiest to attach to the wrong email.
api security services in Kenya should move secrets into a managed vault with access control, audit and versioning.
Environment variables are better than source code, but they leak through crash dumps and verbose debug pages.
A vault issues short-lived credentials, so a stolen value expires before it becomes useful.
api security services in Kenya should separate secrets by environment and by application, with no shared master key.
Developers need a way to work locally without copying production secrets onto a laptop.
Local development needs a sealed configuration, and policy should forbid production data on personal devices.
Scan repositories and build logs for key patterns, because the leak usually happens before the policy does.
Anything a scan finds should be rotated within hours, not at the next quarter.
Secrets embedded in mobile apps cannot be protected, so treat every shipped value as public.
Document the vault’s break-glass process, because a vault nobody can open is an outage with a padlock.
Least Privilege for Service Accounts
A service account is a user that never sleeps, never takes leave and never reads the security policy.
It is also the account most likely to hold permissions granted during a rushed integration on a Friday.
api security services in Kenya should give each service its own identity, with a name that says what it does.
Shared service accounts destroy attribution, and nobody can say which system deleted the record.
The account should reach only the endpoints and tables it needs, and only from known networks.
api security services in Kenya should review service permissions every six months against observed usage.
A billing service that can also read the customer table has more rights than its job requires.
Database roles deserve the same treatment, with read-only accounts where read-only is sufficient.
Dormant service accounts should be removed, especially those created for a pilot that ended two years ago.
Privilege creep is gradual. Each release adds a permission and nobody removes one.
api security services in Kenya should compare granted permissions with actual calls and report the difference to the owner.
Least privilege is not a project with an end date. It is a habit enforced at every deployment.
Penetration Testing an API You Already Trust
A penetration test is not a scan, and a scan is not a test.
A scan finds known weaknesses. A test asks whether an attacker can move from one endpoint to another with the access they already have.
api security services in Kenya should scope the work around business impact: payments, customer data and administrative functions.
The tester needs credentials for at least two roles, so privilege boundaries can be attacked properly.
Test the boring paths: object identifiers in URLs, pagination limits, export endpoints and error messages.
api security services in Kenya should include the mobile app, because the API is only as private as its weakest client.
A useful report describes the exploit, the evidence, the business impact and the fix in that order.
Every high finding needs a retest, not a written promise that it was fixed.
Testing once a year is a baseline. Testing after a major release is closer to the real risk.
The vendor’s own developers should not be the only people who test their work, however capable they are.
api security services in Kenya should keep the report confidential and track remediation to closure in the risk register.
A clean report after a shallow test is worse than an honest report with findings and dates.
Incident Response: The First Sixty Minutes
The first hour after a key leak decides whether the incident becomes a story about a control or a story about a breach.
Someone must be allowed to revoke a production key without convening a committee.
api security services in Kenya should name that person, their deputy and the number to call at night.
The runbook should list the steps in order: contain, rotate, assess, notify, remediate and review.
Containment first means revoking the key or blocking the route, even before the cause is understood.
api security services in Kenya should preserve logs and the affected host before rebuilding, or the investigation starts blind.
Customer notification timelines are legal obligations, so involve counsel early rather than at the press release.
Pre-draft the holding statement, the regulator notification and the partner briefing before they are needed.
A tabletop exercise once a year exposes the gaps in phone numbers, decision rights and contact lists.
The review after an incident should produce dated actions with named owners, not a document with recommendations.
api security services in Kenya should test whether the fixed control works by repeating the attack that succeeded.
Speed comes from practice, not from a thicker binder or a longer distribution list.
Revoking Access When a Staff Member Leaves
A departing engineer may hold 14 keys, three administrative accounts and a personal token that never expires.
The exit checklist usually covers the laptop and the badge, not the API credentials and the partner logins.
api security services in Kenya should link the human resources exit process to the key inventory automatically.
Personal tokens are the hardest to find, because they were created for convenience and never documented.
Search for keys issued to the individual, not only the keys they formally owned.
Shared credentials the person knew must be rotated, not merely reassigned to a colleague.
Contractors need an end date on every credential, so expiry happens without anyone remembering.
api security services in Kenya should revoke on the last working day and confirm that no traffic arrives afterwards.
A graceful exit sometimes includes a short consultancy period, which should use a time-limited key with a narrow scope.
Logs should show who revoked what, when, and on whose instruction.
A quarterly comparison of active staff against active credentials catches the ones the exit form missed.
The gap between payroll and the API is exactly where orphaned access lives and waits.
Sandbox, Staging and Production Keys Must Never Meet
Test keys in production are a common shortcut and a quiet disaster.
A sandbox key that reaches live data turns a demonstration into a data breach with a familiar cause.
Separate environments by network, by database and by credential, not just by a URL prefix.
Staging should hold anonymised data, because a copy of production is also a copy of the risk.
api security services in Kenya should block production credentials from developer machines at the network layer.
Configuration should fail closed when an environment variable is missing, not fall back to a default.
A fallback key in code is a key that ships to every customer and appears in every crash report.
api security services in Kenya should label every key with its environment, so a reviewer can see the mistake immediately.
Deployment pipelines should refuse to promote a build that references a sandbox host.
Audit for cross-environment calls monthly and treat each one as an incident until it is proven harmless.
The convenience of one key for every environment is paid for at the worst possible moment, usually by the customer.
Webhook endpoints are often built in a hurry, because a partner needed them before a launch.
A receiver that returns 200 to everything looks cooperative and hides every failure.
Return a specific status instead: 400 for a malformed body, 401 for a bad signature, 409 for a duplicate event.
The partner’s retry logic depends on those codes, and vague responses produce duplicate deliveries.
Queue the event before processing it, so a crash does not lose the notification.
Process asynchronously where the partner allows it, and acknowledge inside the timeout.
Log the event ID, the partner name, the signature result and the processing outcome.
Replay is not only an attacker’s tactic. A partner outage can deliver a week of events in one afternoon.
Webhook Signatures and Replay Attacks
A webhook is an API call in the other direction, and it deserves the same suspicion as an inbound request.
Without a signature, the receiver cannot distinguish a genuine event from a crafted one.
api security services in Kenya should require an HMAC signature over the raw body, with a timestamp and a key identifier.
Verify the signature before parsing the JSON, using the raw bytes rather than a re-serialised object.
A timestamp older than five minutes should be rejected, which limits the replay window without blocking normal retries.
api security services in Kenya should store seen event IDs for the window and reject duplicates.
Signature secrets need rotation with overlap, exactly like API keys, and the old secret must expire.
Log verification failures with the source IP and the event type, and review them weekly.
A failed signature is not a customer error. It is either a bug or an attack, and both deserve a look.
Test with a tampered body, an old timestamp and a replayed payload before trusting the scheme.
api security services in Kenya should document the scheme for partners, including exact header names and encoding.
Ambiguity in the specification becomes a bypass in the implementation.
A mobile release is a publication, and a publication cannot be recalled from every device.
Users delay updates, ignore prompts and keep old phones in service long after support ends.
That reality should shape the API contract, because the server must tolerate several client generations at once.
Version the endpoints rather than changing them silently, and keep the old version alive for a stated period.
When a version is retired, return a clear error with an upgrade path instead of a mysterious 404.
Track adoption by version, so the decision to retire rests on evidence rather than impatience.
Every version kept alive is another surface to test, which makes the retirement date a security decision too.
Mobile Apps, Reverse Engineering and Hardcoded Keys
An app installed on a phone is a copy of the client, and any copy can be opened.
Strings, endpoints and keys can be extracted in an afternoon with free tools and a laptop.
api security services in Kenya should assume every value shipped in the app is public, including obfuscated values.
A hardcoded key is not a secret. It is a published credential with a delay before publication.
The app should authenticate the user rather than the binary, and receive short-lived tokens after login.
Where the risk justifies the friction, bind tokens to the device and to the session.
Certificate pinning raises the cost of interception but does not make the client trustworthy.
api security services in Kenya should test the release build, because debug settings leak more than production settings.
Old app versions stay installed for years, so the API must support revocation by version.
Traffic from retired app versions should be monitored, then blocked once the numbers justify it.
A minimum-version policy is a security control, and it needs a forced update path that users can complete.
What an API Security Review Produces
A review that ends with a slide deck has produced a mood rather than a control.
The output should be a register: finding, evidence, affected endpoint, severity, owner and date.
api security services in Kenya should rank findings by business impact rather than by the elegance of the exploit.
Each finding needs a test that proves the fix, so closure is verifiable by someone other than the author.
The key inventory, the scope matrix and the partner register belong in the appendices.
A review should also record what was not tested and why, because silence is not assurance.
api security services in Kenya should map findings to a recognised framework so the board can compare one year with the next.
Retest dates belong in the same register, with a named person accountable for each one.
api security services in Kenya should report trends: repeat findings, ageing high-severity items and exceptions granted.
A finding open for 180 days is a decision, and the register should say who decided and on what basis.
Engineering needs a fix order that respects dependencies, not a severity score alone.
The final page should state the residual risk in language a finance director can act on.
The Partner Onboarding Checklist
Most partner integrations are built by two engineers and a WhatsApp group with a deadline.
The checklist should make the security work explicit before the first key is issued, not after the first incident.
Collect the legal entity, the data categories, the purpose and the retention period before anything else.
Ask for the partner’s security contact and its incident notification commitment in writing.
api security services in Kenya should define the endpoints, scopes, rate limits and expected volumes before development starts.
Test in sandbox with the partner’s actual client, not a curl script written by one side.
api security services in Kenya should agree the signature scheme, the retry policy and the idempotency rules.
Record the go-live date, the key identifiers and the person who approved the access.
api security services in Kenya should schedule the first review at 30 days, when real traffic exposes the assumptions.
A partner that cannot meet the checklist is a partner that will call at midnight.
The signed checklist belongs with the contract, because memory is not evidence.
The checklist is also a useful refusal tool, since a clear standard makes an unsafe request easier to decline.
A monthly one-page report is more useful than a quarterly deck nobody reads.
Show the four exposure numbers with last month’s value beside each one.
Note every exception granted, who granted it and when it expires.
Name the two decisions the committee must make this month, not twelve recommendations.
Record the date of the next penetration test and the last successful release drill.
A dashboard that only goes up is a dashboard people stop believing.
Where a number improves, say which change caused it, so the gain can be repeated.
Where it worsens, say what will be different by the next report.
Measuring Exposure After the Fix
Closing a finding is not the same as reducing exposure.
The measure is how many keys are unrotated, over-scoped, unowned or invisible to the inventory.
Four numbers deserve a monthly report: unrotated, over-scoped, unowned and invisible keys.
Mean time to revoke a leaked key is a better metric than the number of scans performed.
api security services in Kenya should track the share of callbacks verified and the share of endpoints with rate limits.
Coverage matters. An inventory that knows 70 percent of keys is a 30 percent blind spot with a dashboard.
Sampling production traffic each quarter finds the keys the register missed.
The board needs one page: exposure, trend, decisions required and the date of the next test.
api security services in Kenya should set a target for key age and hold teams to it, with an exception process.
A security programme that cannot show a falling number will lose its budget at the next cycle.
Publishing the metrics internally changes behaviour faster than any policy memo.
Exposure falls when the boring work is measured, not when the annual report is written.
