<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MOHAMMED SALMAN</title>
    <description>The latest articles on DEV Community by MOHAMMED SALMAN (@mohammedsalman999).</description>
    <link>https://dev.to/mohammedsalman999</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4247290%2F496040c1-dd00-434e-a7a1-e92c5eaa183d.png</url>
      <title>DEV Community: MOHAMMED SALMAN</title>
      <link>https://dev.to/mohammedsalman999</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mohammedsalman999"/>
    <language>en</language>
    <item>
      <title>How to Follow Up on Every Lead: CRM Rules for Indian Business Teams</title>
      <dc:creator>MOHAMMED SALMAN</dc:creator>
      <pubDate>Tue, 17 Nov 2026 12:30:49 +0000</pubDate>
      <link>https://dev.to/mohammedsalman999/how-to-follow-up-on-every-lead-crm-rules-for-indian-business-teams-100k</link>
      <guid>https://dev.to/mohammedsalman999/how-to-follow-up-on-every-lead-crm-rules-for-indian-business-teams-100k</guid>
      <description>&lt;p&gt;To follow up on every lead, give each lead one owner, put every follow-up on a date the system watches, and decide in advance what happens when a closed lead calls again. These three rules stop leads from being forgotten, and they are the ones we built into the ReceptionMonk CRM.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;By the ReceptionMonk team · Last updated: 17 November 2026&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A customer calls on Monday and asks about a demo. Three people in your team see the missed call. Each one thinks someone else will ring back. By Friday, the customer has signed up with someone else.&lt;/p&gt;

&lt;p&gt;Nobody ignored the lead. Nobody was sure it was theirs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://receptionmonk.com" rel="noopener noreferrer"&gt;ReceptionMonk&lt;/a&gt; is a business phone system with an AI receptionist for Indian businesses. It answers every call and logs it automatically. The next question is what your team does after the call. We are testing a new version of our CRM around that question, ahead of rollout. Here are the three rules behind it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffr8xikgwxvt7s904r813.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ffr8xikgwxvt7s904r813.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Who should own a lead?
&lt;/h2&gt;

&lt;p&gt;One person. A lead that "belongs to the team" belongs to nobody.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;New leads start unassigned, and the screen says so.&lt;/strong&gt; We tried assigning leads automatically and removed it. An automatic owner hides the fact that nobody has looked at the lead yet.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Anyone can take a lead that has no owner.&lt;/strong&gt; One tap on "Take lead".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Managers can assign and reassign&lt;/strong&gt;, one lead at a time or many at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Two people can't both win.&lt;/strong&gt; If a colleague takes the lead a second before you, you see "this lead was changed by someone else, refresh and try again". No more guessing who has it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The new owner gets a notification&lt;/strong&gt; on their phone.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How do you stop your team from forgetting a follow-up?
&lt;/h2&gt;

&lt;p&gt;"I'll call back on Thursday" is easy to say and easy to forget. So a follow-up is a real date and time on the lead, with a short note on what to do.&lt;/p&gt;

&lt;p&gt;You can read your day without opening a single lead. Red is late. Amber is today. Blue is later. A Follow-ups tab lists everything scheduled, soonest first.&lt;/p&gt;

&lt;p&gt;When the time comes, the owner gets a reminder by phone notification and by email. The email opens the exact lead. If a lead has no owner, the reminder goes to the person who set the follow-up, so it always lands with someone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fspcjmt83nvd0t3d7l5ck.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fspcjmt83nvd0t3d7l5ck.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;br&gt;
Two small rules keep it honest:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can't schedule a follow-up in the past.&lt;/li&gt;
&lt;li&gt;When a lead is marked Lost or Spam, its follow-up is cleared. Nobody gets reminded about a closed lead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One fix from our testing: the Follow-ups tab first counted only follow-ups that were already due. A call planned for 4 PM showed "0" at 9 AM, and people thought nothing was scheduled. It now lists everything scheduled.&lt;/p&gt;

&lt;h2&gt;
  
  
  What should happen when a lost lead calls again?
&lt;/h2&gt;

&lt;p&gt;The lead should come back. Customers don't follow your pipeline. Someone you marked Lost in March may ring again in June.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Lost lead that calls again moves back to Lead&lt;/strong&gt;, if your company has this setting turned on. The owner is told.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A Won customer who calls again is flagged for follow-up.&lt;/strong&gt; A customer getting back in touch is often an opportunity.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Spam stays Spam.&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One safeguard: if your salesperson changed a lead's stage after the customer called, the older call doesn't undo their decision.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdh8flm4aosjvbh4hk7oz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdh8flm4aosjvbh4hk7oz.png" alt=" " width="800" height="336"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Can you trust the history?
&lt;/h2&gt;

&lt;p&gt;Every lead has a timeline: calls, summaries, stage changes, who took the lead, and any notes your team adds. Adding a note is one button. You just write what happened. A reason for marking a lead Lost is optional, because a forced answer is usually a random answer.&lt;/p&gt;

&lt;p&gt;The timeline also follows permissions. People without CRM access don't see stage history, lost reasons or owner changes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Will this change how your team works overnight?
&lt;/h2&gt;

&lt;p&gt;No. Everything sits behind one setting, so a company can stay on the original CRM and move when the team is ready. Nothing is deleted when the setting changes, and the original screens come back as they were.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four things you can use today, with any CRM
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Name one owner per lead.&lt;/strong&gt; Show "unassigned" openly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put every promise on a calendar&lt;/strong&gt; that something other than memory watches.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Decide what happens when a closed lead returns.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Show the state of the day in colours&lt;/strong&gt;, so nobody opens a lead just to find out it is late.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ask one question about every rule: what happens if nobody does anything? If the answer is "the lead waits quietly", the rule needs work.&lt;/p&gt;

&lt;p&gt;Missed calls are where many lost leads begin. If you want to see what that costs you, try our &lt;a href="https://receptionmonk.com/blog/missed-calls-cost-calculator" rel="noopener noreferrer"&gt;missed call cost calculator&lt;/a&gt;, or read &lt;a href="https://receptionmonk.com/blog/real-estate-missed-calls-lost-leads" rel="noopener noreferrer"&gt;why real estate agents lose leads to missed calls&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What is lead follow-up in a CRM?&lt;/strong&gt;&lt;br&gt;
Lead follow-up is the next step you promise a customer after a call or enquiry, such as a call-back on a set day. A CRM stores it as a date and a note on the lead, and reminds the owner when it is due.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does every lead need one owner?&lt;/strong&gt;&lt;br&gt;
When a lead belongs to a team, each person assumes someone else will respond. One named owner removes that doubt, and a lead with no owner stays visibly unassigned until someone takes it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What should happen when a Lost lead calls again?&lt;/strong&gt;&lt;br&gt;
It should move back to Lead and tell the owner, so the call isn't treated as a new stranger. In the ReceptionMonk CRM this works when your company has the reopen setting turned on.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Does ReceptionMonk log calls automatically?&lt;/strong&gt;&lt;br&gt;
Yes. Calls handled by ReceptionMonk are logged to the CRM automatically, so your team doesn't copy details by hand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Is the new CRM live for everyone?&lt;/strong&gt;&lt;br&gt;
Not yet. It is in testing ahead of rollout, and companies will move to it with a single setting.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Want to hear the AI receptionist yourself? &lt;a href="https://receptionmonk.com" rel="noopener noreferrer"&gt;Call our live demo line&lt;/a&gt; from your phone.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>crm</category>
      <category>productivity</category>
      <category>startup</category>
      <category>business</category>
    </item>
    <item>
      <title>How I scan uploaded audio files for malware in Go (and why the gate fails closed)</title>
      <dc:creator>MOHAMMED SALMAN</dc:creator>
      <pubDate>Mon, 16 Nov 2026 09:25:41 +0000</pubDate>
      <link>https://dev.to/mohammedsalman999/how-i-scan-uploaded-audio-files-for-malware-in-go-and-why-the-gate-fails-closed-1cp5</link>
      <guid>https://dev.to/mohammedsalman999/how-i-scan-uploaded-audio-files-for-malware-in-go-and-why-the-gate-fails-closed-1cp5</guid>
      <description>&lt;p&gt;I work on a cloud telephony product &lt;a href="https://receptionmonk.com/?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=clamav-blog" rel="noopener noreferrer"&gt;ReceptionMonk&lt;/a&gt;. One feature lets a business owner upload their own audio for the phone menu: "Press 1 for sales, press 2 for support." Those files end up on the telephony server and play to every caller.&lt;/p&gt;

&lt;p&gt;That means a stranger can send a file that lands on a server that talks to the phone network. So every upload goes through a virus scanner before it is stored. This post is about how that scanner gate is built in Go, and one decision we got wrong the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The problem with "just call the scanner"
&lt;/h2&gt;

&lt;p&gt;The first version of most upload scanning looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;scanner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s2"&gt;"infected"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"virus found"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read it again and ask: what happens when the scanner is down?&lt;/p&gt;

&lt;p&gt;&lt;code&gt;status&lt;/code&gt; is empty, it is not &lt;code&gt;"infected"&lt;/code&gt;, and the file gets saved. The scanner fails, and the upload succeeds. That is called &lt;strong&gt;failing open&lt;/strong&gt;, and it means your protection disappears exactly when something is already going wrong.&lt;/p&gt;

&lt;p&gt;We had two upload paths that needed scanning: identity documents and IVR audio. I wanted both to use one gate, so a third upload path added next year could not quietly skip it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three outcomes, not two
&lt;/h2&gt;

&lt;p&gt;The core idea: a scan has three possible results, and only one of them lets the file through.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scanner result&lt;/th&gt;
&lt;th&gt;What the user sees&lt;/th&gt;
&lt;th&gt;File stored?&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Clean&lt;/td&gt;
&lt;td&gt;Upload succeeds&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Infected&lt;/td&gt;
&lt;td&gt;400: "the file was rejected because the virus scanner reported malware"&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Could not scan (scanner missing, unreachable, timed out, or returned an error)&lt;/td&gt;
&lt;td&gt;503 with &lt;code&gt;Retry-After&lt;/code&gt;: "please try again in a few minutes"&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The third row is the important one. "I could not check this file" is treated as "no", and the user gets an honest, retryable error instead of a silent success.&lt;/p&gt;

&lt;p&gt;In Go, that becomes two sentinel errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="nc"&gt;ErrInfected&lt;/span&gt;        &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"uploadscan: file rejected by virus scanner"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nc"&gt;ErrScanUnavailable&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"uploadscan: virus scanner unavailable"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And the gate returns &lt;code&gt;nil&lt;/code&gt; only for a clean verdict:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ScanFileAt returns nil only for a clean verdict.&lt;/span&gt;
&lt;span class="c1"&gt;// Callers must reject the upload on any non-nil error.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nc"&gt;Gate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;ScanFileAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt; &lt;span class="nc"&gt;Meta&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scan&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;record&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// every attempt gets an audit row&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ErrInfected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;alerter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;VirusDetected&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;meta&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Signature&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The classification itself is a &lt;code&gt;switch&lt;/code&gt; with a &lt;code&gt;default&lt;/code&gt; that fails closed. If ClamAV ever returns a status I did not plan for, the file is rejected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;scanErr&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;StatusError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;StatusError&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ErrScanUnavailable&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;StatusClean&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;StatusClean&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="nc"&gt;StatusInfected&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;StatusInfected&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Signature&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sig&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ErrInfected&lt;/span&gt;
&lt;span class="k"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="c1"&gt;// unknown status: treat as "could not scan"&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nc"&gt;Status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;StatusError&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;ErrScanUnavailable&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The scan also runs under &lt;code&gt;context.WithTimeout&lt;/code&gt;, so a hung scanner turns into &lt;code&gt;ErrScanUnavailable&lt;/code&gt; instead of a request that never ends.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where the scan sits in the upload
&lt;/h2&gt;

&lt;p&gt;Order matters as much as the scan. For audio, the handler does this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Stream the upload to a temporary file, with a size cap.&lt;/li&gt;
&lt;li&gt;Check that it really is audio (parse it, read the duration). A file named &lt;code&gt;.wav&lt;/code&gt; with broken chunks is rejected before it costs a scan.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scan the temporary file.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Only on a clean verdict, copy it into the telephony sound directory, using a temp file plus &lt;code&gt;os.Rename&lt;/code&gt; so a half-written file is never visible.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Nothing touches the directory the phone system reads from until the scanner says clean.&lt;/p&gt;

&lt;p&gt;The handler code stays small because the gate does the thinking:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scanGate&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ScanFileAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tempPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uploadscan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Meta&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;   &lt;span class="s2"&gt;"ivr_audio"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;CompanyID&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tenantID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nc"&gt;Filename&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;  &lt;span class="n"&gt;originalName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Is&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;uploadscan&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;ErrInfected&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;badRequest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"the file was rejected because the virus scanner reported malware"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Response&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Header&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Retry-After"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"60"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;serviceUnavailable&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"virus scanning is temporarily unavailable, so the file was not saved; please try again in a few minutes"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c1"&gt;// clean: safe to store&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  An audit row for every scan
&lt;/h2&gt;

&lt;p&gt;Every scan attempt writes a row to an &lt;code&gt;upload_scan&lt;/code&gt; table (it is an Ent schema in our case): which upload path, which company and user, the original filename, where the file would be stored, the result, the virus signature if any, and when it was scanned.&lt;/p&gt;

&lt;p&gt;This answered questions I did not expect to get:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;"Was this customer's file actually scanned?" Look it up.&lt;/li&gt;
&lt;li&gt;"How often is the scanner unavailable?" Count the &lt;code&gt;scan_error&lt;/code&gt; rows per day.&lt;/li&gt;
&lt;li&gt;"Did we block anything last month?" Filter by &lt;code&gt;infected&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If writing the row fails, the gate logs it and still returns the real verdict. A broken audit table should not let an infected file through, and it should not block a clean one either.&lt;/p&gt;

&lt;h2&gt;
  
  
  Alerts that fire once per detection
&lt;/h2&gt;

&lt;p&gt;When a file is infected, the gate tells an admin by email (and, later, our error tracker). The alert key is built from the upload context, the company, the stored reference and the signature. Every real detection alerts, but a retried dispatch of the same detection does not send the email twice.&lt;/p&gt;

&lt;p&gt;The logs carry IDs and the filename, never the file content.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mistake: we shipped fail-open first
&lt;/h2&gt;

&lt;p&gt;Here is the honest part. Our first version did fail open. The reasoning sounded fine at the time: "If ClamAV is down, customers can't upload greetings, and that's a bad experience."&lt;/p&gt;

&lt;p&gt;A reviewer pushed back in code review, and they were right. The original requirement said uploads must be scanned. A gate that lets files through whenever the scanner is unhealthy does not meet that requirement. It only meets it on good days.&lt;/p&gt;

&lt;p&gt;We switched to fail-closed, and in practice the "bad experience" is small: the user sees a clear message, waits a minute, and tries again. That is a much better trade than a file nobody checked sitting on a phone server.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing it without ClamAV running
&lt;/h2&gt;

&lt;p&gt;The gate depends on a tiny interface instead of the real ClamAV client:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;streamScanner&lt;/span&gt; &lt;span class="k"&gt;interface&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;ScanStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="n"&gt;io&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Reader&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;ScanStatus&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So the tests inject a fake scanner and check every row of the table above: clean stores the file, infected returns &lt;code&gt;ErrInfected&lt;/code&gt; and fires exactly one alert, and each failure mode (no scanner, connection error, timeout, unknown status) returns &lt;code&gt;ErrScanUnavailable&lt;/code&gt; and stores nothing. The recorder and alerter are interfaces too, so tests can assert that an audit row was written for every case.&lt;/p&gt;

&lt;h2&gt;
  
  
  What I would tell myself before starting
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Write down what happens when the dependency is down &lt;strong&gt;before&lt;/strong&gt; writing the happy path.&lt;/li&gt;
&lt;li&gt;Return &lt;code&gt;nil&lt;/code&gt; for exactly one outcome. Everything else is an error.&lt;/li&gt;
&lt;li&gt;Put the check in one shared place, so new upload paths get it for free.&lt;/li&gt;
&lt;li&gt;Record every attempt. You will want the data the first time someone asks "was this scanned?"&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I'm building this as part of &lt;a href="https://receptionmonk.com/?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=clamav-blog" rel="noopener noreferrer"&gt;ReceptionMonk&lt;/a&gt;, an AI receptionist and cloud phone system for businesses in India. I write about the Go, telephony and AI problems we run into along the way, so follow along if that's your kind of thing.&lt;/p&gt;

</description>
      <category>go</category>
      <category>security</category>
      <category>backend</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
