Nami Smart LLC

How we work on security

SecurityCloudflareGitHub

So that our customers can use our web services with confidence, we work on security continuously.

The threats we plan for

1. A malicious part is mixed in

A web service is assembled from hundreds of small parts (libraries) published by developers around the world. Our web services use many parts developed by others as well, and are no exception. A part generally reaches other developers like this: a developer writes a program on their own PC, stores that program in a service that keeps programs (called a repository), and then puts the built form of it that other developers actually need (the part itself) into a service that distributes parts (called a registry), from where other developers can use it.

Attackers go after this chain of steps. They take over the account a widely used part’s author holds on the service that keeps the program (GitHub, for instance) or on the service they publish parts through (npm, for instance), quietly mix a malicious program into the contents, and publish it as a new version. It is like stealing the factory manager’s uniform and ID badge (that is, the author’s account), impersonating them, and shipping a malicious part. When companies pull in a part made by the fake factory manager without question, one attack harms thousands of them at once. The same is true of programs. This is called a supply chain attack.

2. A known weakness is left in place

Separately from 1, a part considered sound (and carrying no ill intent) when it was published can turn out to have a flaw. Such flaws can go unfound for a long time and stay in use across many web services.

When someone finds a flaw one day and reports it to the maker of the part through the proper process, the fix and the description of exactly what was dangerous are usually published at the same time. That is meant as a warning to everyone using the part, telling them to update it quickly. However, attackers learn of the flaw too, so they only have to look for services that have not taken the fix, and can attack them right away. The problem is how long companies take to replace the part once the flaw is public. This is called an N-day attack.

3. Data that was sent gets executed as a command

If there is a bug where characters typed into an input field (the text of a product review a customer writes, say) are executed as a program instruction on the server, an attacker can do whatever they like on the operator’s server. A server is a computer the operator manages, the place where work that customers should not be free to run is carried out.

Think of a school, where calculating and recording grades is the teacher’s job, and students cannot mark their own papers and record the results. If a student could write some magic circle on their answer sheet, take control of what the teacher does, and set their own grade, that would be a serious matter.

In the same way, if there were a bug where typing a certain string into a review lets a user do as they like on the server, it would become possible to read the data stored on the server, or the databases that server is allowed to connect to, and steal users’ personal information that nobody else is supposed to see. This is called a remote code execution (RCE) bug.

4. Identity is not checked properly

When identity is not checked thoroughly, or the way it is checked is mistaken, impersonation becomes easy.

As an example, consider a spa. Guests are handed a locker key at reception on the way in, telling the restaurant or the vending machine its number pays for things, and everything they used is settled together on the way out.

In this arrangement, if someone else’s locker key number can easily be guessed, you can use the restaurant and the vending machines on their number. You may wonder whether a facility really works that way, but they do. If the restaurant staff check who you are by asking you to show the locker key (authentication), the risk of this weakness (a vulnerability) being abused (attacked) goes down. But a service that trusts a number typed into a touch panel, or a number read off a barcode, just as it stands (and turning a number into a barcode is easy enough with a phone app) is doing next to no authentication at all.

Not only spas: a web service too has to authenticate its users (the customer’s browser, or an app they installed) carefully, so that impersonation is not easy. Rather than readily trusting a user who presents a number and says “my ID (locker key number) is N”, it has to trust only the number written on a tag that we, the operator, have signed. Checking that the guest really holds the locker key itself in the spa example, or checking the IC chip of an ID card when you file something at a government office: the operator of a web service has to do something similar at all times.

5. A user can do things they are not supposed to

Change a number in the URL and you see another person’s order or personal details. Or one operation shows you data mixed in from someone who is not you. This happens often. This is known as IDOR, among other names, and it happens when there is a mistake in the program by which a web service judges that “this person is allowed to do this” (authorization).

Think of a museum where different kinds of ticket cost different amounts and admit you to different exhibits. A visitor who bought the cheapest ticket being able to walk straight into a room that charges a supplement, or finding a separately priced piece displayed in a room they are already allowed into, is not a state the museum would want to be in.

How far a legitimate visitor (user) is permitted to go: that is what authorization is.

In the museum, it is physically easy to notice that “this exhibit does not belong in this room”. While building a web service, noticing that “it is odd for this user to see this, or to be able to change this” unfortunately takes the developer’s attention, and continuous checking.

6. A secret leaks

Almost every web service works in concert with various other services. Ours too work with the company that rents us servers, with a credit card payment processor, with an email delivery company and others, using secrets (called API keys) for that purpose.

To the payment processor, for instance, we say: “a user called XX on my service would like to pay YY yen. Contact me when the payment is complete. And I prove that I am who I say I am with this API key.”

If even one of these secrets gets out, someone can impersonate us and extract the information we have passed to that partner. The countermeasure is, of course, not to leak the secret. But should one leak, what matters is detecting it immediately and telling the partner, “this secret has leaked, so invalidate the old one and switch to a new one.”

7. Hammering the server with traffic until it gives out

An attack that floods the service with traffic to take it down. It is called a DDoS attack.

What we do about it

Inspect the parts (against 1 and 2 above)

  • Parts known to carry malicious code are refused as they are fetched. Databases of “this part is malicious” are published, and we use them so that malicious parts are never pulled in.
  • Freshly published parts are not pulled in. Except when a problem is found in what we are currently using, we do not use a version less than seven days old. Most hijacks are discovered and withdrawn within hours to days, so we wait that out before pulling a part in.
  • We detect when a part’s signature saying “this is mine, and here is how I built it” has disappeared, and do not pull the part in when it has. A part that used to carry proof of where it was published from and no longer does is showing a sign that the part has been swapped out.
  • New parts are pulled in automatically once they are seven days old, which keeps the parts current.

Make execution as a command harder (against 3 above)

This gets slightly technical. Our server-side work runs on a foundation called a V8 isolate on Cloudflare Workers. This foundation has no mechanism for running OS commands the way an ordinary server does, and each piece of work runs in an isolated environment of its own. So even if a bug leading to remote code execution did exist, a classic attack that takes over the server itself is unlikely to succeed against this setup. The programs we run on the server are also written with such attacks in mind, with care taken never to execute a user’s input as a command. And on the assumption that arbitrary commands could be run, the server is designed to hold only the minimum information it needs, so that as little as possible can be taken.

Build so that another’s data is unreachable (against 4 and 5 above)

Rakuteam is a service shared by many organizations. There, the constraint that one request handles the data of exactly one organization is not left to each screen’s implementation; it is fixed in shared machinery. The data structure enforces it too, so a child record cannot belong to a different organization than its parent. On top of that, automated tests confirm that data cannot be read across organizations.

Store secrets safely and stay ready for a leak (against 6 above)

  • Secrets are stored encrypted, and decrypting them requires biometric authentication. Even if a developer’s PC were stolen, the information held by the systems we work with could not be extracted.
  • Separate secrets are issued per purpose, keeping the damage from a leak as small as possible.
  • So that a leak can be answered by switching at once, secrets can be rotated automatically.
  • We detect leaks as early as we can, using the alerts provided by the services we use.

Be ready for floods of traffic (against 7 above)

We use the WAF Cloudflare provides, so that a flood of traffic sent in bad faith does not affect our other customers.

In closing

As a company that develops and operates services entrusted with customers’ personal information, such as delivery addresses, names and phone numbers, Namismart LLC will keep working on security continuously. So that everyone can use our services with confidence, we will stay vigilant in how we build them.


Nami Smart LLC

Fast, cost-efficient, high-quality app development. If you would like to talk about a project, please get in touch.

Contact us